Bug 749222 - Create a separate way to start a chrome debugger; r=past

This commit is contained in:
Victor Porof 2012-04-26 14:28:11 -04:00
parent a9972182c0
commit 981ba016e5
6 changed files with 45 additions and 1 deletions

View File

@ -198,6 +198,10 @@
hidden="true"
label="&remoteDebuggerMenu.label;"
command="Tools:RemoteDebugger"/>
<menuitem id="appmenu_chromeDebugger"
hidden="true"
label="&chromeDebuggerMenu.label;"
command="Tools:ChromeDebugger"/>
<menuitem id="appmenu_scratchpad"
hidden="true"
label="&scratchpad.label;"

View File

@ -555,6 +555,10 @@
hidden="true"
label="&remoteDebuggerMenu.label;"
command="Tools:RemoteDebugger"/>
<menuitem id="menu_chromeDebugger"
hidden="true"
label="&chromeDebuggerMenu.label;"
command="Tools:ChromeDebugger"/>
<menuitem id="menu_scratchpad"
hidden="true"
label="&scratchpad.label;"

View File

@ -130,6 +130,7 @@
<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:ChromeDebugger" oncommand="DebuggerUI.toggleChromeDebugger();" 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();"/>

View File

@ -1726,6 +1726,16 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
#endif
}
// Enable Chrome Debugger?
let enabled = gPrefService.getBoolPref("devtools.chrome.enabled");
if (enabled) {
document.getElementById("menu_chromeDebugger").hidden = false;
document.getElementById("Tools:ChromeDebugger").removeAttribute("disabled");
#ifdef MENUBAR_CAN_AUTOHIDE
document.getElementById("appmenu_chromeDebugger").hidden = false;
#endif
}
// Enable Error Console?
// XXX Temporarily always-enabled, see bug 601201
let consoleEnabled = true || gPrefService.getBoolPref("devtools.errorconsole.enabled");

View File

@ -96,6 +96,21 @@ DebuggerUI.prototype = {
return new DebuggerProcess(win, aOnClose, aOnRun);
},
/**
* Starts a chrome 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.
*/
toggleChromeDebugger: function DUI_toggleChromeDebugger(aOnClose, aOnRun) {
let win = this.chromeWindow;
if (win._chromeDebugger) {
win._chromeDebugger.close();
return null;
}
return new DebuggerProcess(win, aOnClose, aOnRun, true);
},
/**
* Get the debugger for a specified tab.
* @return DebuggerPane if a debugger exists for the tab, null otherwise
@ -121,6 +136,7 @@ DebuggerUI.prototype = {
*/
function DebuggerPane(aTab) {
this._tab = aTab;
this._initServer();
this._create();
}
@ -224,13 +240,18 @@ DebuggerPane.prototype = {
* Optional, a function called when the process exits.
* @param function aOnRun
* Optional, a function called when the process starts running.
* @param boolean aInitServerFlag
* True to initialize the server. This should happen only in the chrome
* debugging case. This should also be true by default after bug #747429.
* @param nsIDOMWindow aWindow
* The chrome window for which the remote debugger instance is created.
*/
function DebuggerProcess(aWindow, aOnClose, aOnRun) {
function DebuggerProcess(aWindow, aOnClose, aOnRun, aInitServerFlag) {
this._win = aWindow;
this._closeCallback = aOnClose;
this._runCallback = aOnRun;
aInitServerFlag && this._initServer();
this._initProfile();
this._create();
}

View File

@ -15,6 +15,10 @@
- application menu item that opens the remote debugger UI. -->
<!ENTITY remoteDebuggerMenu.label "Remote Debugger">
<!-- LOCALIZATION NOTE (chromeDebuggerMenu.label): This is the label for the
- application menu item that opens the browser debugger UI. -->
<!ENTITY chromeDebuggerMenu.label "Browser Debugger">
<!-- LOCALIZATION NOTE (debuggerMenu.commandkey): This is the command key that
- launches the debugger UI. Do not translate this one! -->
<!ENTITY debuggerMenu.commandkey "S">