Bug 1390431 - Port bug 1377580 to SM: Provide nsIBrowserDOMWindow.createContentWindow. r=frg
authorJorg K <jorgk@jorgk.com>
Wed, 16 Aug 2017 08:28:52 +0200
changeset 29560 08c99aaee2b8f62ef4c043ffec590950d6bfc29d
parent 29559 90afaded37d57dbb8974836884209c522af63b9c
child 29561 06665e6b5cfadd6e1b4d30562a4d66a7f3de4bc0
push id378
push userclokep@gmail.com
push dateMon, 13 Nov 2017 18:45:35 +0000
reviewersfrg
bugs1390431, 1377580
Bug 1390431 - Port bug 1377580 to SM: Provide nsIBrowserDOMWindow.createContentWindow. r=frg
suite/browser/navigator.js
--- a/suite/browser/navigator.js
+++ b/suite/browser/navigator.js
@@ -341,19 +341,31 @@ function UpdateBackForwardButtons()
 
 const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
 const nsIInterfaceRequestor = Components.interfaces.nsIInterfaceRequestor;
 
 function nsBrowserAccess() {
 }
 
 nsBrowserAccess.prototype = {
-
-  openURI: function openURI(aURI, aOpener, aWhere, aFlags) {
-
+  createContentWindow(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
+    return this.getContentWindowOrOpenURI(null, aOpener, aWhere, aFlags,
+                                          aTriggeringPrincipal);
+  },
+
+  openURI: function (aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal = null) {
+    if (!aURI) {
+      Components.utils.reportError("openURI should only be called with a valid URI");
+      throw Components.results.NS_ERROR_FAILURE;
+    }
+    return this.getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags,
+                                          aTriggeringPrincipal);
+  },
+
+  getContentWindowOrOpenURI(aURI, aOpener, aWhere, aFlags, aTriggeringPrincipal) {
     var isExternal = !!(aFlags & nsIBrowserDOMWindow.OPEN_EXTERNAL);
 
     if (aOpener && isExternal) {
       Components.utils.reportError("nsBrowserAccess.openURI did not expect an opener to be " +
                                    "passed if the context is OPEN_EXTERNAL.");
       throw Components.results.NS_ERROR_FAILURE;
     }