Bug 1287007 - Remove dead code r=billm
authorRob Wu <rob@robwu.nl>
Tue, 06 Sep 2016 15:50:50 -0700
changeset 319122 37414d1fd5efe1e5771d50f23f0797fdc967ac3c
parent 319121 f9da44ff592d2a570c2f501b9e8588351d105aee
child 319123 817299c12d6d608a2e5c6a2badc2f952414e43ab
push id30861
push usercbook@mozilla.com
push dateMon, 24 Oct 2016 14:54:01 +0000
treeherdermozilla-central@08efaee1d568 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm
bugs1287007
milestone52.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1287007 - Remove dead code r=billm MozReview-Commit-ID: LtuKY5DjB68
toolkit/components/extensions/ExtensionChild.jsm
toolkit/components/extensions/ext-backgroundPage.js
--- 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));
     }