Bug 1285326 - Remove custom check in CheckUserContextCompatibility for UCI == 0 in nsWindowWatcher, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Sun, 10 Jul 2016 08:08:39 +0200
changeset 344436 1432b1e6d1ade9b3cdbd03caf5f1602740ab6a10
parent 344435 1421386af3ccdaf2142fcbe1de57f83f5cf34598
child 344437 b5ec1de16b8155a721f9fbd6eb9dd13d9f0c3b11
push id6389
push userraliiev@mozilla.com
push dateMon, 19 Sep 2016 13:38:22 +0000
treeherdermozilla-beta@01d67bfe6c81 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1285326
milestone50.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 1285326 - Remove custom check in CheckUserContextCompatibility for UCI == 0 in nsWindowWatcher, r=smaug
embedding/components/windowwatcher/nsWindowWatcher.cpp
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp
@@ -449,36 +449,33 @@ nsWindowWatcher::OpenWindow2(mozIDOMWind
   return OpenWindowInternal(aParent, aUrl, aName, aFeatures,
                             aCalledFromScript, dialog,
                             aNavigate, aOpeningTab, argv,
                             aOptionalArgc >= 1 ? &aOpenerFullZoom : nullptr,
                             aResult);
 }
 
 // This static function checks if the aDocShell uses an UserContextId equal to
-// nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID or equal to the
-// userContextId of subjectPrincipal, if not null.
+// the userContextId of subjectPrincipal, if not null.
 static bool
 CheckUserContextCompatibility(nsIDocShell* aDocShell)
 {
   MOZ_ASSERT(aDocShell);
 
   uint32_t userContextId =
     static_cast<nsDocShell*>(aDocShell)->GetOriginAttributes().mUserContextId;
 
-  if (userContextId == nsIScriptSecurityManager::DEFAULT_USER_CONTEXT_ID) {
-    return true;
-  }
-
   nsCOMPtr<nsIPrincipal> subjectPrincipal =
     nsContentUtils::GetCurrentJSContext()
       ? nsContentUtils::SubjectPrincipal() : nullptr;
 
+  // If we don't have a valid principal, probably we are in e10s mode, parent
+  // side.
   if (!subjectPrincipal) {
-    return false;
+    return true;
   }
 
   // DocShell can have UsercontextID set but loading a document with system
   // principal. In this case, we consider everything ok.
   if (nsContentUtils::IsSystemPrincipal(subjectPrincipal)) {
     return true;
   }