Bug 1195881 - Pass userContext through NeckoParent and TabChild. r=tanvi, r=sicking
☠☠ backed out by 312ccc646df3 ☠ ☠
authorKate McKinley <kmckinley@mozilla.com>
Thu, 07 Jan 2016 10:51:04 -0800
changeset 279076 194d7968bf593a6fdcc7ee0df2490898a11bc083
parent 279075 7ccd9c22dd043894f11aee24805a00f104ed1701
child 279077 0324a62e156caa54ceb2339f8fe84c6215682fa9
push id29867
push usercbook@mozilla.com
push dateFri, 08 Jan 2016 11:00:43 +0000
treeherdermozilla-central@1424cdfc075d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstanvi, sicking
bugs1195881
milestone46.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 1195881 - Pass userContext through NeckoParent and TabChild. r=tanvi, r=sicking
dom/ipc/TabChild.cpp
netwerk/ipc/NeckoParent.cpp
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -830,17 +830,20 @@ TabChild::NotifyTabContextUpdated()
     if (docShell) {
         // nsDocShell will do the right thing if we pass NO_APP_ID or
         // UNKNOWN_APP_ID for aOwnOrContainingAppId.
         if (IsBrowserElement()) {
           docShell->SetIsBrowserInsideApp(BrowserOwnerAppId());
         } else {
           docShell->SetIsApp(OwnAppId());
         }
-        docShell->SetIsSignedPackage(OriginAttributesRef().mSignedPkg);
+
+        OriginAttributes attrs = OriginAttributesRef();
+        docShell->SetIsSignedPackage(attrs.mSignedPkg);
+        docShell->SetUserContextId(attrs.mUserContextId);
     }
 }
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TabChild)
   NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome)
   NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChrome2)
   NS_INTERFACE_MAP_ENTRY(nsIEmbeddingSiteWindow)
   NS_INTERFACE_MAP_ENTRY(nsIWebBrowserChromeFocus)
--- a/netwerk/ipc/NeckoParent.cpp
+++ b/netwerk/ipc/NeckoParent.cpp
@@ -140,22 +140,30 @@ NeckoParent::GetValidatedAppInfo(const S
       if (UsingNeckoIPCSecurity() && tabContext.IsBrowserElement()) {
         // <iframe mozbrowser> which doesn't have an <iframe mozapp> above it.
         // This is not supported now, and we'll need to do a code audit to make
         // sure we can handle it (i.e don't short-circuit using separate
         // namespace if just appID==0)
         continue;
       }
     }
+
     if (!aSerialized.mOriginAttributes.mSignedPkg.IsEmpty() &&
         aSerialized.mOriginAttributes.mSignedPkg != tabContext.OriginAttributesRef().mSignedPkg) {
       continue;
     }
-    aAttrs = DocShellOriginAttributes(appId, inBrowserElement);
-    aAttrs.mSignedPkg = tabContext.OriginAttributesRef().mSignedPkg;
+    if (aSerialized.mOriginAttributes.mUserContextId != tabContext.OriginAttributesRef().mUserContextId) {
+      continue;
+    }
+    aAttrs = DocShellOriginAttributes();
+    aAttrs.mAppId = appId;
+    aAttrs.mInBrowser = inBrowserElement;
+    aAttrs.mSignedPkg = aSerialized.mOriginAttributes.mSignedPkg;
+    aAttrs.mUserContextId = aSerialized.mOriginAttributes.mUserContextId;
+
     return nullptr;
   }
 
   if (contextArray.Length() != 0) {
     return "App does not have permission";
   }
 
   if (!UsingNeckoIPCSecurity()) {