зеркало из https://github.com/mozilla/gecko-dev.git
Bug 912057 - Replace Browser Debugger with Browser Toolbox. r=past
--HG-- rename : browser/devtools/debugger/DebuggerProcess.jsm => browser/devtools/framework/ToolboxProcess.jsm
This commit is contained in:
Родитель
7bc8d071b6
Коммит
64ea1cec79
|
@ -518,9 +518,9 @@
|
|||
<menuitem id="menu_devAppMgr"
|
||||
observes="devtoolsMenuBroadcaster_DevAppMgr"
|
||||
accesskey="&devAppMgrMenu.accesskey;"/>
|
||||
<menuitem id="menu_chromeDebugger"
|
||||
observes="devtoolsMenuBroadcaster_ChromeDebugger"
|
||||
accesskey="&chromeDebuggerMenu.accesskey;"/>
|
||||
<menuitem id="menu_browserToolbox"
|
||||
observes="devtoolsMenuBroadcaster_BrowserToolbox"
|
||||
accesskey="&browserToolboxMenu.accesskey;"/>
|
||||
<menuitem id="menu_browserConsole"
|
||||
observes="devtoolsMenuBroadcaster_BrowserConsole"
|
||||
accesskey="&browserConsoleCmd.accesskey;"/>
|
||||
|
|
|
@ -95,7 +95,7 @@
|
|||
<command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true" hidden="true"/>
|
||||
<command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focusToggle();" disabled="true"/>
|
||||
<command id="Tools:DevAppMgr" oncommand="gDevToolsBrowser.openAppManager(gBrowser);" disabled="true" hidden="true"/>
|
||||
<command id="Tools:ChromeDebugger" oncommand="BrowserDebuggerProcess.init();" disabled="true" hidden="true"/>
|
||||
<command id="Tools:BrowserToolbox" oncommand="BrowserToolboxProcess.init();" disabled="true" hidden="true"/>
|
||||
<command id="Tools:BrowserConsole" oncommand="HUDService.toggleBrowserConsole();"/>
|
||||
<command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();"/>
|
||||
<command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();"/>
|
||||
|
@ -185,9 +185,9 @@
|
|||
<broadcaster id="devtoolsMenuBroadcaster_DevAppMgr"
|
||||
label="&devAppMgrMenu.label;"
|
||||
command="Tools:DevAppMgr"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger"
|
||||
label="&chromeDebuggerMenu.label;"
|
||||
command="Tools:ChromeDebugger"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_BrowserToolbox"
|
||||
label="&browserToolboxMenu.label;"
|
||||
command="Tools:BrowserToolbox"/>
|
||||
<broadcaster id="devtoolsMenuBroadcaster_BrowserConsole"
|
||||
label="&browserConsoleCmd.label;"
|
||||
key="key_browserConsole"
|
||||
|
|
|
@ -117,10 +117,10 @@ XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() {
|
|||
return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar"));
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "BrowserDebuggerProcess", function() {
|
||||
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {
|
||||
let tmp = {};
|
||||
Cu.import("resource:///modules/devtools/DebuggerProcess.jsm", tmp);
|
||||
return tmp.BrowserDebuggerProcess;
|
||||
Cu.import("resource:///modules/devtools/ToolboxProcess.jsm", tmp);
|
||||
return tmp.BrowserToolboxProcess;
|
||||
});
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Social",
|
||||
|
|
|
@ -67,6 +67,9 @@ let UI = {
|
|||
case "toolbox-close":
|
||||
this.closeToolboxTab(json.uid);
|
||||
break;
|
||||
case "toolbox-title":
|
||||
// Not implemented
|
||||
break;
|
||||
default:
|
||||
Cu.reportError("Unknown message: " + json.name);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ let { Promise: promise } = Cu.import("resource://gre/modules/commonjs/sdk/core/p
|
|||
let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let { DevToolsUtils } = Cu.import("resource://gre/modules/devtools/DevToolsUtils.jsm", {});
|
||||
let { BrowserDebuggerProcess } = Cu.import("resource:///modules/devtools/DebuggerProcess.jsm", {});
|
||||
let { BrowserToolboxProcess } = Cu.import("resource:///modules/devtools/ToolboxProcess.jsm", {});
|
||||
let { DebuggerServer } = Cu.import("resource://gre/modules/devtools/dbg-server.jsm", {});
|
||||
let { DebuggerClient } = Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
|
||||
let { AddonManager } = Cu.import("resource://gre/modules/AddonManager.jsm", {});
|
||||
|
@ -473,9 +473,9 @@ function initChromeDebugger(aOnClose) {
|
|||
|
||||
let deferred = promise.defer();
|
||||
|
||||
// Wait for the debugger process to start...
|
||||
BrowserDebuggerProcess.init(aOnClose, aProcess => {
|
||||
info("Chrome debugger process started successfully.");
|
||||
// Wait for the toolbox process to start...
|
||||
BrowserToolboxProcess.init(aOnClose, aProcess => {
|
||||
info("Browser toolbox process started successfully.");
|
||||
|
||||
prepareDebugger(aProcess);
|
||||
deferred.resolve(aProcess);
|
||||
|
|
|
@ -52,8 +52,8 @@ devtoolsCommandlineHandler.prototype = {
|
|||
return;
|
||||
}
|
||||
if (remoteDebuggingEnabled) {
|
||||
Cu.import("resource:///modules/devtools/DebuggerProcess.jsm");
|
||||
BrowserDebuggerProcess.init();
|
||||
Cu.import("resource:///modules/devtools/ToolboxProcess.jsm");
|
||||
BrowserToolboxProcess.init();
|
||||
} else {
|
||||
let errorMsg = "Could not run chrome debugger! You need the following prefs " +
|
||||
"to be set to true: " + kDebuggerPrefs.join(", ");
|
||||
|
@ -68,7 +68,7 @@ devtoolsCommandlineHandler.prototype = {
|
|||
},
|
||||
|
||||
helpInfo : " -jsconsole Open the Browser Console.\n" +
|
||||
" -jsdebugger Open the Browser Debugger.\n",
|
||||
" -jsdebugger Open the Browser Toolbox.\n",
|
||||
|
||||
classID: Components.ID("{9e9a9283-0ce9-4e4a-8f1c-ba129a032c32}"),
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
const DBG_XUL = "chrome://browser/content/devtools/debugger.xul";
|
||||
const DBG_XUL = "chrome://browser/content/devtools/framework/toolbox-process-window.xul";
|
||||
const CHROME_DEBUGGER_PROFILE_NAME = "-chrome-debugger";
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
|
@ -17,17 +17,17 @@ Cu.import("resource://gre/modules/devtools/Loader.jsm");
|
|||
let require = devtools.require;
|
||||
let Telemetry = require("devtools/shared/telemetry");
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["BrowserDebuggerProcess"];
|
||||
this.EXPORTED_SYMBOLS = ["BrowserToolboxProcess"];
|
||||
|
||||
/**
|
||||
* Constructor for creating a process that will hold a chrome debugger.
|
||||
* Constructor for creating a process that will hold a chrome toolbox.
|
||||
*
|
||||
* @param function aOnClose [optional]
|
||||
* A function called when the process stops running.
|
||||
* @param function aOnRun [optional]
|
||||
* A function called when the process starts running.
|
||||
*/
|
||||
this.BrowserDebuggerProcess = function BrowserDebuggerProcess(aOnClose, aOnRun) {
|
||||
this.BrowserToolboxProcess = function BrowserToolboxProcess(aOnClose, aOnRun) {
|
||||
this._closeCallback = aOnClose;
|
||||
this._runCallback = aOnRun;
|
||||
this._telemetry = new Telemetry();
|
||||
|
@ -38,19 +38,19 @@ this.BrowserDebuggerProcess = function BrowserDebuggerProcess(aOnClose, aOnRun)
|
|||
};
|
||||
|
||||
/**
|
||||
* Initializes and starts a chrome debugger process.
|
||||
* Initializes and starts a chrome toolbox process.
|
||||
* @return object
|
||||
*/
|
||||
BrowserDebuggerProcess.init = function(aOnClose, aOnRun) {
|
||||
return new BrowserDebuggerProcess(aOnClose, aOnRun);
|
||||
BrowserToolboxProcess.init = function(aOnClose, aOnRun) {
|
||||
return new BrowserToolboxProcess(aOnClose, aOnRun);
|
||||
};
|
||||
|
||||
BrowserDebuggerProcess.prototype = {
|
||||
BrowserToolboxProcess.prototype = {
|
||||
/**
|
||||
* Initializes the debugger server.
|
||||
*/
|
||||
_initServer: function() {
|
||||
dumpn("Initializing the chrome debugger server.");
|
||||
dumpn("Initializing the chrome toolbox server.");
|
||||
|
||||
if (!this.loader) {
|
||||
// Create a separate loader instance, so that we can be sure to receive a
|
||||
|
@ -71,7 +71,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
|
||||
this.debuggerServer.openListener(Prefs.chromeDebuggingPort);
|
||||
|
||||
dumpn("Finished initializing the chrome debugger server.");
|
||||
dumpn("Finished initializing the chrome toolbox server.");
|
||||
dumpn("Started listening on port: " + Prefs.chromeDebuggingPort);
|
||||
},
|
||||
|
||||
|
@ -79,7 +79,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
* Initializes a profile for the remote debugger process.
|
||||
*/
|
||||
_initProfile: function() {
|
||||
dumpn("Initializing the chrome debugger user profile.");
|
||||
dumpn("Initializing the chrome toolbox user profile.");
|
||||
|
||||
let profileService = Cc["@mozilla.org/toolkit/profile-service;1"]
|
||||
.createInstance(Ci.nsIToolkitProfileService);
|
||||
|
@ -88,7 +88,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
try {
|
||||
// Attempt to get the required chrome debugging profile name string.
|
||||
profileName = profileService.selectedProfile.name + CHROME_DEBUGGER_PROFILE_NAME;
|
||||
dumpn("Using chrome debugger profile name: " + profileName);
|
||||
dumpn("Using chrome toolbox profile name: " + profileName);
|
||||
} catch (e) {
|
||||
// Requested profile string could not be retrieved.
|
||||
profileName = CHROME_DEBUGGER_PROFILE_NAME;
|
||||
|
@ -101,7 +101,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
try {
|
||||
// Attempt to get the required chrome debugging profile toolkit object.
|
||||
profileObject = profileService.getProfileByName(profileName);
|
||||
dumpn("Using chrome debugger profile object: " + profileObject);
|
||||
dumpn("Using chrome toolbox profile object: " + profileObject);
|
||||
|
||||
// The profile exists but the corresponding folder may have been deleted.
|
||||
var enumerator = Services.dirsvc.get("ProfD", Ci.nsIFile).parent.directoryEntries;
|
||||
|
@ -115,7 +115,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
}
|
||||
// Requested profile was found but the folder was deleted. Cleanup needed.
|
||||
profileObject.remove(true);
|
||||
dumpn("The already existing chrome debugger profile was invalid.");
|
||||
dumpn("The already existing chrome toolbox profile was invalid.");
|
||||
} catch (e) {
|
||||
// Requested profile object was not found.
|
||||
let msg = "Creating a profile failed. " + e.name + ": " + e.message;
|
||||
|
@ -127,7 +127,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
this._dbgProfile = profileService.createProfile(null, profileName);
|
||||
profileService.flush();
|
||||
|
||||
dumpn("Finished creating the chrome debugger user profile.");
|
||||
dumpn("Finished creating the chrome toolbox user profile.");
|
||||
dumpn("Flushed profile service with: " + profileName);
|
||||
},
|
||||
|
||||
|
@ -145,7 +145,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
|
||||
this._telemetry.toolOpened("jsbrowserdebugger");
|
||||
|
||||
dumpn("Chrome debugger is now running...");
|
||||
dumpn("Chrome toolbox is now running...");
|
||||
if (typeof this._runCallback == "function") {
|
||||
this._runCallback.call({}, this);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ BrowserDebuggerProcess.prototype = {
|
|||
this._telemetry.toolClosed("jsbrowserdebugger");
|
||||
this.debuggerServer.destroy();
|
||||
|
||||
dumpn("Chrome debugger is now closed...");
|
||||
dumpn("Chrome toolbox is now closed...");
|
||||
if (typeof this._closeCallback == "function") {
|
||||
this._closeCallback.call({}, this);
|
||||
}
|
|
@ -405,12 +405,12 @@ let gDevToolsBrowser = {
|
|||
let appMgrEnabled = Services.prefs.getBoolPref("devtools.appmanager.enabled");
|
||||
toggleCmd("Tools:DevAppMgr", appMgrEnabled);
|
||||
|
||||
// Enable Chrome Debugger?
|
||||
// Enable Browser Toolbox?
|
||||
let chromeEnabled = Services.prefs.getBoolPref("devtools.chrome.enabled");
|
||||
let devtoolsRemoteEnabled = Services.prefs.getBoolPref("devtools.debugger.remote-enabled");
|
||||
let remoteEnabled = chromeEnabled && devtoolsRemoteEnabled &&
|
||||
Services.prefs.getBoolPref("devtools.debugger.chrome-enabled");
|
||||
toggleCmd("Tools:ChromeDebugger", remoteEnabled);
|
||||
toggleCmd("Tools:BrowserToolbox", remoteEnabled);
|
||||
|
||||
// Enable Error Console?
|
||||
let consoleEnabled = Services.prefs.getBoolPref("devtools.errorconsole.enabled");
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
let gItemsToTest = {
|
||||
"menu_devToolbar": "devtools.toolbar.enabled",
|
||||
"menu_devAppMgr": "devtools.appmanager.enabled",
|
||||
"menu_chromeDebugger": ["devtools.chrome.enabled", "devtools.debugger.remote-enabled", "devtools.debugger.chrome-enabled"],
|
||||
"menu_browserToolbox": ["devtools.chrome.enabled", "devtools.debugger.remote-enabled", "devtools.debugger.chrome-enabled"],
|
||||
"javascriptConsole": "devtools.errorconsole.enabled",
|
||||
"menu_devtools_connect": "devtools.debugger.remote-enabled",
|
||||
};
|
||||
|
|
|
@ -26,7 +26,7 @@ exports.Hosts = {
|
|||
"side": SidebarHost,
|
||||
"window": WindowHost,
|
||||
"custom": CustomHost
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Host object for the dock on the bottom of the browser
|
||||
|
@ -272,7 +272,7 @@ WindowHost.prototype = {
|
|||
|
||||
return promise.resolve(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Host object for the toolbox in its own tab
|
||||
|
@ -286,11 +286,14 @@ function CustomHost(hostTab, options) {
|
|||
CustomHost.prototype = {
|
||||
type: "custom",
|
||||
|
||||
_sendMessageToTopWindow: function CH__sendMessageToTopWindow(msg) {
|
||||
_sendMessageToTopWindow: function CH__sendMessageToTopWindow(msg, data) {
|
||||
// It's up to the custom frame owner (parent window) to honor
|
||||
// "close" or "raise" instructions.
|
||||
let topWindow = this.frame.ownerDocument.defaultView;
|
||||
let json = {name:"toolbox-" + msg, uid: this.uid}
|
||||
let json = {name:"toolbox-" + msg, uid: this.uid};
|
||||
if (data) {
|
||||
json.data = data;
|
||||
}
|
||||
topWindow.postMessage(JSON.stringify(json), "*");
|
||||
},
|
||||
|
||||
|
@ -312,7 +315,7 @@ CustomHost.prototype = {
|
|||
* Set the toolbox title.
|
||||
*/
|
||||
setTitle: function CH_setTitle(title) {
|
||||
// Not supported
|
||||
this._sendMessageToTopWindow("title", { value: title });
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -0,0 +1,103 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||
|
||||
let { gDevTools } = Cu.import("resource:///modules/devtools/gDevTools.jsm", {});
|
||||
let { devtools } = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
|
||||
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
|
||||
let { debuggerSocketConnect, DebuggerClient } =
|
||||
Cu.import("resource://gre/modules/devtools/dbg-client.jsm", {});
|
||||
let { ViewHelpers } =
|
||||
Cu.import("resource:///modules/devtools/ViewHelpers.jsm", {});
|
||||
|
||||
/**
|
||||
* Shortcuts for accessing various debugger preferences.
|
||||
*/
|
||||
let Prefs = new ViewHelpers.Prefs("devtools.debugger", {
|
||||
chromeDebuggingHost: ["Char", "chrome-debugging-host"],
|
||||
chromeDebuggingPort: ["Int", "chrome-debugging-port"]
|
||||
});
|
||||
|
||||
// Initiate the connection
|
||||
let transport = debuggerSocketConnect(
|
||||
Prefs.chromeDebuggingHost,
|
||||
Prefs.chromeDebuggingPort
|
||||
);
|
||||
let client = new DebuggerClient(transport);
|
||||
client.connect(() => {
|
||||
client.listTabs(openToolbox);
|
||||
});
|
||||
|
||||
let gToolbox;
|
||||
|
||||
function openToolbox(form) {
|
||||
let options = {
|
||||
form: form,
|
||||
client: client,
|
||||
chrome: true
|
||||
};
|
||||
devtools.TargetFactory.forRemoteTab(options).then(target => {
|
||||
let frame = document.getElementById("toolbox-iframe");
|
||||
let options = { customIframe: frame };
|
||||
gDevTools.showToolbox(target,
|
||||
"jsdebugger",
|
||||
devtools.Toolbox.HostType.CUSTOM,
|
||||
options)
|
||||
.then(onNewToolbox);
|
||||
});
|
||||
}
|
||||
|
||||
function onNewToolbox(toolbox) {
|
||||
gToolbox = toolbox;
|
||||
bindToolboxHandlers();
|
||||
raise();
|
||||
}
|
||||
|
||||
function bindToolboxHandlers() {
|
||||
gToolbox.once("destroyed", quitApp);
|
||||
window.addEventListener("unload", onUnload);
|
||||
}
|
||||
|
||||
function onUnload() {
|
||||
window.removeEventListener("unload", onUnload);
|
||||
window.removeEventListener("message", onMessage);
|
||||
gToolbox.destroy();
|
||||
}
|
||||
|
||||
function onMessage(event) {
|
||||
try {
|
||||
let json = JSON.parse(event.data);
|
||||
switch (json.name) {
|
||||
case "toolbox-raise":
|
||||
raise();
|
||||
break;
|
||||
case "toolbox-title":
|
||||
setTitle(json.data.value);
|
||||
break;
|
||||
}
|
||||
} catch(e) { Cu.reportError(e); }
|
||||
}
|
||||
|
||||
window.addEventListener("message", onMessage);
|
||||
|
||||
function raise() {
|
||||
window.focus();
|
||||
}
|
||||
|
||||
function setTitle(title) {
|
||||
document.title = title;
|
||||
}
|
||||
|
||||
function quitApp() {
|
||||
let quit = Cc["@mozilla.org/supports-PRBool;1"]
|
||||
.createInstance(Ci.nsISupportsPRBool);
|
||||
Services.obs.notifyObservers(quit, "quit-application-requested", null);
|
||||
|
||||
let shouldProceed = !quit.data;
|
||||
if (shouldProceed) {
|
||||
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<!DOCTYPE window [
|
||||
<!ENTITY % toolboxDTD SYSTEM "chrome://browser/locale/devtools/toolbox.dtd" >
|
||||
%toolboxDTD;
|
||||
]>
|
||||
|
||||
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
id="devtools-toolbox-window"
|
||||
macanimationtype="document"
|
||||
fullscreenbutton="true"
|
||||
windowtype="devtools:toolbox"
|
||||
width="900" height="600"
|
||||
persist="screenX screenY width height sizemode">
|
||||
|
||||
<script type="text/javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
<script type="text/javascript" src="toolbox-process-window.js"/>
|
||||
<script type="text/javascript" src="chrome://global/content/viewSourceUtils.js"/>
|
||||
<script type="text/javascript" src="chrome://browser/content/utilityOverlay.js"/>
|
||||
|
||||
<commandset id="toolbox-commandset">
|
||||
<command id="toolbox-cmd-close" oncommand="window.close();"/>
|
||||
</commandset>
|
||||
|
||||
<keyset id="toolbox-keyset">
|
||||
<key id="toolbox-key-close"
|
||||
key="&closeCmd.key;"
|
||||
command="toolbox-cmd-close"
|
||||
modifiers="accel"/>
|
||||
</keyset>
|
||||
|
||||
<!-- This will be used by the Web Console to hold any popups it may create,
|
||||
for example when viewing network request details. -->
|
||||
<popupset id="mainPopupSet"></popupset>
|
||||
|
||||
<iframe id="toolbox-iframe" flex="1"></iframe>
|
||||
</window>
|
|
@ -76,6 +76,8 @@ browser.jar:
|
|||
content/browser/devtools/framework/toolbox-options.js (framework/toolbox-options.js)
|
||||
* content/browser/devtools/framework/toolbox.xul (framework/toolbox.xul)
|
||||
content/browser/devtools/framework/toolbox.css (framework/toolbox.css)
|
||||
content/browser/devtools/framework/toolbox-process-window.xul (framework/toolbox-process-window.xul)
|
||||
content/browser/devtools/framework/toolbox-process-window.js (framework/toolbox-process-window.js)
|
||||
content/browser/devtools/inspector/inspector.xul (inspector/inspector.xul)
|
||||
content/browser/devtools/inspector/inspector.css (inspector/inspector.css)
|
||||
content/browser/devtools/connect.xhtml (framework/connect/connect.xhtml)
|
||||
|
|
|
@ -335,13 +335,29 @@ WebConsole.prototype = {
|
|||
*/
|
||||
get lastFinishedRequestCallback() HUDService.lastFinishedRequest.callback,
|
||||
|
||||
/**
|
||||
* Getter for the window that can provide various utilities that the web
|
||||
* console makes use of, like opening links, managing popups, etc. In
|
||||
* most cases, this will be |this.browserWindow|, but in some uses (such as
|
||||
* the Browser Toolbox), there is no browser window, so an alternative window
|
||||
* hosts the utilities there.
|
||||
* @type nsIDOMWindow
|
||||
*/
|
||||
get chromeUtilsWindow()
|
||||
{
|
||||
if (this.browserWindow) {
|
||||
return this.browserWindow;
|
||||
}
|
||||
return this.chromeWindow.top;
|
||||
},
|
||||
|
||||
/**
|
||||
* Getter for the xul:popupset that holds any popups we open.
|
||||
* @type nsIDOMElement
|
||||
*/
|
||||
get mainPopupSet()
|
||||
{
|
||||
return this.browserWindow.document.getElementById("mainPopupSet");
|
||||
return this.chromeUtilsWindow.document.getElementById("mainPopupSet");
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -353,7 +369,10 @@ WebConsole.prototype = {
|
|||
return this.ui ? this.ui.outputNode : null;
|
||||
},
|
||||
|
||||
get gViewSourceUtils() this.browserWindow.gViewSourceUtils,
|
||||
get gViewSourceUtils()
|
||||
{
|
||||
return this.chromeUtilsWindow.gViewSourceUtils;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize the Web Console instance.
|
||||
|
@ -416,7 +435,7 @@ WebConsole.prototype = {
|
|||
*/
|
||||
openLink: function WC_openLink(aLink)
|
||||
{
|
||||
this.browserWindow.openUILinkIn(aLink, "tab");
|
||||
this.chromeUtilsWindow.openUILinkIn(aLink, "tab");
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -244,10 +244,10 @@ These should match what Safari and other Apple applications use on OS X Lion. --
|
|||
<!ENTITY scratchpad.keycode "VK_F4">
|
||||
<!ENTITY scratchpad.keytext "F4">
|
||||
|
||||
<!-- LOCALIZATION NOTE (chromeDebuggerMenu.label): This is the label for the
|
||||
- application menu item that opens the browser debugger UI in the Tools menu. -->
|
||||
<!ENTITY chromeDebuggerMenu.label "Browser Debugger">
|
||||
<!ENTITY chromeDebuggerMenu.accesskey "e">
|
||||
<!-- LOCALIZATION NOTE (browserToolboxMenu.label): This is the label for the
|
||||
- application menu item that opens the browser toolbox UI in the Tools menu. -->
|
||||
<!ENTITY browserToolboxMenu.label "Browser Toolbox">
|
||||
<!ENTITY browserToolboxMenu.accesskey "e">
|
||||
|
||||
<!ENTITY devToolbarCloseButton.tooltiptext "Close Developer Toolbar">
|
||||
<!ENTITY devToolbarMenu.label "Developer Toolbar">
|
||||
|
|
|
@ -81,10 +81,12 @@ loader.lazyGetter(this, "DOMParser", function() {
|
|||
});
|
||||
|
||||
exports.register = function(handle) {
|
||||
handle.addGlobalActor(InspectorActor, "inspectorActor");
|
||||
handle.addTabActor(InspectorActor, "inspectorActor");
|
||||
};
|
||||
|
||||
exports.unregister = function(handle) {
|
||||
handle.removeGlobalActor(InspectorActor);
|
||||
handle.removeTabActor(InspectorActor);
|
||||
};
|
||||
|
||||
|
|
|
@ -191,6 +191,11 @@ RootActor.prototype = {
|
|||
*/
|
||||
get window() Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType),
|
||||
|
||||
/**
|
||||
* URL of the chrome window.
|
||||
*/
|
||||
get url() { return this.window ? this.window.document.location.href : null; },
|
||||
|
||||
/**
|
||||
* Getter for the best nsIWebProgress for to watching this window.
|
||||
*/
|
||||
|
@ -275,6 +280,11 @@ RootActor.prototype = {
|
|||
"tabs": [actor.form() for (actor of tabActorList)],
|
||||
};
|
||||
|
||||
/* If a root window is accessible, include its URL. */
|
||||
if (this.url) {
|
||||
reply.url = this.url;
|
||||
}
|
||||
|
||||
/* DebuggerServer.addGlobalActor support: name actors in 'listTabs' reply. */
|
||||
this._appendExtraActors(reply);
|
||||
|
||||
|
|
|
@ -706,6 +706,7 @@ StyleSheetActor.prototype.requestTypes = {
|
|||
};
|
||||
|
||||
DebuggerServer.addTabActor(StyleEditorActor, "styleEditorActor");
|
||||
DebuggerServer.addGlobalActor(StyleEditorActor, "styleEditorActor");
|
||||
|
||||
XPCOMUtils.defineLazyGetter(this, "DOMUtils", function () {
|
||||
return Cc["@mozilla.org/inspector/dom-utils;1"].getService(Ci.inIDOMUtils);
|
||||
|
|
Загрузка…
Ссылка в новой задаче