Bug 1394596 - Support window.open(undefined, undefined, "noopener") in the child process, r=smaug
authorMichael Layzell <michael@thelayzells.com>
Tue, 29 Aug 2017 11:19:48 -0400
changeset 377415 37d36d464b46a64a7af96771f7db7f62e1c7ef9a
parent 377414 2c46386c1b197b7638a23aad37e2558ab7af360d
child 377416 eeb9b3c58699e054ce6cab63857098cf8ff94067
push id94284
push usermichael@thelayzells.com
push dateTue, 29 Aug 2017 17:23:44 +0000
treeherdermozilla-inbound@2af34cba4d4c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1394596
milestone57.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 1394596 - Support window.open(undefined, undefined, "noopener") in the child process, r=smaug
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/ipc/ContentParent.h
dom/ipc/PContent.ipdl
dom/tests/browser/browser.ini
dom/tests/browser/browser_noopener_null_uri.js
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -812,17 +812,17 @@ ContentChild::ProvideWindowCommon(TabChi
     float fullZoom;
     nsCOMPtr<nsIPrincipal> triggeringPrincipal;
     rv = GetWindowParamsFromParent(aParent, baseURIString, &fullZoom,
                                    getter_AddRefs(triggeringPrincipal));
     if (NS_WARN_IF(NS_FAILED(rv))) {
       return rv;
     }
 
-    URIParams uriToLoad;
+    OptionalURIParams uriToLoad;
     SerializeURI(aURI, uriToLoad);
     Unused << SendCreateWindowInDifferentProcess(aTabOpener,
                                                  aChromeFlags,
                                                  aCalledFromJS,
                                                  aPositionSpecified,
                                                  aSizeSpecified,
                                                  uriToLoad,
                                                  features,
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -4824,17 +4824,17 @@ ContentParent::RecvCreateWindow(PBrowser
 
 mozilla::ipc::IPCResult
 ContentParent::RecvCreateWindowInDifferentProcess(
   PBrowserParent* aThisTab,
   const uint32_t& aChromeFlags,
   const bool& aCalledFromJS,
   const bool& aPositionSpecified,
   const bool& aSizeSpecified,
-  const URIParams& aURIToLoad,
+  const OptionalURIParams& aURIToLoad,
   const nsCString& aFeatures,
   const nsCString& aBaseURI,
   const float& aFullZoom,
   const nsString& aName,
   const IPC::Principal& aTriggeringPrincipal)
 {
   nsCOMPtr<nsITabParent> newRemoteTab;
   bool windowIsNew;
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -536,17 +536,17 @@ public:
                    CreateWindowResolver&& aResolve) override;
 
   virtual mozilla::ipc::IPCResult RecvCreateWindowInDifferentProcess(
     PBrowserParent* aThisTab,
     const uint32_t& aChromeFlags,
     const bool& aCalledFromJS,
     const bool& aPositionSpecified,
     const bool& aSizeSpecified,
-    const URIParams& aURIToLoad,
+    const OptionalURIParams& aURIToLoad,
     const nsCString& aFeatures,
     const nsCString& aBaseURI,
     const float& aFullZoom,
     const nsString& aName,
     const IPC::Principal& aTriggeringPrincipal) override;
 
   static bool AllocateLayerTreeId(TabParent* aTabParent, uint64_t* aId);
 
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -1026,17 +1026,17 @@ parent:
         returns (CreatedWindowInfo window);
 
     async CreateWindowInDifferentProcess(
       PBrowser aThisTab,
       uint32_t aChromeFlags,
       bool aCalledFromJS,
       bool aPositionSpecified,
       bool aSizeSpecified,
-      URIParams aURIToLoad,
+      OptionalURIParams aURIToLoad,
       nsCString aFeatures,
       nsCString aBaseURI,
       float aFullZoom,
       nsString aName,
       Principal aTriggeringPrincipal);
 
     sync GetAndroidSystemInfo()
         returns (AndroidSystemInfo info);
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -72,8 +72,9 @@ support-files =
 support-files =
   prerender.html
   prerender_target.html
 skip-if = true || !e10s # Prerendering requires e10s, turned off for e10s-multi Bug 1315042
 [browser_noopener.js]
 support-files =
   test_noopener_source.html
   test_noopener_target.html
+[browser_noopener_null_uri.js]
new file mode 100644
--- /dev/null
+++ b/dom/tests/browser/browser_noopener_null_uri.js
@@ -0,0 +1,12 @@
+add_task(async function browserNoopenerNullUri() {
+  await BrowserTestUtils.withNewTab({gBrowser}, async function(aBrowser) {
+    let waitFor = BrowserTestUtils.waitForNewWindow();
+    await ContentTask.spawn(aBrowser, null, async () => {
+      ok(!content.window.open(undefined, undefined, 'noopener'),
+         "window.open should return null");
+    });
+    let win = await waitFor;
+    ok(win, "We successfully opened a new window in the content process!");
+    await BrowserTestUtils.closeWindow(win);
+  });
+});