Bug 1278763 - Part 1: Add a PopupNotifications backend on the RDM browser, r=jryans
authorBenoit Chabod <bchabod@mozilla.com>
Wed, 10 Aug 2016 17:11:35 -0700
changeset 399637 356bb4c55f4dde7fae5f814208e1344ed74f20bd
parent 399636 deb1fab4b247d5cfec5654e6892c9407fdf21f99
child 399638 c4a79e57209adab8f38ca9ea9da8317bf748235a
push id25905
push userdtownsend@mozilla.com
push dateThu, 11 Aug 2016 17:57:58 +0000
reviewersjryans
bugs1278763
milestone51.0a1
Bug 1278763 - Part 1: Add a PopupNotifications backend on the RDM browser, r=jryans
devtools/client/responsive.html/browser/tunnel.js
--- a/devtools/client/responsive.html/browser/tunnel.js
+++ b/devtools/client/responsive.html/browser/tunnel.js
@@ -175,16 +175,26 @@ function tunnelToInnerBrowser(outer, inn
         enumerable: true,
       });
 
       // Wants to access the content's `frameLoader`, so we'll redirect it to
       // inner browser.
       outer.setDocShellIsActiveAndForeground = value => {
         inner.frameLoader.tabParent.setDocShellIsActiveAndForeground(value);
       };
+
+      // Make the PopupNotifications object available on the iframe's owner
+      // This is used for permission doorhangers
+      Object.defineProperty(inner.ownerGlobal, "PopupNotifications", {
+        get() {
+          return outer.ownerGlobal.PopupNotifications;
+        },
+        configurable: true,
+        enumerable: true,
+      });
     }),
 
     stop() {
       let tab = gBrowser.getTabForBrowser(outer);
       let filteredProgressListener = gBrowser._tabFilters.get(tab);
       browserWindow = null;
       gBrowser = null;
 
@@ -205,16 +215,19 @@ function tunnelToInnerBrowser(outer, inn
       // Reset overridden XBL properties and methods.  Deleting the override
       // means it will fallback to the original XBL binding definitions which
       // are on the prototype.
       delete outer.isRemoteBrowser;
       delete outer.hasContentOpener;
       delete outer.docShellIsActive;
       delete outer.setDocShellIsActiveAndForeground;
 
+      // Delete the PopupNotifications getter added for permission doorhangers
+      delete inner.ownerGlobal.PopupNotifications;
+
       mmTunnel.destroy();
       mmTunnel = null;
 
       // Invalidate outer's permanentKey so that SessionStore stops associating
       // things that happen to the outer browser with the content inside in the
       // inner browser.
       outer.permanentKey = { id: "zombie" };
     },