Bug 1390431 - Port bug 1377580 to TB: Provide nsIBrowserDOMWindow.createContentWindow. r=aceman
authorJorg K <jorgk@jorgk.com>
Wed, 16 Aug 2017 08:28:25 +0200
changeset 29559 90afaded37d57dbb8974836884209c522af63b9c
parent 29558 dfa8c31dafd85b1a429dea33d47016955a17612a
child 29560 08c99aaee2b8f62ef4c043ffec590950d6bfc29d
push id378
push userclokep@gmail.com
push dateMon, 13 Nov 2017 18:45:35 +0000
reviewersaceman
bugs1390431, 1377580
Bug 1390431 - Port bug 1377580 to TB: Provide nsIBrowserDOMWindow.createContentWindow. r=aceman
mail/base/content/mailWindow.js
--- a/mail/base/content/mailWindow.js
+++ b/mail/base/content/mailWindow.js
@@ -644,17 +644,33 @@ function InformUserOfCertError(socketInf
                   '','chrome,centerscreen,modal', params);
 }
 
 function nsBrowserAccess() { }
 
 nsBrowserAccess.prototype = {
   QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIBrowserDOMWindow]),
 
+  // The following function may be called during account creation, it is called by
+  // the Mozmill test test-newmailaccount.js::test_window_open_link_opening_behaviour.
+  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) {
     const nsIBrowserDOMWindow = Components.interfaces.nsIBrowserDOMWindow;
     let isExternal = !!(aFlags & nsIBrowserDOMWindow.OPEN_EXTERNAL);
     if (isExternal && aURI && aURI.schemeIs("chrome")) {
       Services.console.logStringMessage("use -chrome command-line option to load external chrome urls\n");
       return null;
     }
 
     let newWindow = null;