Created
March 18, 2016 00:44
-
-
Save jryans/c46993c39a10509eb530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# HG changeset patch | |
# User J. Ryan Stinnett <[email protected]> | |
Force about:devtools-toolbox into child process | |
MozReview-Commit-ID: HXU7HSCo2jU | |
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in | |
index d45c3cc..d20926b 100644 | |
--- a/browser/installer/package-manifest.in | |
+++ b/browser/installer/package-manifest.in | |
@@ -370,16 +370,18 @@ | |
@RESPATH@/browser/components/FeedConverter.js | |
@RESPATH@/browser/components/FeedWriter.js | |
@RESPATH@/browser/components/WebContentConverter.js | |
@RESPATH@/browser/components/BrowserComponents.manifest | |
@RESPATH@/browser/components/nsBrowserContentHandler.js | |
@RESPATH@/browser/components/nsBrowserGlue.js | |
@RESPATH@/browser/components/nsSetDefaultBrowser.manifest | |
@RESPATH@/browser/components/nsSetDefaultBrowser.js | |
+@RESPATH@/browser/components/about-devtools-toolbox.manifest | |
+@RESPATH@/browser/components/about-devtools-toolbox.js | |
@RESPATH@/browser/components/devtools-startup.manifest | |
@RESPATH@/browser/components/devtools-startup.js | |
@RESPATH@/browser/components/webideCli.js | |
@RESPATH@/browser/components/webideComponents.manifest | |
@RESPATH@/browser/components/Experiments.manifest | |
@RESPATH@/browser/components/ExperimentsService.js | |
@RESPATH@/browser/components/browser-newtab.xpt | |
@RESPATH@/browser/components/aboutNewTabService.js | |
diff --git a/devtools/client/framework/about-devtools-toolbox.js b/devtools/client/framework/about-devtools-toolbox.js | |
index ea410f4..d5dda99 100644 | |
--- a/devtools/client/framework/about-devtools-toolbox.js | |
+++ b/devtools/client/framework/about-devtools-toolbox.js | |
@@ -2,59 +2,39 @@ | |
* 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"; | |
// Register about:devtools-toolbox which allows to open a devtools toolbox | |
// in a Firefox tab or a custom html iframe in browser.html | |
-const { Ci, Cu, Cm, components } = require("chrome"); | |
-const Services = require("Services"); | |
+const { interfaces: Ci, utils: Cu } = Components; | |
+const { Services } = Cu.import("resource://gre/modules/Services.jsm", {}); | |
const { XPCOMUtils } = Cu.import("resource://gre/modules/XPCOMUtils.jsm", {}); | |
const { nsIAboutModule } = Ci; | |
function AboutURL() {} | |
AboutURL.prototype = { | |
uri: Services.io.newURI("chrome://devtools/content/framework/toolbox.xul", | |
null, null), | |
classDescription: "about:devtools-toolbox", | |
- classID: components.ID("11342911-3135-45a8-8d71-737a2b0ad469"), | |
+ classID: Components.ID("11342911-3135-45a8-8d71-737a2b0ad469"), | |
contractID: "@mozilla.org/network/protocol/about;1?what=devtools-toolbox", | |
QueryInterface: XPCOMUtils.generateQI([nsIAboutModule]), | |
- newChannel: function(aURI, aLoadInfo) { | |
- let chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, aLoadInfo); | |
+ newChannel: function(uri, loadInfo) { | |
+ let chan = Services.io.newChannelFromURIWithLoadInfo(this.uri, loadInfo); | |
chan.owner = Services.scriptSecurityManager.getSystemPrincipal(); | |
return chan; | |
}, | |
- getURIFlags: function(aURI) { | |
- return nsIAboutModule.ALLOW_SCRIPT || nsIAboutModule.ENABLE_INDEXED_DB; | |
+ getURIFlags: function(uri) { | |
+ return nsIAboutModule.ALLOW_SCRIPT | | |
+ nsIAboutModule.ENABLE_INDEXED_DB | | |
+ nsIAboutModule.URI_CAN_LOAD_IN_CHILD | | |
+ nsIAboutModule.URI_MUST_LOAD_IN_CHILD; | |
} | |
}; | |
-AboutURL.createInstance = function(outer, iid) { | |
- if (outer) { | |
- throw Cr.NS_ERROR_NO_AGGREGATION; | |
- } | |
- return new AboutURL(); | |
-}; | |
- | |
-exports.register = function () { | |
- if (Cm.isCIDRegistered(AboutURL.prototype.classID)) { | |
- console.error("Trying to register " + AboutURL.prototype.classDescription + | |
- " more than once."); | |
- } else { | |
- Cm.registerFactory(AboutURL.prototype.classID, | |
- AboutURL.prototype.classDescription, | |
- AboutURL.prototype.contractID, | |
- AboutURL); | |
- } | |
-} | |
- | |
-exports.unregister = function () { | |
- if (Cm.isCIDRegistered(AboutURL.prototype.classID)) { | |
- Cm.unregisterFactory(AboutURL.prototype.classID, AboutURL); | |
- } | |
-} | |
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([AboutURL]); | |
diff --git a/devtools/client/framework/about-devtools-toolbox.manifest b/devtools/client/framework/about-devtools-toolbox.manifest | |
new file mode 100644 | |
index 0000000..d9fdbdb | |
--- /dev/null | |
+++ b/devtools/client/framework/about-devtools-toolbox.manifest | |
@@ -0,0 +1,2 @@ | |
+component {11342911-3135-45a8-8d71-737a2b0ad469} about-devtools-toolbox.js | |
+contract @mozilla.org/network/protocol/about;1?what=devtools-toolbox {11342911-3135-45a8-8d71-737a2b0ad469} | |
diff --git a/devtools/client/framework/devtools.js b/devtools/client/framework/devtools.js | |
index efc2f95..d8518f2d 100644 | |
--- a/devtools/client/framework/devtools.js | |
+++ b/devtools/client/framework/devtools.js | |
@@ -10,17 +10,16 @@ const promise = require("promise"); | |
// Load gDevToolsBrowser toolbox lazily as they need gDevTools to be fully initialized | |
loader.lazyRequireGetter(this, "Toolbox", "devtools/client/framework/toolbox", true); | |
loader.lazyRequireGetter(this, "gDevToolsBrowser", "devtools/client/framework/devtools-browser", true); | |
const {defaultTools: DefaultTools, defaultThemes: DefaultThemes} = | |
require("devtools/client/definitions"); | |
const EventEmitter = require("devtools/shared/event-emitter"); | |
const {JsonView} = require("devtools/client/jsonview/main"); | |
-const AboutDevTools = require("devtools/client/framework/about-devtools-toolbox"); | |
const FORBIDDEN_IDS = new Set(["toolbox", ""]); | |
const MAX_ORDINAL = 99; | |
/** | |
* DevTools is a class that represents a set of developer tools, it holds a | |
* set of tools and keeps track of open toolboxes in the browser. | |
*/ | |
@@ -31,18 +30,16 @@ this.DevTools = function DevTools() { | |
// destroy() is an observer's handler so we need to preserve context. | |
this.destroy = this.destroy.bind(this); | |
this._teardown = this._teardown.bind(this); | |
// JSON Viewer for 'application/json' documents. | |
JsonView.initialize(); | |
- AboutDevTools.register(); | |
- | |
EventEmitter.decorate(this); | |
Services.obs.addObserver(this._teardown, "devtools-unloaded", false); | |
Services.obs.addObserver(this.destroy, "quit-application", false); | |
}; | |
DevTools.prototype = { | |
registerDefaults() { | |
@@ -468,17 +465,16 @@ DevTools.prototype = { | |
/** | |
* Called to tear down a tools provider. | |
*/ | |
_teardown: function DT_teardown() { | |
for (let [target, toolbox] of this._toolboxes) { | |
toolbox.destroy(); | |
} | |
- AboutDevTools.unregister(); | |
}, | |
/** | |
* All browser windows have been closed, tidy up remaining objects. | |
*/ | |
destroy: function() { | |
Services.obs.removeObserver(this.destroy, "quit-application"); | |
Services.obs.removeObserver(this._teardown, "devtools-unloaded"); | |
@@ -500,9 +496,8 @@ DevTools.prototype = { | |
*[Symbol.iterator]() { | |
for (let toolbox of this._toolboxes) { | |
yield toolbox; | |
} | |
} | |
}; | |
exports.gDevTools = new DevTools(); | |
- | |
diff --git a/devtools/client/framework/moz.build b/devtools/client/framework/moz.build | |
index d28e468..6584eeb 100644 | |
--- a/devtools/client/framework/moz.build | |
+++ b/devtools/client/framework/moz.build | |
@@ -5,24 +5,28 @@ | |
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
BROWSER_CHROME_MANIFESTS += ['test/browser.ini'] | |
TEST_HARNESS_FILES.xpcshell.devtools.client.framework.test += [ | |
'test/shared-redux-head.js', | |
] | |
DevToolsModules( | |
- 'about-devtools-toolbox.js', | |
'attach-thread.js', | |
'devtools-browser.js', | |
'devtools.js', | |
'gDevTools.jsm', | |
'selection.js', | |
'sidebar.js', | |
'source-location.js', | |
'target-from-url.js', | |
'target.js', | |
'toolbox-highlighter-utils.js', | |
'toolbox-hosts.js', | |
'toolbox-options.js', | |
'toolbox.js', | |
'ToolboxProcess.jsm', | |
) | |
+ | |
+EXTRA_COMPONENTS += [ | |
+ 'about-devtools-toolbox.js', | |
+ 'about-devtools-toolbox.manifest', | |
+] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment