Loading browser/devtools/debugger/debugger-view.js +33 −17 Original line number Diff line number Diff line Loading @@ -150,35 +150,35 @@ DebuggerView.Stackframes = { * * @param number aDepth * The frame depth specified by the debugger. * @param string aFrameIdText * The id to be displayed in the list. * @param string aFrameNameText * The name to be displayed in the list. * @param string aFrameDetailsText * The details to be displayed in the list. * @return object * The newly created html node representing the added frame. */ addFrame: function DVF_addFrame(aDepth, aFrameIdText, aFrameNameText) { addFrame: function DVF_addFrame(aDepth, aFrameNameText, aFrameDetailsText) { // make sure we don't duplicate anything if (document.getElementById("stackframe-" + aDepth)) { return null; } let frame = document.createElement("div"); let frameId = document.createElement("span"); let frameName = document.createElement("span"); let frameDetails = document.createElement("span"); // create a list item to be added to the stackframes container frame.id = "stackframe-" + aDepth; frame.className = "dbg-stackframe list-item"; // this list should display the id and name of the frame frameId.className = "dbg-stackframe-id"; // this list should display the name and details for the frame frameName.className = "dbg-stackframe-name"; frameId.appendChild(document.createTextNode(aFrameIdText)); frameDetails.className = "dbg-stackframe-details"; frameName.appendChild(document.createTextNode(aFrameNameText)); frameDetails.appendChild(document.createTextNode(aFrameDetailsText)); frame.appendChild(frameId); frame.appendChild(frameName); frame.appendChild(frameDetails); this._frames.appendChild(frame); Loading Loading @@ -1074,6 +1074,7 @@ DebuggerView.Scripts = { * * @param string aUrl * The script URL. * @return boolean */ contains: function DVS_contains(aUrl) { if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) { Loading @@ -1082,6 +1083,21 @@ DebuggerView.Scripts = { return false; }, /** * Checks whether the script with the specified label is among the scripts * known to the debugger and shown in the list. * * @param string aLabel * The script label. * @return boolean */ containsLabel: function DVS_containsLabel(aLabel) { if (this._scripts.getElementsByAttribute("label", aLabel).length > 0) { return true; } return false; }, /** * Checks whether the script with the specified URL is selected in the list. * Loading Loading @@ -1116,23 +1132,23 @@ DebuggerView.Scripts = { * If the script already exists (was previously added), null is returned. * Otherwise, the newly created element is returned. * * @param string aUrl * The script url. * @param string aLabel * The simplified script location to be shown. * @param string aScript * The source script. * @param string aScriptNameText * Optional, title displayed instead of url. * @return object * The newly created html node representing the added script. */ addScript: function DVS_addScript(aUrl, aSource, aScriptNameText) { addScript: function DVS_addScript(aLabel, aScript) { // make sure we don't duplicate anything if (this.contains(aUrl)) { if (this.containsLabel(aLabel)) { return null; } let script = this._scripts.appendItem(aScriptNameText || aUrl, aUrl); script.setUserData("sourceScript", aSource, null); let script = this._scripts.appendItem(aLabel, aScript.url); script.setAttribute("tooltiptext", aScript.url); script.setUserData("sourceScript", aScript, null); this._scripts.selectedItem = script; return script; }, Loading browser/devtools/debugger/debugger.css +20 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,26 @@ overflow: auto; } .dbg-stackframe { display: block; } .dbg-stackframe-name { float: left; } .dbg-stackframe-details { float: right; } .dbg-stackframe-name:-moz-locale-dir(rtl) { float: right; } .dbg-stackframe-details:-moz-locale-dir(rtl) { float: left; } /** * Properties elements */ Loading browser/devtools/debugger/debugger.js +77 −13 Original line number Diff line number Diff line Loading @@ -370,10 +370,12 @@ var StackFrames = { */ _addFramePanel: function SF_addFramePanel(aFrame) { let depth = aFrame.depth; let idText = "#" + aFrame.depth + " "; let nameText = this._frameTitle(aFrame); let label = SourceScripts._getScriptLabel(aFrame.where.url); let panel = DebuggerView.Stackframes.addFrame(depth, idText, nameText); let startText = this._frameTitle(aFrame); let endText = label + ":" + aFrame.where.line; let panel = DebuggerView.Stackframes.addFrame(depth, startText, endText); if (panel) { panel.stackFrame = aFrame; Loading @@ -397,7 +399,7 @@ var StackFrames = { */ _frameTitle: function SF_frameTitle(aFrame) { if (aFrame.type == "call") { return aFrame["calleeName"] ? aFrame["calleeName"] + "()" : "(anonymous)"; return aFrame["calleeName"] ? aFrame["calleeName"] : "(anonymous)"; } return "(" + aFrame.type + ")"; Loading @@ -416,6 +418,7 @@ StackFrames.onClick = StackFrames.onClick.bind(StackFrames); var SourceScripts = { pageSize: 25, activeThread: null, _labelsCache: null, /** * Watch a given thread client. Loading @@ -431,6 +434,7 @@ var SourceScripts = { aThreadClient.addListener("paused", this.onPaused); aThreadClient.addListener("scriptsadded", this.onScripts); aThreadClient.addListener("scriptscleared", this.onScriptsCleared); this.clearLabelsCache(); this.onScriptsCleared(); aCallback && aCallback(); }, Loading Loading @@ -509,26 +513,86 @@ var SourceScripts = { return; } let url = aUrl; // Trim the query part. let q = url.indexOf('?'); if (q > -1) { url = url.slice(0, q); } if (url.slice(-3) == ".js") { if (this._trimUrlQuery(aUrl).slice(-3) == ".js") { window.editor.setMode(SourceEditor.MODES.JAVASCRIPT); } else { window.editor.setMode(SourceEditor.MODES.HTML); } }, /** * Trims the query part of a url string, if necessary. * * @param string aUrl * The script url. * @return string */ _trimUrlQuery: function SS_trimUrlQuery(aUrl) { let q = aUrl.indexOf('?'); if (q > -1) { return aUrl.slice(0, q); } return aUrl; }, /** * Gets a unique, simplified label from a script url. * ex: a). ici://some.address.com/random/subrandom/ * b). ni://another.address.org/random/subrandom/page.html * c). san://interesting.address.gro/random/script.js * d). si://interesting.address.moc/random/another/script.js * => * a). subrandom/ * b). page.html * c). script.js * d). another/script.js * * @param string aUrl * The script url. * @param string aHref * The content location href to be used. If unspecified, it will * defalult to debugged panrent window location. * @return string * The simplified label. */ _getScriptLabel: function SS_getScriptLabel(aUrl, aHref) { let url = this._trimUrlQuery(aUrl); if (this._labelsCache[url]) { return this._labelsCache[url]; } let href = aHref || window.parent.content.location.href; let pathElements = url.split("/"); let label = pathElements.pop() || (pathElements.pop() + "/"); // if the label as a leaf name is alreay present in the scripts list if (DebuggerView.Scripts.containsLabel(label)) { label = url.replace(href.substring(0, href.lastIndexOf("/") + 1), ""); // if the path/to/script is exactly the same, we're in different domains if (DebuggerView.Scripts.containsLabel(label)) { label = url; } } return this._labelsCache[url] = label; }, /** * Clears the labels cache, populated by SS_getScriptLabel(). * This should be done every time the content location changes. */ clearLabelsCache: function SS_clearLabelsCache() { this._labelsCache = {}; }, /** * Add the specified script to the list and display it in the editor if the * editor is empty. */ _addScript: function SS_addScript(aScript) { DebuggerView.Scripts.addScript(aScript.url, aScript); DebuggerView.Scripts.addScript(this._getScriptLabel(aScript.url), aScript); if (window.editor.getCharCount() == 0) { this._showScript(aScript); Loading browser/devtools/debugger/test/browser_dbg_clean-exit.js +1 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,7 @@ var gTab = null; var gDebuggee = null; var gDebugger = null; const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" + "debugger/test/" + "browser_dbg_debuggerstatement.html"; const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; function test() { debug_tab_pane(DEBUGGER_TAB_URL, function(aTab, aDebuggee, aPane) { Loading browser/devtools/debugger/test/browser_dbg_debuggerstatement.js +1 −3 Original line number Diff line number Diff line Loading @@ -8,9 +8,7 @@ var gClient = null; var gTab = null; const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" + "debugger/test/" + "browser_dbg_debuggerstatement.html"; const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; function test() { Loading Loading
browser/devtools/debugger/debugger-view.js +33 −17 Original line number Diff line number Diff line Loading @@ -150,35 +150,35 @@ DebuggerView.Stackframes = { * * @param number aDepth * The frame depth specified by the debugger. * @param string aFrameIdText * The id to be displayed in the list. * @param string aFrameNameText * The name to be displayed in the list. * @param string aFrameDetailsText * The details to be displayed in the list. * @return object * The newly created html node representing the added frame. */ addFrame: function DVF_addFrame(aDepth, aFrameIdText, aFrameNameText) { addFrame: function DVF_addFrame(aDepth, aFrameNameText, aFrameDetailsText) { // make sure we don't duplicate anything if (document.getElementById("stackframe-" + aDepth)) { return null; } let frame = document.createElement("div"); let frameId = document.createElement("span"); let frameName = document.createElement("span"); let frameDetails = document.createElement("span"); // create a list item to be added to the stackframes container frame.id = "stackframe-" + aDepth; frame.className = "dbg-stackframe list-item"; // this list should display the id and name of the frame frameId.className = "dbg-stackframe-id"; // this list should display the name and details for the frame frameName.className = "dbg-stackframe-name"; frameId.appendChild(document.createTextNode(aFrameIdText)); frameDetails.className = "dbg-stackframe-details"; frameName.appendChild(document.createTextNode(aFrameNameText)); frameDetails.appendChild(document.createTextNode(aFrameDetailsText)); frame.appendChild(frameId); frame.appendChild(frameName); frame.appendChild(frameDetails); this._frames.appendChild(frame); Loading Loading @@ -1074,6 +1074,7 @@ DebuggerView.Scripts = { * * @param string aUrl * The script URL. * @return boolean */ contains: function DVS_contains(aUrl) { if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) { Loading @@ -1082,6 +1083,21 @@ DebuggerView.Scripts = { return false; }, /** * Checks whether the script with the specified label is among the scripts * known to the debugger and shown in the list. * * @param string aLabel * The script label. * @return boolean */ containsLabel: function DVS_containsLabel(aLabel) { if (this._scripts.getElementsByAttribute("label", aLabel).length > 0) { return true; } return false; }, /** * Checks whether the script with the specified URL is selected in the list. * Loading Loading @@ -1116,23 +1132,23 @@ DebuggerView.Scripts = { * If the script already exists (was previously added), null is returned. * Otherwise, the newly created element is returned. * * @param string aUrl * The script url. * @param string aLabel * The simplified script location to be shown. * @param string aScript * The source script. * @param string aScriptNameText * Optional, title displayed instead of url. * @return object * The newly created html node representing the added script. */ addScript: function DVS_addScript(aUrl, aSource, aScriptNameText) { addScript: function DVS_addScript(aLabel, aScript) { // make sure we don't duplicate anything if (this.contains(aUrl)) { if (this.containsLabel(aLabel)) { return null; } let script = this._scripts.appendItem(aScriptNameText || aUrl, aUrl); script.setUserData("sourceScript", aSource, null); let script = this._scripts.appendItem(aLabel, aScript.url); script.setAttribute("tooltiptext", aScript.url); script.setUserData("sourceScript", aScript, null); this._scripts.selectedItem = script; return script; }, Loading
browser/devtools/debugger/debugger.css +20 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,26 @@ overflow: auto; } .dbg-stackframe { display: block; } .dbg-stackframe-name { float: left; } .dbg-stackframe-details { float: right; } .dbg-stackframe-name:-moz-locale-dir(rtl) { float: right; } .dbg-stackframe-details:-moz-locale-dir(rtl) { float: left; } /** * Properties elements */ Loading
browser/devtools/debugger/debugger.js +77 −13 Original line number Diff line number Diff line Loading @@ -370,10 +370,12 @@ var StackFrames = { */ _addFramePanel: function SF_addFramePanel(aFrame) { let depth = aFrame.depth; let idText = "#" + aFrame.depth + " "; let nameText = this._frameTitle(aFrame); let label = SourceScripts._getScriptLabel(aFrame.where.url); let panel = DebuggerView.Stackframes.addFrame(depth, idText, nameText); let startText = this._frameTitle(aFrame); let endText = label + ":" + aFrame.where.line; let panel = DebuggerView.Stackframes.addFrame(depth, startText, endText); if (panel) { panel.stackFrame = aFrame; Loading @@ -397,7 +399,7 @@ var StackFrames = { */ _frameTitle: function SF_frameTitle(aFrame) { if (aFrame.type == "call") { return aFrame["calleeName"] ? aFrame["calleeName"] + "()" : "(anonymous)"; return aFrame["calleeName"] ? aFrame["calleeName"] : "(anonymous)"; } return "(" + aFrame.type + ")"; Loading @@ -416,6 +418,7 @@ StackFrames.onClick = StackFrames.onClick.bind(StackFrames); var SourceScripts = { pageSize: 25, activeThread: null, _labelsCache: null, /** * Watch a given thread client. Loading @@ -431,6 +434,7 @@ var SourceScripts = { aThreadClient.addListener("paused", this.onPaused); aThreadClient.addListener("scriptsadded", this.onScripts); aThreadClient.addListener("scriptscleared", this.onScriptsCleared); this.clearLabelsCache(); this.onScriptsCleared(); aCallback && aCallback(); }, Loading Loading @@ -509,26 +513,86 @@ var SourceScripts = { return; } let url = aUrl; // Trim the query part. let q = url.indexOf('?'); if (q > -1) { url = url.slice(0, q); } if (url.slice(-3) == ".js") { if (this._trimUrlQuery(aUrl).slice(-3) == ".js") { window.editor.setMode(SourceEditor.MODES.JAVASCRIPT); } else { window.editor.setMode(SourceEditor.MODES.HTML); } }, /** * Trims the query part of a url string, if necessary. * * @param string aUrl * The script url. * @return string */ _trimUrlQuery: function SS_trimUrlQuery(aUrl) { let q = aUrl.indexOf('?'); if (q > -1) { return aUrl.slice(0, q); } return aUrl; }, /** * Gets a unique, simplified label from a script url. * ex: a). ici://some.address.com/random/subrandom/ * b). ni://another.address.org/random/subrandom/page.html * c). san://interesting.address.gro/random/script.js * d). si://interesting.address.moc/random/another/script.js * => * a). subrandom/ * b). page.html * c). script.js * d). another/script.js * * @param string aUrl * The script url. * @param string aHref * The content location href to be used. If unspecified, it will * defalult to debugged panrent window location. * @return string * The simplified label. */ _getScriptLabel: function SS_getScriptLabel(aUrl, aHref) { let url = this._trimUrlQuery(aUrl); if (this._labelsCache[url]) { return this._labelsCache[url]; } let href = aHref || window.parent.content.location.href; let pathElements = url.split("/"); let label = pathElements.pop() || (pathElements.pop() + "/"); // if the label as a leaf name is alreay present in the scripts list if (DebuggerView.Scripts.containsLabel(label)) { label = url.replace(href.substring(0, href.lastIndexOf("/") + 1), ""); // if the path/to/script is exactly the same, we're in different domains if (DebuggerView.Scripts.containsLabel(label)) { label = url; } } return this._labelsCache[url] = label; }, /** * Clears the labels cache, populated by SS_getScriptLabel(). * This should be done every time the content location changes. */ clearLabelsCache: function SS_clearLabelsCache() { this._labelsCache = {}; }, /** * Add the specified script to the list and display it in the editor if the * editor is empty. */ _addScript: function SS_addScript(aScript) { DebuggerView.Scripts.addScript(aScript.url, aScript); DebuggerView.Scripts.addScript(this._getScriptLabel(aScript.url), aScript); if (window.editor.getCharCount() == 0) { this._showScript(aScript); Loading
browser/devtools/debugger/test/browser_dbg_clean-exit.js +1 −3 Original line number Diff line number Diff line Loading @@ -10,9 +10,7 @@ var gTab = null; var gDebuggee = null; var gDebugger = null; const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" + "debugger/test/" + "browser_dbg_debuggerstatement.html"; const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; function test() { debug_tab_pane(DEBUGGER_TAB_URL, function(aTab, aDebuggee, aPane) { Loading
browser/devtools/debugger/test/browser_dbg_debuggerstatement.js +1 −3 Original line number Diff line number Diff line Loading @@ -8,9 +8,7 @@ var gClient = null; var gTab = null; const DEBUGGER_TAB_URL = "http://example.com/browser/browser/devtools/" + "debugger/test/" + "browser_dbg_debuggerstatement.html"; const DEBUGGER_TAB_URL = EXAMPLE_URL + "browser_dbg_debuggerstatement.html"; function test() { Loading