Steps: 1. In the console, make a method call that has an anonymous callback function with a debugger statement. Example method call below: navigator.geolocation.getCurrentPosition(function(position){ console.log(position); debugger;}, function(error){ console.log(error); debugger; }); 2. When prompted for user location access, deny permission. 3. Type `error` in the console to access the `error` argument of the callback function. Results: I expect to see the error (PositionError object) and have the ability to access its properties, but I get "ReferenceError: Can't find variable: error". The debugger is paused, but it is not paused on any specific point. I also expect to see the debugger paused on the debugger statement within the anonymous function. <rdar://problem/25857118>
Created attachment 277079 [details] Patch
Comment on attachment 277079 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277079&action=review > Source/WebInspectorUI/ChangeLog:6 > + Web Inspector: Debugger statement in console does not provide any call frames and debugger UI is confused > + > + https://bugs.webkit.org/show_bug.cgi?id=156919 > + rdar://problem/25857118 Unexpected empty line (changes git log --oneline when committed). > Source/WebInspectorUI/UserInterface/Base/Utilities.js:1260 > + if (string.includes("//# sourceURL")) > + return string; I worry about how expensive this could get, but at the moment I don't think we ever have very large strings. > Source/WebInspectorUI/UserInterface/Base/Utilities.js:1276 > +function isWebInspectorConsoleExpressionScript(url) Maybe "isWebInspectorConsoleEvaluationScript". s/Expression/Evaluation/ > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:-583 > - if (isWebInspectorInternalScript(sourceURL)) > - return; > - I think this can be left in. Now that you have separated Console Evaluations from other Internal Scripts. I don't think we want to create and keep around a WebInspector.Script for every internal script. > Source/WebInspectorUI/UserInterface/Models/Script.js:103 > + return WebInspector.UIString("Console Expression %d").format(this._uniqueDisplayNameNumber); Nit: I like "Console Evaluation %d" instead of "Expression". Since you can evaluate more then just a single expression in the console, its technically a whole program evaluation. > Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:211 > + var treeElement = this.contentTreeOutline.findTreeElement(representedObject); Style: `let` > Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js:466 > + return treeElement; The other returns here should probably return `null` now.
<rdar://problem/25881551>
Comment on attachment 277079 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277079&action=review > Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js:551 > + if (!this._activeCallFrame) { > + this._didResumeInternal(); > + return; > + } Maybe we should add an assert / warning for our purposes. This might catch something in the future where we expected to pause and didn't.
Comment on attachment 277079 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=277079&action=review > Source/WebInspectorUI/UserInterface/Models/Script.js:53 > static resetUniqueDisplayNameNumbers() It doesn't look like this ever gets called the first time the inspector opens. Only after page loads. I think DebuggerManager should call this in its constructor.
https://trac.webkit.org/r199897
Follow up: https://trac.webkit.org/r199899