Backed out changeset f4f59e7c1be7 (bug 1337543) for crashing in various mochitest and web-platform-tests, e.g. dom/security/test/csp/test_child-src_worker.html. r=backout on a CLOSED TREE
authorSebastian Hengst <archaeopteryx@coole-files.de>
Mon, 13 Feb 2017 19:00:56 +0100
changeset 342535 b7e8623021571bb3ad198c77a1ca88df7a2de46e
parent 342534 f1dbf0447becd4026c2372322056bda6faf5eef6
child 342536 76c26eaf4f183ed3653861da7fb8f354566a5f0f
push id86897
push userarchaeopteryx@coole-files.de
push dateMon, 13 Feb 2017 18:01:23 +0000
treeherdermozilla-inbound@b7e862302157 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1337543
milestone54.0a1
backs outf4f59e7c1be7cf802659a490d201c3fe91c241d3
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
Backed out changeset f4f59e7c1be7 (bug 1337543) for crashing in various mochitest and web-platform-tests, e.g. dom/security/test/csp/test_child-src_worker.html. r=backout on a CLOSED TREE
dom/workers/ServiceWorkerPrivate.cpp
--- a/dom/workers/ServiceWorkerPrivate.cpp
+++ b/dom/workers/ServiceWorkerPrivate.cpp
@@ -1738,33 +1738,33 @@ ServiceWorkerPrivate::SpawnWorkerIfNeede
 
   info.mPrincipal = mInfo->GetPrincipal();
 
   nsContentUtils::StorageAccess access =
     nsContentUtils::StorageAllowedForPrincipal(info.mPrincipal);
   info.mStorageAllowed = access > nsContentUtils::StorageAccess::ePrivateBrowsing;
   info.mOriginAttributes = mInfo->GetOriginAttributes();
 
-  // The ServiceWorkerRegistration principal should never have any CSP
-  // set.  The CSP from the page that registered the SW should not be
-  // inherited.  Verify this is the case in non-release builds
-#if defined(DEBUG) || !defined(RELEASE_OR_BETA)
   nsCOMPtr<nsIContentSecurityPolicy> csp;
   rv = info.mPrincipal->GetCsp(getter_AddRefs(csp));
   if (NS_WARN_IF(NS_FAILED(rv))) {
     return rv;
   }
 
-  MOZ_DIAGNOSTIC_ASSERT(!csp);
-#endif
-
-  // Default CSP permissions for now.  These will be overrided if necessary
-  // based on the script CSP headers during load in ScriptLoader.
-  info.mEvalAllowed = true;
-  info.mReportCSPViolations = false;
+  info.mCSP = csp;
+  if (info.mCSP) {
+    rv = info.mCSP->GetAllowsEval(&info.mReportCSPViolations,
+                                  &info.mEvalAllowed);
+    if (NS_WARN_IF(NS_FAILED(rv))) {
+      return rv;
+    }
+  } else {
+    info.mEvalAllowed = true;
+    info.mReportCSPViolations = false;
+  }
 
   WorkerPrivate::OverrideLoadInfoLoadGroup(info);
 
   AutoJSAPI jsapi;
   jsapi.Init();
   ErrorResult error;
   NS_ConvertUTF8toUTF16 scriptSpec(mInfo->ScriptSpec());