Backed out 2 changesets (bug 1441133) for build bustage in beta simulations at dom/clients/manager/ClientSource.cpp:402: unused variable 'wp'. a=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 01 Mar 2018 11:55:28 +0200
changeset 460784 0f8f71b0b9d84e7732c07f841e395de516b31b66
parent 460783 714ff834425c99e5521b7b0e3c3c736bf2f34916
child 460785 e33efdb3e1517d521deb949de3fcd6d9946ea440
child 460998 d08b87f6c748bfd9d52e9c0519d8dc1e7b5e2052
child 460999 e3ea96705280635679da1265c022ba8e4b206e1d
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1441133
milestone60.0a1
backs out2758556218659bd0f920974c1078f6dad7ad8b92
7a4546e25adca8da71f683b2f39a78ad42a85453
first release with
nightly linux32
0f8f71b0b9d8 / 60.0a1 / 20180301100139 / files
nightly linux64
0f8f71b0b9d8 / 60.0a1 / 20180301100139 / files
nightly mac
0f8f71b0b9d8 / 60.0a1 / 20180301100139 / files
nightly win32
0f8f71b0b9d8 / 60.0a1 / 20180301100139 / files
nightly win64
0f8f71b0b9d8 / 60.0a1 / 20180301100139 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out 2 changesets (bug 1441133) for build bustage in beta simulations at dom/clients/manager/ClientSource.cpp:402: unused variable 'wp'. a=backout Backed out changeset 275855621865 (bug 1441133) Backed out changeset 7a4546e25adc (bug 1441133)
dom/clients/manager/ClientSource.cpp
dom/serviceworkers/test/browser_storage_permission.js
--- a/dom/clients/manager/ClientSource.cpp
+++ b/dom/clients/manager/ClientSource.cpp
@@ -203,19 +203,17 @@ ClientSource::WorkerExecutionReady(Worke
     return;
   }
 
   // A client without access to storage should never be controlled by
   // a service worker.  Check this here in case we were controlled before
   // execution ready.  We can't reliably determine what our storage policy
   // is before execution ready, unfortunately.
   if (mController.isSome()) {
-    MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate->IsStorageAllowed() ||
-                          StringBeginsWith(aWorkerPrivate->ScriptURL(),
-                                           NS_LITERAL_STRING("blob:")));
+    MOZ_DIAGNOSTIC_ASSERT(aWorkerPrivate->IsStorageAllowed());
   }
 
   // Its safe to store the WorkerPrivate* here because the ClientSource
   // is explicitly destroyed by WorkerPrivate before exiting its run loop.
   MOZ_DIAGNOSTIC_ASSERT(mOwner.is<Nothing>());
   mOwner = AsVariant(aWorkerPrivate);
 
   ClientSourceExecutionReadyArgs args(
@@ -233,46 +231,44 @@ ClientSource::WindowExecutionReady(nsPID
   MOZ_DIAGNOSTIC_ASSERT(aInnerWindow->IsCurrentInnerWindow());
   MOZ_DIAGNOSTIC_ASSERT(aInnerWindow->HasActiveDocument());
 
   if (IsShutdown()) {
     return NS_OK;
   }
 
   nsIDocument* doc = aInnerWindow->GetExtantDoc();
-  NS_ENSURE_TRUE(doc, NS_ERROR_UNEXPECTED);
-
-  nsIURI* uri = doc->GetOriginalURI();
-  NS_ENSURE_TRUE(uri, NS_ERROR_UNEXPECTED);
-
-  // Don't use nsAutoCString here since IPC requires a full nsCString anyway.
-  nsCString spec;
-  nsresult rv = uri->GetSpec(spec);
-  NS_ENSURE_SUCCESS(rv, rv);
+  if (NS_WARN_IF(!doc)) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
   // A client without access to storage should never be controlled by
   // a service worker.  Check this here in case we were controlled before
   // execution ready.  We can't reliably determine what our storage policy
   // is before execution ready, unfortunately.
-  //
-  // Note, explicitly avoid checking storage policy for windows that inherit
-  // service workers from their parent.  If a user opens a controlled window
-  // and then blocks storage, that window will continue to be controlled by
-  // the SW until the window is closed.  Any about:blank or blob URL should
-  // continue to inherit the SW as well.  We need to avoid triggering the
-  // assertion in this corner case.
   if (mController.isSome()) {
-    MOZ_DIAGNOSTIC_ASSERT(spec.LowerCaseEqualsLiteral("about:blank") ||
-                          StringBeginsWith(spec, NS_LITERAL_CSTRING("blob:")) ||
-                          nsContentUtils::StorageAllowedForWindow(aInnerWindow) ==
+    MOZ_DIAGNOSTIC_ASSERT(nsContentUtils::StorageAllowedForWindow(aInnerWindow) ==
                           nsContentUtils::StorageAccess::eAllow);
   }
 
+  // Don't use nsAutoCString here since IPC requires a full nsCString anyway.
+  nsCString spec;
+
+  nsIURI* uri = doc->GetOriginalURI();
+  if (uri) {
+    nsresult rv = uri->GetSpec(spec);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+  }
+
   nsPIDOMWindowOuter* outer = aInnerWindow->GetOuterWindow();
-  NS_ENSURE_TRUE(outer, NS_ERROR_UNEXPECTED);
+  if (NS_WARN_IF(!outer)) {
+    return NS_ERROR_UNEXPECTED;
+  }
 
   FrameType frameType = FrameType::Top_level;
   if (!outer->IsTopLevelWindow()) {
     frameType = FrameType::Nested;
   } else if(outer->HadOriginalOpener()) {
     frameType = FrameType::Auxiliary;
   }
 
@@ -385,29 +381,21 @@ ClientSource::SetController(const Servic
   // A client in private browsing mode should never be controlled by
   // a service worker.  The principal origin attributes should guarantee
   // this invariant.
   MOZ_DIAGNOSTIC_ASSERT(!mClientInfo.IsPrivateBrowsing());
 
   // A client without access to storage should never be controlled a
   // a service worker.  If we are already execution ready with a real
   // window or worker, then verify assert the storage policy is correct.
-  //
-  // Note, explicitly avoid checking storage policy for clients that inherit
-  // service workers from their parent.  This basically means blob: URLs
-  // and about:blank windows.
   if (GetInnerWindow()) {
-    MOZ_DIAGNOSTIC_ASSERT(Info().URL().LowerCaseEqualsLiteral("about:blank") ||
-                          StringBeginsWith(Info().URL(), NS_LITERAL_CSTRING("blob:")) ||
-                          nsContentUtils::StorageAllowedForWindow(GetInnerWindow()) ==
+    MOZ_DIAGNOSTIC_ASSERT(nsContentUtils::StorageAllowedForWindow(GetInnerWindow()) ==
                           nsContentUtils::StorageAccess::eAllow);
-  } else if (WorkerPrivate* wp = GetWorkerPrivate()) {
-    MOZ_DIAGNOSTIC_ASSERT(wp->IsStorageAllowed() ||
-                          StringBeginsWith(wp->ScriptURL(),
-                                           NS_LITERAL_STRING("blob:")));
+  } else if (GetWorkerPrivate()) {
+    MOZ_DIAGNOSTIC_ASSERT(GetWorkerPrivate()->IsStorageAllowed());
   }
 
   if (mController.isSome() && mController.ref() == aServiceWorker) {
     return;
   }
 
   mController.reset();
   mController.emplace(aServiceWorker);
--- a/dom/serviceworkers/test/browser_storage_permission.js
+++ b/dom/serviceworkers/test/browser_storage_permission.js
@@ -90,158 +90,16 @@ add_task(async function test_session_per
   });
 
   is(controller, null, "page should be not controlled with session storage");
 
   await BrowserTestUtils.removeTab(tab);
   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
 });
 
-// Test to verify an about:blank iframe successfully inherits the
-// parent's controller when storage is blocked between opening the
-// parent page and creating the iframe.
-add_task(async function test_block_storage_before_blank_iframe() {
-  Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-
-  let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-  let browser = gBrowser.getBrowserForTab(tab);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  let controller = await ContentTask.spawn(browser, null, async function() {
-    return content.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller, "page should be controlled with storage allowed");
-
-  let controller2 = await ContentTask.spawn(browser, null, async function() {
-    let f = content.document.createElement("iframe");
-    content.document.body.appendChild(f);
-    await new Promise(resolve => f.onload = resolve);
-    return !!f.contentWindow.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller2, "page should be controlled with storage allowed");
-
-  await SpecialPowers.pushPrefEnv({"set": [
-    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT],
-  ]});
-
-  let controller3 = await ContentTask.spawn(browser, null, async function() {
-    let f = content.document.createElement("iframe");
-    content.document.body.appendChild(f);
-    await new Promise(resolve => f.onload = resolve);
-    return !!f.contentWindow.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller3, "page should be controlled with storage allowed");
-
-  await SpecialPowers.popPrefEnv();
-  await BrowserTestUtils.removeTab(tab);
-});
-
-// Test to verify a blob URL iframe successfully inherits the
-// parent's controller when storage is blocked between opening the
-// parent page and creating the iframe.
-add_task(async function test_block_storage_before_blob_iframe() {
-  Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-
-  let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-  let browser = gBrowser.getBrowserForTab(tab);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  let controller = await ContentTask.spawn(browser, null, async function() {
-    return content.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller, "page should be controlled with storage allowed");
-
-  let controller2 = await ContentTask.spawn(browser, null, async function() {
-    let b = new content.Blob(["<!DOCTYPE html><html></html>"], { type: "text/html" });
-    let f = content.document.createElement("iframe");
-    // No need to call revokeObjectURL() since the window will be closed shortly.
-    f.src = content.URL.createObjectURL(b);
-    content.document.body.appendChild(f);
-    await new Promise(resolve => f.onload = resolve);
-    return !!f.contentWindow.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller2, "page should be controlled with storage allowed");
-
-  await SpecialPowers.pushPrefEnv({"set": [
-    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT],
-  ]});
-
-  let controller3 = await ContentTask.spawn(browser, null, async function() {
-    let b = new content.Blob(["<!DOCTYPE html><html></html>"], { type: "text/html" });
-    let f = content.document.createElement("iframe");
-    // No need to call revokeObjectURL() since the window will be closed shortly.
-    f.src = content.URL.createObjectURL(b);
-    content.document.body.appendChild(f);
-    await new Promise(resolve => f.onload = resolve);
-    return !!f.contentWindow.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller3, "page should be controlled with storage allowed");
-
-  await SpecialPowers.popPrefEnv();
-  await BrowserTestUtils.removeTab(tab);
-});
-
-// Test to verify a blob worker script does not hit our service
-// worker storage assertions when storage is blocked between opening
-// the parent page and creating the worker.  Note, we cannot
-// explicitly check if the worker is controlled since we don't expose
-// WorkerNavigator.serviceWorkers.controller yet.
-add_task(async function test_block_storage_before_blob_worker() {
-  Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
-
-  let tab = BrowserTestUtils.addTab(gBrowser, SCOPE);
-  let browser = gBrowser.getBrowserForTab(tab);
-  await BrowserTestUtils.browserLoaded(browser);
-
-  let controller = await ContentTask.spawn(browser, null, async function() {
-    return content.navigator.serviceWorker.controller;
-  });
-
-  ok(!!controller, "page should be controlled with storage allowed");
-
-  let scriptURL = await ContentTask.spawn(browser, null, async function() {
-    let b = new content.Blob(["self.postMessage(self.location.href);self.close()"],
-                             { type: "application/javascript" });
-    // No need to call revokeObjectURL() since the window will be closed shortly.
-    let u = content.URL.createObjectURL(b);
-    let w = new content.Worker(u);
-    return await new Promise(resolve => {
-      w.onmessage = e => resolve(e.data);
-    });
-  });
-
-  ok(scriptURL.startsWith("blob:"), "blob URL worker should run");
-
-  await SpecialPowers.pushPrefEnv({"set": [
-    ["network.cookie.cookieBehavior", Ci.nsICookieService.BEHAVIOR_REJECT],
-  ]});
-
-  let scriptURL2 = await ContentTask.spawn(browser, null, async function() {
-    let b = new content.Blob(["self.postMessage(self.location.href);self.close()"],
-                             { type: "application/javascript" });
-    // No need to call revokeObjectURL() since the window will be closed shortly.
-    let u = content.URL.createObjectURL(b);
-    let w = new content.Worker(u);
-    return await new Promise(resolve => {
-      w.onmessage = e => resolve(e.data);
-    });
-  });
-
-  ok(scriptURL2.startsWith("blob:"), "blob URL worker should run");
-
-  await SpecialPowers.popPrefEnv();
-  await BrowserTestUtils.removeTab(tab);
-});
-
 add_task(async function cleanup() {
   Services.perms.remove(Services.io.newURI(PAGE_URI), "cookie");
 
   let tab = BrowserTestUtils.addTab(gBrowser, PAGE_URI);
   let browser = gBrowser.getBrowserForTab(tab);
   await BrowserTestUtils.browserLoaded(browser);
 
   await ContentTask.spawn(browser, SCOPE, async function(uri) {