1. Open http://codepen.io/RachelSeale/pen/wBqyu 2. Right click and start the inspector 3. Make sure the DOM tree is selected 4. Hide the Styles panel 5. Close the Inspector 6. Start the inspector again and go to the DOM tree. Result: Infinite loop in the WebInspector window and process goes up to 100% CPU usage. There's a for (;;) loop in scrollCursorIntoView and it never gets out of it. Note that the line numbers in codemirror.js might be skewed as I needed to add some instrumentation to catch this. scrollCursorIntoView@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:2634:35 endOperation@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:1389:27 runInOp@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:1436:39 operation@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:3214:42 _resetContent@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/CSSStyleDeclarationTextEditor.js:991:35 style@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/CSSStyleDeclarationTextEditor.js:127:27 refresh@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/ComputedStyleDetailsPanel.js:64:35 _refreshPreservingScrollPosition@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/StyleDetailsPanel.js:142:21 _nodeStylesRefreshed@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/StyleDetailsPanel.js:153:50 dispatch@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/Object.js:180:55 dispatchEventToListeners@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/Object.js:187:17 fetchedComputedStyle@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/DOMNodeStyles.js:243:42 fetchedComputedStyle@[native code] dispatch@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/InspectorBackend.js:220:31 dispatchNextQueuedMessageFromBackend@file:///Users/achicu/code/webkit/WebKitBuild/named_flows/Release/WebInspectorUI.framework/Resources/Main.js:319:34 [native code]
<rdar://problem/15242526>
Good find! Some people have been mentioning inspector hangs that I haven't been able to reproduce. For starters we can try to make a CodeMirror reduction and file a CodeMirror issue, and if needed create a fix ourselves.
The for (;;) is now in scrollPosIntoView, which scrollCursorIntoView calls.
Those step no longer reproduce a hang. Perhaps our updated CodeMirror fixed it?