Bug 1425975 P12 Don't mark an initial about:blank client as controlled if its sandboxed. r=asuth
☠☠ backed out by 2e0db1b48499 ☠ ☠
authorBen Kelly <ben@wanderview.com>
Fri, 22 Dec 2017 21:09:20 -0500
changeset 449133 9e1544ec814d46dcf8a771a221f3ac1349663497
parent 449132 0e50d9d1d06961d9866e1c34bec7b97839bb5834
child 449134 1e657fa97b71a183c521c65e8078d928580bc849
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersasuth
bugs1425975
milestone59.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 1425975 P12 Don't mark an initial about:blank client as controlled if its sandboxed. r=asuth
docshell/base/nsDocShell.cpp
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -3413,17 +3413,17 @@ nsDocShell::MaybeCreateInitialClientSour
   // when DoChannelLoad() is called before CreateAboutBlankContentViewer.
   if (mInitialClientSource) {
     return;
   }
 
   // Don't pre-allocate the client when we are sandboxed.  The inherited
   // principal does not take sandboxing into account.
   // TODO: Refactor sandboxing principal code out so we can use it here.
-  if (!aPrincipal && (mSandboxFlags & SANDBOXED_ORIGIN)) {
+  if (!aPrincipal && mSandboxFlags) {
     return;
   }
 
   nsIPrincipal* principal = aPrincipal ? aPrincipal
                                        : GetInheritedPrincipal(false);
 
   // Sometimes there is no principal available when we are called from
   // CreateAboutBlankContentViewer.  For example, sometimes the principal
@@ -3455,18 +3455,21 @@ nsDocShell::MaybeCreateInitialClientSour
   nsCOMPtr<nsIDocShell> parent = GetParentDocshell();
   nsPIDOMWindowOuter* parentOuter = parent ? parent->GetWindow() : nullptr;
   nsPIDOMWindowInner* parentInner =
     parentOuter ? parentOuter->GetCurrentInnerWindow() : nullptr;
   if (!parentInner) {
     return;
   }
 
+  // We're done if there is no parent controller.  Also, don't inherit
+  // the controller if we're sandboxed.  This matches our behavior in
+  // ShouldPrepareForIntercept(),
   Maybe<ServiceWorkerDescriptor> controller(parentInner->GetController());
-  if (controller.isNothing()) {
+  if (controller.isNothing() || mSandboxFlags) {
     return;
   }
 
   nsCOMPtr<nsIServiceWorkerManager> swm = mozilla::services::GetServiceWorkerManager();
   if (!swm) {
     return;
   }