--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -1053,24 +1053,19 @@ pref("devtools.inspector.sidebarOpen", f
pref("devtools.inspector.activeSidebar", "ruleview");
// Enable the Layout View
pref("devtools.layoutview.enabled", false);
pref("devtools.layoutview.open", false);
// Enable the Debugger
pref("devtools.debugger.enabled", false);
-pref("devtools.debugger.remote-enabled", false);
-pref("devtools.debugger.remote-host", "localhost");
-pref("devtools.debugger.remote-port", 6000);
// The default Debugger UI height
pref("devtools.debugger.ui.height", 250);
-pref("devtools.debugger.ui.remote-win.width", 900);
-pref("devtools.debugger.ui.remote-win.height", 400);
// Enable the style inspector
pref("devtools.styleinspector.enabled", true);
// Enable the Tilt inspector
pref("devtools.tilt.enabled", true);
pref("devtools.tilt.intro_transition", true);
pref("devtools.tilt.outro_transition", true);
--- a/browser/base/content/browser-appmenu.inc
+++ b/browser/base/content/browser-appmenu.inc
@@ -189,20 +189,16 @@
type="checkbox"
command="Tools:Inspect"
key="key_inspect"/>
<menuitem id="appmenu_debugger"
hidden="true"
label="&debuggerMenu.label;"
key="key_debugger"
command="Tools:Debugger"/>
- <menuitem id="appmenu_remoteDebugger"
- hidden="true"
- label="&remoteDebuggerMenu.label;"
- command="Tools:RemoteDebugger"/>
<menuitem id="appmenu_scratchpad"
hidden="true"
label="&scratchpad.label;"
key="key_scratchpad"
command="Tools:Scratchpad"/>
<menuitem id="appmenu_styleeditor"
hidden="true"
label="&styleeditor.label;"
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -546,20 +546,16 @@
accesskey="&inspectMenu.accesskey;"
key="key_inspect"
command="Tools:Inspect"/>
<menuitem id="menu_debugger"
hidden="true"
label="&debuggerMenu.label;"
key="key_debugger"
command="Tools:Debugger"/>
- <menuitem id="menu_remoteDebugger"
- hidden="true"
- label="&remoteDebuggerMenu.label;"
- command="Tools:RemoteDebugger"/>
<menuitem id="menu_scratchpad"
hidden="true"
label="&scratchpad.label;"
accesskey="&scratchpad.accesskey;"
key="key_scratchpad"
command="Tools:Scratchpad"/>
<menuitem id="menu_styleeditor"
hidden="true"
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -124,17 +124,16 @@
<command id="cmd_fullZoomToggle" oncommand="ZoomManager.toggleZoom();"/>
<command id="Browser:OpenLocation" oncommand="openLocation();"/>
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
<command id="Tools:WebConsole" oncommand="HUDConsoleUI.toggleHUD();"/>
<command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();" disabled="true"/>
<command id="Tools:Debugger" oncommand="DebuggerUI.toggleDebugger();" disabled="true"/>
- <command id="Tools:RemoteDebugger" oncommand="DebuggerUI.toggleRemoteDebugger();" disabled="true"/>
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true"/>
<command id="Tools:StyleEditor" oncommand="StyleEditor.openChrome();" disabled="true"/>
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
<command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
<command id="History:UndoCloseWindow" oncommand="undoCloseWindow();"/>
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1711,26 +1711,16 @@ function delayedStartup(isLoadingBlank,
if (enabled) {
document.getElementById("menu_debugger").hidden = false;
document.getElementById("Tools:Debugger").removeAttribute("disabled");
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_debugger").hidden = false;
#endif
}
- // Enable Remote Debugger?
- let enabled = gPrefService.getBoolPref("devtools.debugger.remote-enabled");
- if (enabled) {
- document.getElementById("menu_remoteDebugger").hidden = false;
- document.getElementById("Tools:RemoteDebugger").removeAttribute("disabled");
-#ifdef MENUBAR_CAN_AUTOHIDE
- document.getElementById("appmenu_remoteDebugger").hidden = false;
-#endif
- }
-
// Enable Error Console?
// XXX Temporarily always-enabled, see bug 601201
let consoleEnabled = true || gPrefService.getBoolPref("devtools.errorconsole.enabled");
if (consoleEnabled) {
document.getElementById("javascriptConsole").hidden = false;
document.getElementById("key_errorConsole").removeAttribute("disabled");
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_errorConsole").hidden = false;
--- a/browser/devtools/debugger/DebuggerUI.jsm
+++ b/browser/devtools/debugger/DebuggerUI.jsm
@@ -40,23 +40,17 @@
*
* ***** END LICENSE BLOCK ***** */
"use strict";
const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
-const DBG_XUL = "chrome://browser/content/debugger.xul";
-const REMOTE_PROFILE_NAME = "_remote-debug";
-
-Cu.import("resource://gre/modules/devtools/dbg-server.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let EXPORTED_SYMBOLS = ["DebuggerUI"];
/**
* Provides a simple mechanism of managing debugger instances per tab.
*
* @param nsIDOMWindow aWindow
* The chrome window for which the DebuggerUI instance is created.
@@ -77,85 +71,59 @@ DebuggerUI.prototype = {
if (tab._scriptDebugger) {
tab._scriptDebugger.close();
return null;
}
return new DebuggerPane(tab);
},
/**
- * Starts a remote debugger in a new process, or stops it if already started.
- * @see DebuggerProcess.constructor
- * @return DebuggerProcess if the debugger is started, null if it's stopped.
- */
- toggleRemoteDebugger: function DUI_toggleRemoteDebugger(aOnClose, aOnRun) {
- let win = this.chromeWindow;
-
- if (win._remoteDebugger) {
- win._remoteDebugger.close();
- return null;
- }
- return new DebuggerProcess(win, aOnClose, aOnRun);
- },
-
- /**
* Get the debugger for a specified tab.
* @return DebuggerPane if a debugger exists for the tab, null otherwise
*/
getDebugger: function DUI_getDebugger(aTab) {
return aTab._scriptDebugger;
},
/**
* Get the preferences associated with the debugger frontend.
* @return object
*/
get preferences() {
- return DebuggerPreferences;
+ return DebuggerUIPreferences;
}
};
/**
* Creates a pane that will host the debugger.
*
* @param XULElement aTab
* The tab in which to create the debugger.
*/
function DebuggerPane(aTab) {
this._tab = aTab;
- this._initServer();
this._create();
}
DebuggerPane.prototype = {
/**
- * Initializes the debugger server.
- */
- _initServer: function DP__initServer() {
- if (!DebuggerServer.initialized) {
- DebuggerServer.init();
- DebuggerServer.addBrowserActors();
- }
- },
-
- /**
* Creates and initializes the widgets containing the debugger UI.
*/
_create: function DP__create() {
this._tab._scriptDebugger = this;
let gBrowser = this._tab.linkedBrowser.getTabBrowser();
let ownerDocument = gBrowser.parentNode.ownerDocument;
this._splitter = ownerDocument.createElement("splitter");
this._splitter.setAttribute("class", "hud-splitter");
this._frame = ownerDocument.createElement("iframe");
- this._frame.height = DebuggerPreferences.height;
+ this._frame.height = DebuggerUIPreferences.height;
this._nbox = gBrowser.getNotificationBox(this._tab.linkedBrowser);
this._nbox.appendChild(this._splitter);
this._nbox.appendChild(this._frame);
this.close = this.close.bind(this);
let self = this;
@@ -166,30 +134,30 @@ DebuggerPane.prototype = {
// Bind shortcuts for accessing the breakpoint methods in the debugger.
let bkp = self.debuggerWindow.DebuggerController.Breakpoints;
self.addBreakpoint = bkp.addBreakpoint;
self.removeBreakpoint = bkp.removeBreakpoint;
self.getBreakpoint = bkp.getBreakpoint;
}, true);
- this._frame.setAttribute("src", DBG_XUL);
+ this._frame.setAttribute("src", "chrome://browser/content/debugger.xul");
},
/**
* Closes the debugger, removing child nodes and event listeners.
*/
close: function DP_close() {
if (!this._tab) {
return;
}
- delete this._tab._scriptDebugger;
+ this._tab._scriptDebugger = null;
this._tab = null;
- DebuggerPreferences.height = this._frame.height;
+ DebuggerUIPreferences.height = this._frame.height;
this._frame.removeEventListener("Debugger:Close", this.close, true);
this._frame.removeEventListener("unload", this.close, true);
this._nbox.removeChild(this._splitter);
this._nbox.removeChild(this._frame);
this._splitter = null;
this._frame = null;
@@ -213,123 +181,19 @@ DebuggerPane.prototype = {
if (debuggerWindow) {
return debuggerWindow.DebuggerController.Breakpoints.store;
}
return null;
}
};
/**
- * Creates a process that will hold the remote debugger.
- *
- * @param function aOnClose
- * Optional, a function called when the process exits.
- * @param function aOnRun
- * Optional, a function called when the process starts running.
- * @param nsIDOMWindow aWindow
- * The chrome window for which the remote debugger instance is created.
+ * Various debugger UI preferences (currently just the pane height).
*/
-function DebuggerProcess(aWindow, aOnClose, aOnRun) {
- this._win = aWindow;
- this._closeCallback = aOnClose;
- this._runCallback = aOnRun;
- this._initServer();
- this._initProfile();
- this._create();
-}
-
-DebuggerProcess.prototype = {
-
- /**
- * Initializes the debugger server.
- */
- _initServer: function RDP__initServer() {
- if (!DebuggerServer.initialized) {
- DebuggerServer.init();
- DebuggerServer.addBrowserActors();
- }
- DebuggerServer.closeListener();
- DebuggerServer.openListener(DebuggerPreferences.remotePort, false);
- },
-
- /**
- * Initializes a profile for the remote debugger process.
- */
- _initProfile: function RDP__initProfile() {
- let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
- .createInstance(Ci.nsIToolkitProfileService);
-
- let dbgProfileName;
- try {
- dbgProfileName = profileService.selectedProfile.name + REMOTE_PROFILE_NAME;
- } catch(e) {
- dbgProfileName = REMOTE_PROFILE_NAME;
- Cu.reportError(e);
- }
-
- this._dbgProfile = profileService.createProfile(null, null, dbgProfileName);
- profileService.flush();
- },
-
- /**
- * Creates and initializes the profile & process for the remote debugger.
- */
- _create: function RDP__create() {
- this._win._remoteDebugger = this;
-
- let file = FileUtils.getFile("CurProcD",
- [Services.appinfo.OS == "WINNT" ? "firefox.exe"
- : "firefox-bin"]);
-
- let process = Cc["@mozilla.org/process/util;1"].createInstance(Ci.nsIProcess);
- process.init(file);
-
- let args = [
- "-no-remote", "-P", this._dbgProfile.name,
- "-chrome", DBG_XUL,
- "-width", DebuggerPreferences.remoteWinWidth,
- "-height", DebuggerPreferences.remoteWinHeight];
-
- process.runwAsync(args, args.length, { observe: this.close.bind(this) });
- this._dbgProcess = process;
-
- if (typeof this._runCallback === "function") {
- this._runCallback.call({}, this);
- }
- },
-
- /**
- * Closes the remote debugger, removing the profile and killing the process.
- */
- close: function RDP_close() {
- if (!this._win) {
- return;
- }
- delete this._win._remoteDebugger;
- this._win = null;
-
- if (this._dbgProcess.isRunning) {
- this._dbgProcess.kill();
- }
- if (this._dbgProfile) {
- this._dbgProfile.remove(false);
- }
- if (typeof this._closeCallback === "function") {
- this._closeCallback.call({}, this);
- }
-
- this._dbgProcess = null;
- this._dbgProfile = null;
- }
-};
-
-/**
- * Various debugger preferences.
- */
-let DebuggerPreferences = {
+let DebuggerUIPreferences = {
/**
* Gets the preferred height of the debugger pane.
* @return number
*/
get height() {
if (this._height === undefined) {
this._height = Services.prefs.getIntPref("devtools.debugger.ui.height");
@@ -341,40 +205,8 @@ let DebuggerPreferences = {
* Sets the preferred height of the debugger pane.
* @param number value
*/
set height(value) {
Services.prefs.setIntPref("devtools.debugger.ui.height", value);
this._height = value;
}
};
-
-/**
- * Gets the preferred width of the remote debugger window.
- * @return number
- */
-XPCOMUtils.defineLazyGetter(DebuggerPreferences, "remoteWinWidth", function() {
- return Services.prefs.getIntPref("devtools.debugger.ui.remote-win.width");
-});
-
-/**
- * Gets the preferred height of the remote debugger window.
- * @return number
- */
-XPCOMUtils.defineLazyGetter(DebuggerPreferences, "remoteWinHeight", function() {
- return Services.prefs.getIntPref("devtools.debugger.ui.remote-win.height");
-});
-
-/**
- * Gets the preferred default remote debugging host.
- * @return string
- */
-XPCOMUtils.defineLazyGetter(DebuggerPreferences, "remoteHost", function() {
- return Services.prefs.getCharPref("devtools.debugger.remote-host");
-});
-
-/**
- * Gets the preferred default remote debugging port.
- * @return number
- */
-XPCOMUtils.defineLazyGetter(DebuggerPreferences, "remotePort", function() {
- return Services.prefs.getIntPref("devtools.debugger.remote-port");
-});
--- a/browser/devtools/debugger/debugger-controller.js
+++ b/browser/devtools/debugger/debugger-controller.js
@@ -109,28 +109,29 @@ let DebuggerController = {
DebuggerView.Properties.destroy();
DebuggerController.SourceScripts.disconnect();
DebuggerController.StackFrames.disconnect();
DebuggerController.ThreadState.disconnect();
this.dispatchEvent("Debugger:Unloaded");
this._disconnect();
- this._isRemote && this._quitApp();
},
/**
* Initializes a debugger client and connects it to the debugger server,
* wiring event handlers as necessary.
*/
_connect: function DC__connect() {
- let transport =
- this._isRemote ? debuggerSocketConnect(Prefs.remoteHost, Prefs.remotePort)
- : DebuggerServer.connectPipe();
+ if (!DebuggerServer.initialized) {
+ DebuggerServer.init();
+ DebuggerServer.addBrowserActors();
+ }
+ let transport = DebuggerServer.connectPipe();
let client = this.client = new DebuggerClient(transport);
client.addListener("tabNavigated", this._onTabNavigated);
client.addListener("tabDetached", this._onTabDetached);
client.connect(function(aType, aTraits) {
client.listTabs(function(aResponse) {
let tab = aResponse.tabs[aResponse.selected];
@@ -215,41 +216,16 @@ let DebuggerController = {
});
});
}.bind(this));
}.bind(this));
},
/**
- * Returns true if this is a remote debugger instance.
- * @return boolean
- */
- get _isRemote() {
- return !window.parent.content;
- },
-
- /**
- * Attempts to quit the current process if allowed.
- */
- _quitApp: function DC__quitApp() {
- let canceled = Cc["@mozilla.org/supports-PRBool;1"]
- .createInstance(Ci.nsISupportsPRBool);
-
- Services.obs.notifyObservers(canceled, "quit-application-requested", null);
-
- // Somebody canceled our quit request.
- if (canceled.data) {
- return;
- }
-
- Services.startup.quit(Ci.nsIAppStartup.eAttemptQuit);
- },
-
- /**
* Convenience method, dispatching a custom event.
*
* @param string aType
* The name of the event.
* @param string aDetail
* The data passed when initializing the event.
*/
dispatchEvent: function DC_dispatchEvent(aType, aDetail) {
@@ -705,27 +681,26 @@ SourceScripts.prototype = {
this.activeThread.removeListener("scriptsadded", this._onScriptsAdded);
this.activeThread.removeListener("scriptscleared", this._onScriptsCleared);
},
/**
* Handler for the debugger client's unsolicited newScript notification.
*/
_onNewScript: function SS__onNewScript(aNotification, aPacket) {
- this._addScript({ url: aPacket.url, startLine: aPacket.startLine }, true);
+ this._addScript({ url: aPacket.url, startLine: aPacket.startLine });
},
/**
* Handler for the thread client's scriptsadded notification.
*/
_onScriptsAdded: function SS__onScriptsAdded() {
for each (let script in this.activeThread.cachedScripts) {
- this._addScript(script, false);
+ this._addScript(script);
}
- DebuggerView.Scripts.commitScripts();
},
/**
* Handler for the thread client's scriptscleared notification.
*/
_onScriptsCleared: function SS__onScriptsCleared() {
DebuggerView.Scripts.empty();
},
@@ -768,70 +743,51 @@ SourceScripts.prototype = {
let q = aUrl.indexOf('?');
if (q > -1) {
return aUrl.slice(0, q);
}
return aUrl;
},
/**
- * Gets the prePath for a script URL.
- *
- * @param string aUrl
- * The script url.
- * @return string
- * The script prePath if the url is valid, null otherwise.
- */
- _getScriptPrePath: function SS__getScriptDomain(aUrl) {
- try {
- return Services.io.newURI(aUrl, null, null).prePath + "/";
- } catch (e) {
- }
- return null;
- },
-
- /**
* 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
- * default to the script url prepath.
+ * 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 content = window.parent.content;
- let domain = content ? content.location.href : this._getScriptPrePath(aUrl);
-
- let href = aHref || domain;
+ 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 already present in the scripts list.
+ // 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 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;
},
@@ -839,26 +795,25 @@ SourceScripts.prototype = {
* 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.
- *
- * @param object aScript
- * The script object coming from the active thread.
- * @param boolean aForceFlag
- * True to force the script to be immediately added.
+ * Add the specified script to the list and display it in the editor if the
+ * editor is empty.
*/
- _addScript: function SS__addScript(aScript, aForceFlag) {
- DebuggerView.Scripts.addScript(
- this._getScriptLabel(aScript.url), aScript, aForceFlag);
+ _addScript: function SS__addScript(aScript) {
+ DebuggerView.Scripts.addScript(this._getScriptLabel(aScript.url), aScript);
+
+ if (DebuggerView.editor.getCharCount() == 0) {
+ this.showScript(aScript);
+ }
},
/**
* Load the editor with the script text if available, otherwise fire an event
* to load and display the script text.
*
* @param object aScript
* The script object coming from the active thread.
@@ -916,17 +871,17 @@ SourceScripts.prototype = {
url: aScript.url
});
},
/**
* Handles notifications to load a source script from the cache or from a
* local file.
*
- * XXX: It may be better to use nsITraceableChannel to get to the sources
+ * XXX: Tt may be better to use nsITraceableChannel to get to the sources
* without relying on caching when we can (not for eval, etc.):
* http://www.softwareishard.com/blog/firebug/nsitraceablechannel-intercept-http-traffic/
*/
_onLoadSource: function SS__onLoadSource(aEvent) {
let url = aEvent.detail.url;
let options = aEvent.detail.options;
let self = this;
@@ -1007,17 +962,17 @@ SourceScripts.prototype = {
* Log an error message in the error console when a script fails to load.
*
* @param string aUrl
* The URL of the source script.
* @param string aStatus
* The failure status code.
*/
_logError: function SS__logError(aUrl, aStatus) {
- Cu.reportError(L10N.getFormatStr("loadingError", [aUrl, aStatus]));
+ Components.utils.reportError(L10N.getFormatStr("loadingError", [aUrl, aStatus]));
},
};
/**
* Handles all the breakpoints in the current debugger.
*/
function Breakpoints() {
this._onEditorBreakpointChange = this._onEditorBreakpointChange.bind(this);
@@ -1299,37 +1254,16 @@ let L10N = {
}
};
XPCOMUtils.defineLazyGetter(L10N, "stringBundle", function() {
return Services.strings.createBundle(DBG_STRINGS_URI);
});
/**
- * Shortcuts for accessing various debugger preferences.
- */
-let Prefs = {};
-
-/**
- * Gets the preferred default remote debugging host.
- * @return string
- */
-XPCOMUtils.defineLazyGetter(Prefs, "remoteHost", function() {
- return Services.prefs.getCharPref("devtools.debugger.remote-host");
-});
-
-/**
- * Gets the preferred default remote debugging port.
- * @return number
- */
-XPCOMUtils.defineLazyGetter(Prefs, "remotePort", function() {
- return Services.prefs.getIntPref("devtools.debugger.remote-port");
-});
-
-/**
* Preliminary setup for the DebuggerController object.
*/
DebuggerController.init();
DebuggerController.ThreadState = new ThreadState();
DebuggerController.StackFrames = new StackFrames();
DebuggerController.SourceScripts = new SourceScripts();
DebuggerController.Breakpoints = new Breakpoints();
--- a/browser/devtools/debugger/debugger-view.js
+++ b/browser/devtools/debugger/debugger-view.js
@@ -85,72 +85,53 @@ let DebuggerView = {
}
};
/**
* Functions handling the scripts UI.
*/
function ScriptsView() {
this._onScriptsChange = this._onScriptsChange.bind(this);
- this._onScriptsSearch = this._onScriptsSearch.bind(this);
}
ScriptsView.prototype = {
/**
* Removes all elements from the scripts container, leaving it empty.
*/
empty: function DVS_empty() {
while (this._scripts.firstChild) {
this._scripts.removeChild(this._scripts.firstChild);
}
},
/**
- * Removes the input in the searchbox and unhides all the scripts.
- */
- clearSearch: function DVS_clearSearch() {
- this._searchbox.value = "";
- this._onScriptsSearch({});
- },
-
- /**
* Checks whether the script with the specified URL is among the scripts
* known to the debugger and shown in the list.
*
* @param string aUrl
* The script URL.
* @return boolean
*/
contains: function DVS_contains(aUrl) {
- if (this._tmpScripts.some(function(element) {
- return element.script.url == aUrl;
- })) {
- return true;
- }
if (this._scripts.getElementsByAttribute("value", aUrl).length > 0) {
return true;
}
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._tmpScripts.some(function(element) {
- return element.label == aLabel;
- })) {
- return true;
- }
if (this._scripts.getElementsByAttribute("label", aLabel).length > 0) {
return true;
}
return false;
},
/**
* Selects the script with the specified URL from the list.
@@ -186,258 +167,80 @@ ScriptsView.prototype = {
* @return string | null
*/
get selected() {
return this._scripts.selectedItem ?
this._scripts.selectedItem.value : null;
},
/**
- * Returns the list of labels in the scripts container.
- * @return array
- */
- get scriptLabels() {
- let labels = [];
- for (let i = 0, l = this._scripts.itemCount; i < l; i++) {
- labels.push(this._scripts.getItemAtIndex(i).label);
- }
- return labels;
- },
-
- /**
* Returns the list of URIs for scripts in the page.
* @return array
*/
get scriptLocations() {
let locations = [];
for (let i = 0, l = this._scripts.itemCount; i < l; i++) {
locations.push(this._scripts.getItemAtIndex(i).value);
}
return locations;
},
/**
- * Gets the number of visible (hidden=false) scripts in the container.
- * @return number
- */
- get visibleItemsCount() {
- let count = 0;
- for (let i = 0, l = this._scripts.itemCount; i < l; i++) {
- count += this._scripts.getItemAtIndex(i).hidden ? 0 : 1;
- }
- return count;
- },
-
- /**
- * Prepares a script to be added to the scripts container. This allows
- * for a large number of scripts to be batched up before being
- * alphabetically sorted and added in the container.
- * @see ScriptsView.commitScripts
- *
- * If aForceFlag is true, the script will be immediately inserted at the
- * necessary position in the container so that all the scripts remain sorted.
- * This can be much slower than batching up multiple scripts.
- *
- * @param string aLabel
- * The simplified script location to be shown.
- * @param string aScript
- * The source script.
- * @param boolean aForceFlag
- * True to force the script to be immediately added.
- */
- addScript: function DVS_addScript(aLabel, aScript, aForceFlag) {
- // Batch the script to be added later.
- if (!aForceFlag) {
- this._tmpScripts.push({ label: aLabel, script: aScript });
- return;
- }
-
- // Find the target position in the menulist and insert the script there.
- for (let i = 0, l = this._scripts.itemCount; i < l; i++) {
- if (this._scripts.getItemAtIndex(i).label > aLabel) {
- this._createScriptElement(aLabel, aScript, i);
- return;
- }
- }
- // The script is alphabetically the last one.
- this._createScriptElement(aLabel, aScript, -1, true);
- },
-
- /**
- * Adds all the prepared scripts to the scripts container.
- * If a script already exists (was previously added), nothing happens.
- */
- commitScripts: function DVS_commitScripts() {
- let newScripts = this._tmpScripts;
- this._tmpScripts = [];
-
- if (!newScripts || !newScripts.length) {
- return;
- }
- newScripts.sort(function(a, b) {
- return a.label.toLowerCase() > b.label.toLowerCase();
- });
-
- for (let i = 0, l = newScripts.length; i < l; i++) {
- let item = newScripts[i];
- this._createScriptElement(item.label, item.script, -1, true);
- }
- },
-
- /**
- * Creates a custom script element and adds it to the scripts container.
- * If the script with the specified label already exists, nothing happens.
+ * Adds a script to the scripts container.
+ * If the script already exists (was previously added), null is returned.
+ * Otherwise, the newly created element is returned.
*
* @param string aLabel
* The simplified script location to be shown.
* @param string aScript
* The source script.
- * @param number aIndex
- * The index where to insert to new script in the container.
- * Pass -1 to append the script at the end.
- * @param boolean aSelectIfEmptyFlag
- * True to set the newly created script as the currently selected item
- * if there are no other existing scripts in the container.
+ * @return object
+ * The newly created html node representing the added script.
*/
- _createScriptElement: function DVS__createScriptElement(
- aLabel, aScript, aIndex, aSelectIfEmptyFlag)
- {
+ addScript: function DVS_addScript(aLabel, aScript) {
// Make sure we don't duplicate anything.
- if (aLabel == "null" || this.containsLabel(aLabel)) {
- return;
+ if (this.containsLabel(aLabel)) {
+ return null;
}
- let scriptItem =
- aIndex == -1 ? this._scripts.appendItem(aLabel, aScript.url)
- : this._scripts.insertItemAt(aIndex, aLabel, aScript.url);
+ let script = this._scripts.appendItem(aLabel, aScript.url);
+ script.setAttribute("tooltiptext", aScript.url);
+ script.setUserData("sourceScript", aScript, null);
- scriptItem.setAttribute("tooltiptext", aScript.url);
- scriptItem.setUserData("sourceScript", aScript, null);
-
- if (this._scripts.itemCount == 1 && aSelectIfEmptyFlag) {
- this._scripts.selectedItem = scriptItem;
- }
+ this._scripts.selectedItem = script;
+ return script;
},
/**
- * The click listener for the scripts container.
+ * The cached click listener for the scripts container.
*/
_onScriptsChange: function DVS__onScriptsChange() {
let script = this._scripts.selectedItem.getUserData("sourceScript");
- this._preferredScript = script;
DebuggerController.SourceScripts.showScript(script);
},
/**
- * The search listener for the scripts search box.
- */
- _onScriptsSearch: function DVS__onScriptsSearch(e) {
- let editor = DebuggerView.editor;
- let scripts = this._scripts;
- let rawValue = this._searchbox.value.toLowerCase();
-
- let rawLength = rawValue.length;
- let lastColon = rawValue.lastIndexOf(":");
- let lastAt = rawValue.lastIndexOf("@");
-
- let fileEnd = lastColon != -1 ? lastColon : lastAt != -1 ? lastAt : rawLength;
- let lineEnd = lastAt != -1 ? lastAt : rawLength;
-
- let file = rawValue.slice(0, fileEnd);
- let line = window.parseInt(rawValue.slice(fileEnd + 1, lineEnd)) || -1;
- let token = rawValue.slice(lineEnd + 1);
-
- // Presume we won't find anything.
- scripts.selectedItem = this._preferredScript;
-
- // If we're not searching for a file anymore, unhide all the scripts.
- if (!file) {
- for (let i = 0, l = scripts.itemCount; i < l; i++) {
- scripts.getItemAtIndex(i).hidden = false;
- }
- } else {
- for (let i = 0, l = scripts.itemCount, found = false; i < l; i++) {
- let item = scripts.getItemAtIndex(i);
- let target = item.value.toLowerCase();
-
- // Search is not case sensitive, and is tied to the url not the label.
- if (target.match(file)) {
- item.hidden = false;
-
- if (!found) {
- found = true;
- scripts.selectedItem = item;
- }
- }
- // Hide what doesn't match our search.
- else {
- item.hidden = true;
- }
- }
- }
- if (line > -1) {
- editor.setCaretPosition(line - 1);
- }
- if (token) {
- let offset = editor.find(token, { ignoreCase: true });
- if (offset > -1) {
- editor.setCaretPosition(0);
- editor.setCaretOffset(offset);
- }
- }
- },
-
- /**
- * The keyup listener for the scripts search box.
- */
- _onScriptsKeyUp: function DVS__onScriptsKeyUp(e) {
- if (e.keyCode === e.DOM_VK_ESCAPE) {
- DebuggerView.editor.focus();
- return;
- }
-
- if (e.keyCode === e.DOM_VK_RETURN || e.keyCode === e.DOM_VK_ENTER) {
- let editor = DebuggerView.editor;
- let offset = editor.findNext(true);
- if (offset > -1) {
- editor.setCaretPosition(0);
- editor.setCaretOffset(offset);
- }
- }
- },
-
- /**
- * The cached scripts container and search box.
+ * The cached scripts container.
*/
_scripts: null,
- _searchbox: null,
/**
* Initialization function, called when the debugger is initialized.
*/
initialize: function DVS_initialize() {
this._scripts = document.getElementById("scripts");
- this._searchbox = document.getElementById("scripts-search");
this._scripts.addEventListener("select", this._onScriptsChange, false);
- this._searchbox.addEventListener("select", this._onScriptsSearch, false);
- this._searchbox.addEventListener("input", this._onScriptsSearch, false);
- this._searchbox.addEventListener("keyup", this._onScriptsKeyUp, false);
- this.commitScripts();
},
/**
* Destruction function, called when the debugger is shut down.
*/
destroy: function DVS_destroy() {
this._scripts.removeEventListener("select", this._onScriptsChange, false);
- this._searchbox.removeEventListener("select", this._onScriptsSearch, false);
- this._searchbox.removeEventListener("input", this._onScriptsSearch, false);
- this._searchbox.removeEventListener("keyup", this._onScriptsKeyUp, false);
this._scripts = null;
- this._searchbox = null;
}
};
/**
* Functions handling the html stackframes UI.
*/
function StackFramesView() {
this._onFramesScroll = this._onFramesScroll.bind(this);
@@ -469,18 +272,16 @@ StackFramesView.prototype = {
else if (aState == "attached") {
status.textContent = L10N.getStr("runningState");
resume.label = L10N.getStr("pauseLabel");
}
// No valid state parameter.
else {
status.textContent = "";
}
-
- DebuggerView.Scripts.clearSearch();
},
/**
* Removes all elements from the stackframes container, leaving it empty.
*/
empty: function DVF_empty() {
while (this._frames.firstChild) {
this._frames.removeChild(this._frames.firstChild);
@@ -575,17 +376,17 @@ StackFramesView.prototype = {
/**
* Deselects a frame from the stackframe container.
*
* @param number aDepth
* The frame depth specified by the debugger.
*/
unhighlightFrame: function DVF_unhighlightFrame(aDepth) {
- this.highlightFrame(aDepth, true);
+ this.highlightFrame(aDepth, true)
},
/**
* Gets the current dirty state.
*
* @return boolean value
* True if should load more frames.
*/
--- a/browser/devtools/debugger/debugger.xul
+++ b/browser/devtools/debugger/debugger.xul
@@ -76,18 +76,16 @@
<div id="body" class="vbox flex">
<xul:toolbar id="dbg-toolbar">
<xul:button id="close">&debuggerUI.closeButton;</xul:button>
<xul:button id="resume"/>
<xul:button id="step-over">&debuggerUI.stepOverButton;</xul:button>
<xul:button id="step-in">&debuggerUI.stepInButton;</xul:button>
<xul:button id="step-out">&debuggerUI.stepOutButton;</xul:button>
<xul:menulist id="scripts"/>
- <xul:textbox id="scripts-search" type="search"
- emptytext="&debuggerUI.emptyFilterText;"/>
</xul:toolbar>
<div id="dbg-content" class="hbox flex">
<div id="stack" class="vbox">
<div class="title unselectable">&debuggerUI.stackTitle;</div>
<div id="stackframes" class="vbox flex"></div>
</div>
<div id="script" class="vbox flex">
<div class="title unselectable">&debuggerUI.scriptTitle;</div>
--- a/browser/devtools/debugger/test/Makefile.in
+++ b/browser/devtools/debugger/test/Makefile.in
@@ -41,17 +41,16 @@ topsrcdir = @top_srcdir@
srcdir = @srcdir@
VPATH = @srcdir@
relativesrcdir = browser/devtools/debugger/test
include $(DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/rules.mk
_BROWSER_TEST_FILES = \
- browser_dbg_createRemote.js \
browser_dbg_debuggerstatement.js \
browser_dbg_listtabs.js \
browser_dbg_tabactor-01.js \
browser_dbg_tabactor-02.js \
browser_dbg_contextactor-01.js \
browser_dbg_contextactor-02.js \
testactors.js \
browser_dbg_nav-01.js \
@@ -66,19 +65,16 @@ include $(topsrcdir)/config/rules.mk
browser_dbg_panesize.js \
browser_dbg_stack-01.js \
browser_dbg_stack-02.js \
browser_dbg_stack-03.js \
browser_dbg_stack-04.js \
browser_dbg_stack-05.js \
browser_dbg_location-changes.js \
browser_dbg_script-switching.js \
- browser_dbg_scripts-sorting.js \
- browser_dbg_scripts-searching-01.js \
- browser_dbg_scripts-searching-02.js \
browser_dbg_pause-resume.js \
browser_dbg_update-editor-mode.js \
$(warning browser_dbg_select-line.js temporarily disabled due to oranges, see bug 726609) \
browser_dbg_clean-exit.js \
browser_dbg_bug723069_editor-breakpoints.js \
browser_dbg_bug731394_editor-contextmenu.js \
browser_dbg_displayName.js \
browser_dbg_iframes.js \
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_createRemote.js
+++ /dev/null
@@ -1,86 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gProcess = null;
-var gTab = null;
-var gDebuggee = null;
-
-function test() {
- remote_debug_tab_pane(STACK_URL, aOnClosing, function(aTab, aDebuggee, aProcess) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gProcess = aProcess;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- Services.tm.currentThread.dispatch({ run: function() {
-
- ok(gProcess._dbgProcess,
- "The remote debugger process wasn't created properly!");
- ok(gProcess._dbgProcess.isRunning,
- "The remote debugger process isn't running!");
- is(typeof gProcess._dbgProcess.pid, "number",
- "The remote debugger process doesn't have a pid (?!)");
-
- info("process location: " + gProcess._dbgProcess.location);
- info("process pid: " + gProcess._dbgProcess.pid);
- info("process name: " + gProcess._dbgProcess.processName);
- info("process sig: " + gProcess._dbgProcess.processSignature);
-
- ok(gProcess._dbgProfile,
- "The remote debugger profile wasn't created properly!");
- ok(gProcess._dbgProfile.localDir,
- "The remote debugger profile doesn't have a localDir...");
- ok(gProcess._dbgProfile.rootDir,
- "The remote debugger profile doesn't have a rootDir...");
- ok(gProcess._dbgProfile.name,
- "The remote debugger profile doesn't have a name...");
-
- info("profile localDir: " + gProcess._dbgProfile.localDir);
- info("profile rootDir: " + gProcess._dbgProfile.rootDir);
- info("profile name: " + gProcess._dbgProfile.name);
-
- let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
- .createInstance(Ci.nsIToolkitProfileService);
-
- let profile = profileService.getProfileByName(gProcess._dbgProfile.name);
-
- ok(profile,
- "The remote debugger profile wasn't *actually* created properly!");
- is(profile.localDir.path, gProcess._dbgProfile.localDir.path,
- "The remote debugger profile doesn't have the correct localDir!");
- is(profile.rootDir.path, gProcess._dbgProfile.rootDir.path,
- "The remote debugger profile doesn't have the correct rootDir!");
-
- DebuggerUI.toggleRemoteDebugger();
- }}, 0);
-}
-
-function aOnClosing() {
- ok(!gProcess._dbgProcess.isRunning,
- "The remote debugger process isn't closed as it should be!");
- is(gProcess._dbgProcess.exitValue, (Services.appinfo.OS == "WINNT" ? 0 : 256),
- "The remote debugger process didn't die cleanly.");
-
- info("process exit value: " + gProcess._dbgProcess.exitValue);
-
- info("profile localDir: " + gProcess._dbgProfile.localDir.path);
- info("profile rootDir: " + gProcess._dbgProfile.rootDir.path);
- info("profile name: " + gProcess._dbgProfile.name);
-
- executeSoon(function() {
- finish();
- });
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gProcess = null;
- gTab = null;
- gDebuggee = null;
-});
--- a/browser/devtools/debugger/test/browser_dbg_propertyview-01.js
+++ b/browser/devtools/debugger/test/browser_dbg_propertyview-01.js
@@ -80,38 +80,38 @@ function testSimpleCall() {
gDebuggee.simpleCall();
}
function resumeAndFinish() {
gDebugger.DebuggerController.activeThread.resume(function() {
let vs = gDebugger.DebuggerView.Scripts;
let ss = gDebugger.DebuggerController.SourceScripts;
- vs.empty();
- vs._scripts.removeEventListener("select", vs._onScriptsChange, false);
+ ss._onScriptsCleared();
is(ss._trimUrlQuery("a/b/c.d?test=1&random=4"), "a/b/c.d",
"Trimming the url query isn't done properly.");
let urls = [
{ href: "ici://some.address.com/random/", leaf: "subrandom/" },
{ href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
{ href: "san://interesting.address.gro/random/", leaf: "script.js" },
{ href: "si://interesting.address.moc/random/", leaf: "script.js" },
{ href: "si://interesting.address.moc/random/", leaf: "x/script.js" },
{ href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
{ href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" },
{ href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }
];
+ vs._scripts.removeEventListener("select", vs._onScriptsChange, false);
+
urls.forEach(function(url) {
executeSoon(function() {
let loc = url.href + url.leaf;
vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc });
- vs.commitScripts();
});
});
executeSoon(function() {
for (let i = 0; i < vs._scripts.itemCount; i++) {
let lab = vs._scripts.getItemAtIndex(i).getAttribute("label");
let loc = urls[i].href + urls[i].leaf;
--- a/browser/devtools/debugger/test/browser_dbg_script-switching.js
+++ b/browser/devtools/debugger/test/browser_dbg_script-switching.js
@@ -3,16 +3,20 @@
http://creativecommons.org/publicdomain/zero/1.0/ */
/**
* Make sure that switching the displayed script in the UI works as advertised.
*/
const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
+let tempScope = {};
+Cu.import("resource:///modules/source-editor.jsm", tempScope);
+let SourceEditor = tempScope.SourceEditor;
+
var gPane = null;
var gTab = null;
var gDebuggee = null;
var gDebugger = null;
var gScripts = null;
function test()
{
@@ -118,18 +122,16 @@ function testSwitchPaused()
gDebugger.DebuggerView.Scripts.selectScript(EXAMPLE_URL +
"test-script-switching-02.js");
});
}
function testSwitchRunning()
{
- dump("Debugger editor text:\n" + gDebugger.editor.getText() + "\n");
-
ok(gDebugger.editor.getText().search(/debugger/) != -1,
"The second script is displayed again.");
ok(gDebugger.editor.getText().search(/firstCall/) == -1,
"The first script is no longer displayed.");
is(gDebugger.editor.getDebugLocation(), -1,
"editor debugger location is still -1.");
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-01.js
+++ /dev/null
@@ -1,188 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gScripts = null;
-var gSearchBox = null;
-var gMenulist = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.debuggerWindow;
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.simpleCall();
- });
-
- window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
- window.removeEventListener(aEvent.type, _onEvent);
- scriptShown = true;
- runTest();
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gScripts = gDebugger.DebuggerView.Scripts;
- gSearchBox = gScripts._searchbox;
- gMenulist = gScripts._scripts;
-
- write(":12");
- ok(gEditor.getCaretPosition().line == 11 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line.");
-
- write("@debugger");
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44,
- "The editor didn't jump to the correct token. (1)");
-
- EventUtils.sendKey("RETURN");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (2)");
-
- EventUtils.sendKey("ENTER");
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 8,
- "The editor didn't jump to the correct token. (3)");
-
- EventUtils.sendKey("ENTER");
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4,
- "The editor didn't jump to the correct token. (4)");
-
- EventUtils.sendKey("RETURN");
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44,
- "The editor didn't jump to the correct token. (5)");
-
-
- write(":bogus@debugger;");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (7)");
-
- write(":13@debugger;");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (7)");
-
- write(":@debugger;");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (8)");
-
- write("::@debugger;");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (9)");
-
- write(":::@debugger;");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (10)");
-
-
- write(":i am not a number");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't remain at the correct token. (11)");
-
- write("@__i do not exist__");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't remain at the correct token. (12)");
-
-
- write(":1:2:3:a:b:c:::12");
- ok(gEditor.getCaretPosition().line == 11 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line. (13)");
-
- write("@don't@find@me@instead@find@debugger");
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44,
- "The editor didn't jump to the correct token. (14)");
-
- EventUtils.sendKey("RETURN");
- ok(gEditor.getCaretPosition().line == 8 &&
- gEditor.getCaretPosition().col == 2,
- "The editor didn't jump to the correct token. (15)");
-
- EventUtils.sendKey("ENTER");
- ok(gEditor.getCaretPosition().line == 12 &&
- gEditor.getCaretPosition().col == 8,
- "The editor didn't jump to the correct token. (16)");
-
- EventUtils.sendKey("RETURN");
- ok(gEditor.getCaretPosition().line == 19 &&
- gEditor.getCaretPosition().col == 4,
- "The editor didn't jump to the correct token. (17)");
-
- EventUtils.sendKey("ENTER");
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44,
- "The editor didn't jump to the correct token. (18)");
-
-
- clear();
- ok(gEditor.getCaretPosition().line == 2 &&
- gEditor.getCaretPosition().col == 44,
- "The editor didn't remain at the correct token. (19)");
- is(gScripts.visibleItemsCount, 1,
- "Not all the scripts are shown after the search. (20)");
-
- closeDebuggerAndFinish(gTab);
- });
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i]);
- }
- dump("editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gScripts = null;
- gSearchBox = null;
- gMenulist = null;
-});
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_scripts-searching-02.js
+++ /dev/null
@@ -1,146 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const TAB_URL = EXAMPLE_URL + "browser_dbg_script-switching.html";
-
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-var gEditor = null;
-var gScripts = null;
-var gSearchBox = null;
-var gMenulist = null;
-
-function test()
-{
- let scriptShown = false;
- let framesAdded = false;
-
- debug_tab_pane(TAB_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.debuggerWindow;
-
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- framesAdded = true;
- runTest();
- });
-
- gDebuggee.firstCall();
- });
-
- window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- scriptShown = true;
- window.removeEventListener(aEvent.type, _onEvent);
- runTest();
- }
- });
-
- function runTest()
- {
- if (scriptShown && framesAdded) {
- Services.tm.currentThread.dispatch({ run: testScriptSearching }, 0);
- }
- }
-}
-
-function testScriptSearching() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- gEditor = gDebugger.DebuggerView.editor;
- gScripts = gDebugger.DebuggerView.Scripts;
- gSearchBox = gScripts._searchbox;
- gMenulist = gScripts._scripts;
-
- firstSearch();
- });
-}
-
-function firstSearch() {
- window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
- dump("Current script url:\n" + aEvent.detail.url + "\n");
- dump("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-01.js") != -1) {
- window.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- dump("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 4 &&
- gEditor.getCaretPosition().col == 0,
- "The editor didn't jump to the correct line. (1)");
- is(gScripts.visibleItemsCount, 1,
- "Not all the correct scripts are shown after the search. (1)");
-
- secondSearch();
- });
- }
- });
- write(".*-01\.js:5");
-}
-
-function secondSearch() {
- window.addEventListener("Debugger:ScriptShown", function _onEvent(aEvent) {
- dump("Current script url:\n" + aEvent.detail.url + "\n");
- dump("Debugger editor text:\n" + gEditor.getText() + "\n");
-
- let url = aEvent.detail.url;
- if (url.indexOf("-02.js") != -1) {
- window.removeEventListener(aEvent.type, _onEvent);
-
- executeSoon(function() {
- dump("Editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8,
- "The editor didn't jump to the correct line. (2)");
- is(gScripts.visibleItemsCount, 1,
- "Not all the correct scripts are shown after the search. (2)");
-
- finalCheck();
- });
- }
- });
- write(".*-02\.js@debugger;");
-}
-
-function finalCheck() {
- clear();
- ok(gEditor.getCaretPosition().line == 5 &&
- gEditor.getCaretPosition().col == 8,
- "The editor didn't remain at the correct token. (3)");
- is(gScripts.visibleItemsCount, 2,
- "Not all the scripts are shown after the search. (3)");
-
- closeDebuggerAndFinish(gTab);
-}
-
-function clear() {
- gSearchBox.focus();
- gSearchBox.value = "";
-}
-
-function write(text) {
- clear();
-
- for (let i = 0; i < text.length; i++) {
- EventUtils.sendChar(text[i]);
- }
- dump("editor caret position: " + gEditor.getCaretPosition().toSource() + "\n");
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
- gEditor = null;
- gScripts = null;
- gSearchBox = null;
- gMenulist = null;
-});
deleted file mode 100644
--- a/browser/devtools/debugger/test/browser_dbg_scripts-sorting.js
+++ /dev/null
@@ -1,124 +0,0 @@
-/* vim:set ts=2 sw=2 sts=2 et: */
-/*
- * Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-var gPane = null;
-var gTab = null;
-var gDebuggee = null;
-var gDebugger = null;
-
-function test() {
- debug_tab_pane(STACK_URL, function(aTab, aDebuggee, aPane) {
- gTab = aTab;
- gDebuggee = aDebuggee;
- gPane = aPane;
- gDebugger = gPane.debuggerWindow;
-
- testSimpleCall();
- });
-}
-
-function testSimpleCall() {
- gDebugger.DebuggerController.activeThread.addOneTimeListener("framesadded", function() {
- Services.tm.currentThread.dispatch({ run: function() {
- resumeAndFinish();
- }}, 0);
- });
-
- gDebuggee.simpleCall();
-}
-
-function resumeAndFinish() {
- gDebugger.DebuggerController.activeThread.resume(function() {
- checkScriptsOrder();
- addScriptsAndCheckOrder(1, function() {
- addScriptsAndCheckOrder(2, function() {
- addScriptsAndCheckOrder(3, function() {
- closeDebuggerAndFinish(gTab);
- });
- });
- });
- });
-}
-
-function addScriptsAndCheckOrder(method, callback) {
- let vs = gDebugger.DebuggerView.Scripts;
- let ss = gDebugger.DebuggerController.SourceScripts;
- vs.empty();
- vs._scripts.removeEventListener("select", vs._onScriptsChange, false);
-
- let urls = [
- { href: "ici://some.address.com/random/", leaf: "subrandom/" },
- { href: "ni://another.address.org/random/subrandom/", leaf: "page.html" },
- { href: "san://interesting.address.gro/random/", leaf: "script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "x/script.js" },
- { href: "si://interesting.address.moc/random/", leaf: "x/y/script.js?a=1" },
- { href: "si://interesting.address.moc/random/x/", leaf: "y/script.js?a=1&b=2" },
- { href: "si://interesting.address.moc/random/x/y/", leaf: "script.js?a=1&b=2&c=3" }
- ];
-
- urls.sort(function(a, b) {
- return Math.random() - 0.5;
- });
-
- switch (method) {
- case 1:
- urls.forEach(function(url) {
- let loc = url.href + url.leaf;
- vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc });
- });
- vs.commitScripts();
- break;
-
- case 2:
- urls.forEach(function(url) {
- let loc = url.href + url.leaf;
- vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc }, true);
- });
- break;
-
- case 3:
- let i = 0
- for (; i < urls.length / 2; i++) {
- let url = urls[i];
- let loc = url.href + url.leaf;
- vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc });
- }
- vs.commitScripts();
-
- for (; i < urls.length; i++) {
- let url = urls[i];
- let loc = url.href + url.leaf;
- vs.addScript(ss._getScriptLabel(loc, url.href), { url: loc }, true);
- }
- break;
- }
-
- executeSoon(function() {
- checkScriptsOrder(method);
- callback();
- });
-}
-
-function checkScriptsOrder(method) {
- let labels = gDebugger.DebuggerView.Scripts.scriptLabels;
- let sorted = labels.reduce(function(prev, curr, index, array) {
- return array[index - 1] < array[index];
- });
-
- ok(sorted,
- "Using method " + method + ", " +
- "the scripts weren't in the correct order: " + labels.toSource());
-
- return sorted;
-}
-
-registerCleanupFunction(function() {
- removeTab(gTab);
- gPane = null;
- gTab = null;
- gDebuggee = null;
- gDebugger = null;
-});
--- a/browser/devtools/debugger/test/head.js
+++ b/browser/devtools/debugger/test/head.js
@@ -87,35 +87,22 @@ function attach_thread_actor_for_url(aCl
});
});
}
function debug_tab_pane(aURL, aOnDebugging)
{
let tab = addTab(aURL, function() {
gBrowser.selectedTab = gTab;
+
let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject;
let pane = DebuggerUI.toggleDebugger();
pane._frame.addEventListener("Debugger:Connecting", function dbgConnected() {
pane._frame.removeEventListener("Debugger:Connecting", dbgConnected, true);
// Wait for the initial resume...
pane.debuggerWindow.gClient.addOneTimeListener("resumed", function() {
aOnDebugging(tab, debuggee, pane);
});
}, true);
});
}
-
-function remote_debug_tab_pane(aURL, aOnClosing, aOnDebugging)
-{
- let tab = addTab(aURL, function() {
- gBrowser.selectedTab = gTab;
- let debuggee = tab.linkedBrowser.contentWindow.wrappedJSObject;
-
- DebuggerUI.toggleRemoteDebugger(aOnClosing, function dbgRan(process) {
-
- // Wait for the remote debugging process to start...
- aOnDebugging(tab, debuggee, process);
- });
- });
-}
--- a/browser/locales/en-US/chrome/browser/devtools/debugger.dtd
+++ b/browser/locales/en-US/chrome/browser/devtools/debugger.dtd
@@ -6,20 +6,16 @@
- You want to make that choice consistent across the developer tools.
- A good criteria is the language in which you'd find the best
- documentation on web development on the web. -->
<!-- LOCALIZATION NOTE (debuggerMenu.label): This is the label for the
- application menu item that opens the debugger UI. -->
<!ENTITY debuggerMenu.label "Script Debugger">
-<!-- LOCALIZATION NOTE (remoteDebuggerMenu.label): This is the label for the
- - application menu item that opens the remote debugger UI. -->
-<!ENTITY remoteDebuggerMenu.label "Remote Debugger">
-
<!-- LOCALIZATION NOTE (debuggerMenu.commandkey): This is the command key that
- launches the debugger UI. Do not translate this one! -->
<!ENTITY debuggerMenu.commandkey "S">
<!-- LOCALIZATION NOTE (debuggerUI.closeButton): This is the label for the
- button that closes the debugger UI. -->
<!ENTITY debuggerUI.closeButton "Close">
@@ -43,12 +39,8 @@
- widget that displays the source code for the script that is currently
- being inspected in the debugger. -->
<!ENTITY debuggerUI.scriptTitle "Script">
<!-- LOCALIZATION NOTE (debuggerUI.propertiesTitle): This is the label for the
- widget that displays the variables in the various available scopes in the
- debugger. -->
<!ENTITY debuggerUI.propertiesTitle "Scope variables">
-
-<!-- LOCALIZATION NOTE (debuggerUI.emptyFilterText): This is the text that
- - appears in the filter text box when it is empty. -->
-<!ENTITY debuggerUI.emptyFilterText "Filter scripts">