Changeset 199897 in webkit
- Timestamp:
- Apr 22, 2016 12:53:37 PM (8 years ago)
- Location:
- trunk/Source/WebInspectorUI
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebInspectorUI/ChangeLog
r199852 r199897 1 2016-04-22 Timothy Hatcher <timothy@apple.com> 2 3 Web Inspector: Debugger statement in console does not provide any call frames and debugger UI is confused 4 5 https://bugs.webkit.org/show_bug.cgi?id=156919 6 rdar://problem/25857118 7 8 This makes console expressions show up in the Debugger tab sidebar if a ScriptContentView is shown for them. 9 We now also show call frames that originate from a console expression, so the call frames in the sidebar is not empty. 10 Also fix a bug where when there are no call frames we auto resume the debugger and don't leave it in a broken state. 11 12 Reviewed by Joseph Pecoraro. 13 14 * Localizations/en.lproj/localizedStrings.js: Updated. 15 16 * UserInterface/Base/Utilities.js: 17 (appendWebInspectorSourceURL): Don't append if another sourceURL is already added. 18 (appendWebInspectorConsoleEvaluationSourceURL): Added. 19 (isWebInspectorConsoleEvaluationScript): Added. 20 (isWebKitInternalScript): Return false for isWebInspectorConsoleEvaluationScript(). 21 22 * UserInterface/Controllers/DebuggerManager.js: 23 (WebInspector.DebuggerManager.prototype.debuggerDidPause): Resume if call frames is empty. This is not as common now 24 since console expression call frames are not skipped. 25 (WebInspector.DebuggerManager.prototype.scriptDidParse): Change an early return for isWebInspectorInternalScript() that 26 was skipping adding internal scripts to the known script lists, but it should only do that when the debug UI is disabled. 27 28 * UserInterface/Controllers/JavaScriptLogViewController.js: 29 (WebInspector.JavaScriptLogViewController.prototype.consolePromptTextCommitted): 30 Call appendWebInspectorConsoleEvaluationSourceURL so the console expressions are tagged before evaluateInInspectedWindow 31 added the internal sourceURL name. 32 33 * UserInterface/Models/Script.js: 34 (WebInspector.Script): Assign unique identifiers to console scripts so they are named correctly. 35 (WebInspector.Script.resetUniqueDisplayNameNumbers): Reset _nextUniqueConsoleDisplayNameNumber. 36 (WebInspector.Script.prototype.get displayName): Special case console expressions with a better name. 37 38 * UserInterface/Views/DebuggerSidebarPanel.js: 39 (WebInspector.DebuggerSidebarPanel.prototype.treeElementForRepresentedObject): Add a script tree element on demand 40 like the ResourceSidebarPanel does for anonymous scripts. 41 (WebInspector.DebuggerSidebarPanel.prototype._addScript): Return treeElement so treeElementForRepresentedObject can use it. 42 1 43 2016-04-21 Joseph Pecoraro <pecoraro@apple.com> 2 44 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r199635 r199897 182 182 localizedStrings["Conditional expression"] = "Conditional expression"; 183 183 localizedStrings["Console"] = "Console"; 184 localizedStrings["Console Evaluation %d"] = "Console Evaluation %d"; 184 185 localizedStrings["Console Profile Recorded"] = "Console Profile Recorded"; 185 186 localizedStrings["Console errors, click to show the Console tab"] = "Console errors, click to show the Console tab"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js
r199789 r199897 1257 1257 function appendWebInspectorSourceURL(string) 1258 1258 { 1259 if (string.includes("//# sourceURL")) 1260 return string; 1259 1261 return "\n//# sourceURL=__WebInspectorInternal__\n" + string; 1260 1262 } 1261 1263 1264 function appendWebInspectorConsoleEvaluationSourceURL(string) 1265 { 1266 if (string.includes("//# sourceURL")) 1267 return string; 1268 return "\n//# sourceURL=__WebInspectorConsoleEvaluation__\n" + string; 1269 } 1270 1262 1271 function isWebInspectorInternalScript(url) 1263 1272 { … … 1265 1274 } 1266 1275 1276 function isWebInspectorConsoleEvaluationScript(url) 1277 { 1278 return url === "__WebInspectorConsoleEvaluation__"; 1279 } 1280 1267 1281 function isWebKitInternalScript(url) 1268 1282 { 1283 if (isWebInspectorConsoleEvaluationScript(url)) 1284 return false; 1269 1285 return url && url.startsWith("__Web") && url.endsWith("__"); 1270 1286 } -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js
r199602 r199897 546 546 this._activeCallFrame = this._callFrames[0]; 547 547 548 if (!this._activeCallFrame) { 549 console.assert("We should always have one call frame. This could indicate we are hitting an exception or debugger statement in an internal injected script."); 550 this._didResumeInternal(); 551 return; 552 } 553 548 554 if (!wasStillPaused) 549 555 this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.Paused); … … 579 585 } 580 586 581 if ( isWebInspectorInternalScript(sourceURL))587 if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceURL)) 582 588 return; 583 589 … … 600 606 return; 601 607 } 608 609 // Console expressions are not added to the UI by default. 610 if (isWebInspectorConsoleEvaluationScript(script.sourceURL)) 611 return; 602 612 603 613 this.dispatchEventToListeners(WebInspector.DebuggerManager.Event.ScriptAdded, {script}); -
trunk/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
r192908 r199897 229 229 } 230 230 231 text = appendWebInspectorConsoleEvaluationSourceURL(text); 232 231 233 WebInspector.runtimeManager.evaluateInInspectedWindow(text, WebInspector.RuntimeManager.ConsoleObjectGroup, true, false, false, true, true, printResult.bind(this)); 232 234 } -
trunk/Source/WebInspectorUI/UserInterface/Models/Script.js
r199852 r199897 46 46 WebInspector.sourceMapManager.downloadSourceMap(sourceMapURL, this._url, this); 47 47 48 if (isWebInspectorConsoleEvaluationScript(this._sourceURL)) { 49 // Assign a unique number to the script object so it will stay the same. 50 this._uniqueDisplayNameNumber = this.constructor._nextUniqueConsoleDisplayNameNumber++; 51 } 52 48 53 this._scriptSyntaxTree = null; 49 54 } … … 54 59 { 55 60 WebInspector.Script._nextUniqueDisplayNameNumber = 1; 61 WebInspector.Script._nextUniqueConsoleDisplayNameNumber = 1; 56 62 } 57 63 … … 94 100 if (this._url) 95 101 return WebInspector.displayNameForURL(this._url, this.urlComponents); 102 103 if (isWebInspectorConsoleEvaluationScript(this._sourceURL)) { 104 console.assert(this._uniqueDisplayNameNumber); 105 return WebInspector.UIString("Console Evaluation %d").format(this._uniqueDisplayNameNumber); 106 } 96 107 97 108 if (this._sourceURL) { … … 248 259 249 260 WebInspector.Script._nextUniqueDisplayNameNumber = 1; 261 WebInspector.Script._nextUniqueConsoleDisplayNameNumber = 1; -
trunk/Source/WebInspectorUI/UserInterface/Views/DebuggerSidebarPanel.js
r199602 r199897 209 209 representedObject = representedObject.mainResource; 210 210 211 return this.contentTreeOutline.getCachedTreeElement(representedObject); 211 let treeElement = this.contentTreeOutline.findTreeElement(representedObject); 212 if (treeElement) 213 return treeElement; 214 215 // Only special case Script objects. 216 if (!(representedObject instanceof WebInspector.Script)) { 217 console.error("Didn't find a TreeElement for representedObject", representedObject); 218 return null; 219 } 220 221 // If the Script has a URL we should have found it earlier. 222 if (representedObject.url) { 223 console.error("Didn't find a ScriptTreeElement for a Script with a URL."); 224 return null; 225 } 226 227 // Since the Script does not have a URL we consider it an 'anonymous' script. These scripts happen from calls to 228 // window.eval() or browser features like Auto Fill and Reader. They are not normally added to the sidebar, but since 229 // we have a ScriptContentView asking for the tree element we will make a ScriptTreeElement on demand and add it. 230 231 return this._addScript(representedObject); 212 232 } 213 233 … … 430 450 // COMPATIBILITY(iOS 9): Backends could send the frontend built-in code, filter out JSC internals. 431 451 if (!script.url && !script.sourceURL) 432 return ;452 return null; 433 453 434 454 // Don't add breakpoints if the script is represented by a Resource. They were 435 455 // already added by _resourceAdded. 436 456 if (script.resource) 437 return ;457 return null; 438 458 439 459 let treeElement = this._addTreeElementForSourceCodeToContentTreeOutline(script); … … 443 463 if (!this.contentBrowser.currentContentView) 444 464 this.showDefaultContentViewForTreeElement(treeElement); 465 466 return treeElement; 445 467 } 446 468
Note: See TracChangeset
for help on using the changeset viewer.