зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1492265 - Remove xpcshell specifics from BrowsingContextTargetActor and ParentProcessTargetActor. r=jdescottes
Now that xpcshell no longer uses ParentProcessTargetActor, we can remove comments about it using it. We can also remove a couple of null checks against docShell that were specific to this usecase. MozReview-Commit-ID: 67sugv4bZC3 Depends on D7416 Differential Revision: https://phabricator.services.mozilla.com/D7726 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
687cff632b
Коммит
c6d9d13e6e
|
@ -336,11 +336,7 @@ const browsingContextTargetPrototype = {
|
|||
* Getter for the browsing context's current DOM window.
|
||||
*/
|
||||
get window() {
|
||||
// On xpcshell, there is no document
|
||||
if (this.docShell) {
|
||||
return this.docShell.domWindow;
|
||||
}
|
||||
return null;
|
||||
return this.docShell.domWindow;
|
||||
},
|
||||
|
||||
get outerWindowID() {
|
||||
|
@ -355,11 +351,10 @@ const browsingContextTargetPrototype = {
|
|||
* browsing context's current DOM window.
|
||||
*/
|
||||
get webextensionsContentScriptGlobals() {
|
||||
// Ignore xpcshell runtime which spawns target actors without a window
|
||||
// and only retrieve the content scripts globals if the ExtensionContent JSM module
|
||||
// Only retrieve the content scripts globals if the ExtensionContent JSM module
|
||||
// has been already loaded (which is true if the WebExtensions internals have already
|
||||
// been loaded in the same content process).
|
||||
if (this.window && Cu.isModuleLoaded(EXTENSION_CONTENT_JSM)) {
|
||||
if (Cu.isModuleLoaded(EXTENSION_CONTENT_JSM)) {
|
||||
return ExtensionContent.getContentScriptGlobals(this.window);
|
||||
}
|
||||
|
||||
|
@ -460,17 +455,15 @@ const browsingContextTargetPrototype = {
|
|||
const response = {
|
||||
actor: this.actorID,
|
||||
traits: {
|
||||
// FF64+ exposes a new trait to help identify ParentProcessTargetActor used for
|
||||
// xpcshell that isn't attached to any valid browsing context and so shouldn't
|
||||
// be considered as a browsing context-inherited target on the client side.
|
||||
isBrowsingContext: !!this.docShell,
|
||||
// FF64+ exposes a new trait to help identify BrowsingContextActor's inherited
|
||||
// actorss from the client side.
|
||||
isBrowsingContext: true,
|
||||
},
|
||||
};
|
||||
|
||||
// We may try to access window while the document is closing, then
|
||||
// accessing window throws. Also on xpcshell we are using this actor even if
|
||||
// there is no valid document.
|
||||
if (this.docShell && !this.docShell.isBeingDestroyed()) {
|
||||
// We may try to access window while the document is closing, then accessing window
|
||||
// throws.
|
||||
if (!this.docShell.isBeingDestroyed()) {
|
||||
response.title = this.title;
|
||||
response.url = this.url;
|
||||
response.outerWindowID = this.outerWindowID;
|
||||
|
@ -575,17 +568,14 @@ const browsingContextTargetPrototype = {
|
|||
// Create a pool for context-lifetime actors.
|
||||
this._createThreadActor();
|
||||
|
||||
// on xpcshell, there is no document
|
||||
if (this.window) {
|
||||
this._progressListener = new DebuggerProgressListener(this);
|
||||
this._progressListener = new DebuggerProgressListener(this);
|
||||
|
||||
// Save references to the original document we attached to
|
||||
this._originalWindow = this.window;
|
||||
// Save references to the original document we attached to
|
||||
this._originalWindow = this.window;
|
||||
|
||||
// Ensure replying to attach() request first
|
||||
// before notifying about new docshells.
|
||||
DevToolsUtils.executeSoon(() => this._watchDocshells());
|
||||
}
|
||||
// Ensure replying to attach() request first
|
||||
// before notifying about new docshells.
|
||||
DevToolsUtils.executeSoon(() => this._watchDocshells());
|
||||
|
||||
this._attached = true;
|
||||
},
|
||||
|
|
|
@ -43,8 +43,11 @@ const parentProcessTargetPrototype = extend({}, browsingContextTargetPrototype);
|
|||
*
|
||||
* @param connection DebuggerServerConnection
|
||||
* The connection to the client.
|
||||
* @param window Window object (optional)
|
||||
* If the upper class already knows against which window the actor should attach,
|
||||
* it is passed as a constructor argument here.
|
||||
*/
|
||||
parentProcessTargetPrototype.initialize = function(connection) {
|
||||
parentProcessTargetPrototype.initialize = function(connection, window) {
|
||||
BrowsingContextTargetActor.prototype.initialize.call(this, connection);
|
||||
|
||||
// This creates a Debugger instance for chrome debugging all globals.
|
||||
|
@ -57,7 +60,9 @@ parentProcessTargetPrototype.initialize = function(connection) {
|
|||
this.listenForNewDocShells = true;
|
||||
|
||||
// Defines the default docshell selected for the target actor
|
||||
let window = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
|
||||
if (!window) {
|
||||
window = Services.wm.getMostRecentWindow(DebuggerServer.chromeWindowType);
|
||||
}
|
||||
|
||||
// Default to any available top level window if there is no expected window
|
||||
// (for example when we open firefox with -webide argument)
|
||||
|
@ -68,17 +73,11 @@ parentProcessTargetPrototype.initialize = function(connection) {
|
|||
// We really want _some_ window at least, so fallback to the hidden window if
|
||||
// there's nothing else (such as during early startup).
|
||||
if (!window) {
|
||||
try {
|
||||
window = Services.appShell.hiddenDOMWindow;
|
||||
} catch (e) {
|
||||
// On XPCShell, the above line will throw.
|
||||
}
|
||||
window = Services.appShell.hiddenDOMWindow;
|
||||
}
|
||||
|
||||
// On XPCShell, there is no window/docshell
|
||||
const docShell = window ? window.docShell : null;
|
||||
Object.defineProperty(this, "docShell", {
|
||||
value: docShell,
|
||||
value: window.docShell,
|
||||
configurable: true
|
||||
});
|
||||
};
|
||||
|
|
|
@ -75,10 +75,19 @@ const webExtensionTargetPrototype = extend({}, parentProcessTargetPrototype);
|
|||
* the addonId of the target WebExtension.
|
||||
*/
|
||||
webExtensionTargetPrototype.initialize = function(conn, chromeGlobal, prefix, addonId) {
|
||||
parentProcessTargetPrototype.initialize.call(this, conn);
|
||||
this.id = addonId;
|
||||
|
||||
// Try to discovery an existent extension page to attach (which will provide the initial
|
||||
// URL shown in the window tittle when the addon debugger is opened).
|
||||
let extensionWindow = this._searchForExtensionWindow();
|
||||
if (!extensionWindow) {
|
||||
this._createFallbackWindow();
|
||||
extensionWindow = this.fallbackWindow;
|
||||
}
|
||||
|
||||
parentProcessTargetPrototype.initialize.call(this, conn, extensionWindow);
|
||||
this._chromeGlobal = chromeGlobal;
|
||||
this._prefix = prefix;
|
||||
this.id = addonId;
|
||||
|
||||
// Redefine the messageManager getter to return the chromeGlobal
|
||||
// as the messageManager for this actor (which is the browser XUL
|
||||
|
@ -115,14 +124,6 @@ webExtensionTargetPrototype.initialize = function(conn, chromeGlobal, prefix, ad
|
|||
},
|
||||
shouldAddNewGlobalAsDebuggee: this._shouldAddNewGlobalAsDebuggee.bind(this),
|
||||
});
|
||||
|
||||
// Try to discovery an existent extension page to attach (which will provide the initial
|
||||
// URL shown in the window tittle when the addon debugger is opened).
|
||||
const extensionWindow = this._searchForExtensionWindow();
|
||||
|
||||
if (extensionWindow) {
|
||||
this._setWindow(extensionWindow);
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: This is needed to catch in the webextension webconsole all the
|
||||
|
|
Загрузка…
Ссылка в новой задаче