Bug 1287007 - Remove dead code
MozReview-Commit-ID: LtuKY5DjB68
--- a/toolkit/components/extensions/ExtensionChild.jsm
+++ b/toolkit/components/extensions/ExtensionChild.jsm
@@ -185,19 +185,17 @@ class ExtensionContext extends BaseConte
let chromeObj = Cu.createObjectIn(contentWindow, {defineAs: "chrome"});
Schemas.inject(browserObj, this.childManager);
Schemas.inject(chromeObj, chromeApiWrapper);
if (viewType == "background") {
apiManager.global.initializeBackgroundPage(contentWindow);
}
- if (this.externallyVisible) {
- this.extension.views.add(this);
- }
+ this.extension.views.add(this);
}
get cloneScope() {
return this.contentWindow;
}
get principal() {
return this.contentWindow.document.nodePrincipal;
@@ -205,20 +203,16 @@ class ExtensionContext extends BaseConte
get windowId() {
if (this.viewType == "tab" || this.viewType == "popup") {
let globalView = ExtensionChild.contentGlobals.get(this.messageManager);
return globalView ? globalView.windowId : -1;
}
}
- get externallyVisible() {
- return true;
- }
-
// Called when the extension shuts down.
shutdown() {
this.unload();
}
// This method is called when an extension page navigates away or
// its tab is closed.
unload() {
@@ -226,20 +220,17 @@ class ExtensionContext extends BaseConte
// multiple times for tab pages closed by the "page-unload" handlers
// triggered below.
if (this.unloaded) {
return;
}
super.unload();
this.childManager.close();
-
- if (this.externallyVisible) {
- this.extension.views.delete(this);
- }
+ this.extension.views.delete(this);
}
}
// All subframes in a tab, background page, popup, etc. have the same view type.
// This class keeps track of such global state.
// Note that this is created even for non-extension tabs because at present we
// do not have a way to distinguish regular tabs from extension tabs at the
// initialization of a frame script.
--- a/toolkit/components/extensions/ext-backgroundPage.js
+++ b/toolkit/components/extensions/ext-backgroundPage.js
@@ -21,20 +21,18 @@ const XUL_URL = "data:application/vnd.mo
// WeakMap[Extension -> BackgroundPage]
var backgroundPagesMap = new WeakMap();
// Responsible for the background_page section of the manifest.
function BackgroundPage(options, extension) {
this.extension = extension;
this.page = options.page || null;
this.isGenerated = !!options.scripts;
- this.contentWindow = null;
this.windowlessBrowser = null;
this.webNav = null;
- this.context = null;
}
BackgroundPage.prototype = {
build: Task.async(function* () {
let windowlessBrowser = Services.appShell.createWindowlessBrowser(true);
this.windowlessBrowser = windowlessBrowser;
let url;
@@ -86,20 +84,19 @@ BackgroundPage.prototype = {
yield new Promise(resolve => {
browser.messageManager.addMessageListener("Extension:ExtensionViewLoaded", function onLoad() {
browser.messageManager.removeMessageListener("Extension:ExtensionViewLoaded", onLoad);
resolve();
});
});
+ // TODO(robwu): This is not webext-oop compatible.
this.webNav = browser.docShell.QueryInterface(Ci.nsIWebNavigation);
-
let window = this.webNav.document.defaultView;
- this.contentWindow = window;
// Set the add-on's main debugger global, for use in the debugger
// console.
if (this.extension.addonData.instanceID) {
AddonManager.getAddonByInstanceID(this.extension.addonData.instanceID)
.then(addon => addon.setDebugGlobal(window));
}