Bug 1300817 - Avoid inheriting the origin attributes of the subject principal if it's expanded; r=bzbarsky
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 07 Sep 2016 13:07:27 -0400
changeset 313055 fdfb1d87051b55aafb9ff6e3ea8482a527402191
parent 313054 9330dc01ec0245f05311c56025a50705138351bc
child 313056 14593086470494abab1401eba9304defa715170e
push id81535
push usereakhgari@mozilla.com
push dateWed, 07 Sep 2016 22:28:47 +0000
treeherdermozilla-inbound@fdfb1d87051b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs1300817
milestone51.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 1300817 - Avoid inheriting the origin attributes of the subject principal if it's expanded; r=bzbarsky
embedding/components/windowwatcher/nsWindowWatcher.cpp
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp
@@ -1106,18 +1106,19 @@ nsWindowWatcher::OpenWindowInternal(mozI
   nsCOMPtr<nsIPrincipal> subjectPrincipal =
     nsContentUtils::GetCurrentJSContext() ? nsContentUtils::SubjectPrincipal() :
                                             nullptr;
 
   if (windowIsNew) {
     auto* docShell = static_cast<nsDocShell*>(newDocShell.get());
 
     // If this is not a chrome docShell, we apply originAttributes from the
-    // subjectPrincipal.
+    // subjectPrincipal unless if it's an expanded principal.
     if (subjectPrincipal &&
+        !subjectPrincipal->GetIsExpandedPrincipal() &&
         docShell->ItemType() != nsIDocShellTreeItem::typeChrome) {
       DocShellOriginAttributes attrs;
       attrs.InheritFromDocToChildDocShell(BasePrincipal::Cast(subjectPrincipal)->OriginAttributesRef());
 
       docShell->SetOriginAttributes(attrs);
     }
 
     // Now set the opener principal on the new window.  Note that we need to do