mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-01 05:48:26 +00:00
merge b2g-inbound to mozilla-central a=merge
This commit is contained in:
commit
2deb7b2220
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
@ -122,7 +122,7 @@
|
||||
<project name="platform/system/media" path="system/media" revision="c1332c21c608f4932a6d7e83450411cde53315ef"/>
|
||||
<default remote="caf" revision="LNX.LA.3.5.2.1.1" sync-j="4"/>
|
||||
<!-- Platform common things -->
|
||||
<project name="device-shinano-common" path="device/sony/shinano-common" remote="b2g" revision="df3d2ae4345ca5d32bce717bb7b3dac18a3afa18"/>
|
||||
<project name="device-shinano-common" path="device/sony/shinano-common" remote="b2g" revision="2f09386bb130b0111219cfc830316797392d48b0"/>
|
||||
<project name="device/generic/armv7-a-neon" path="device/generic/armv7-a-neon" revision="1bb28abbc215f45220620af5cd60a8ac1be93722"/>
|
||||
<project name="device/qcom/common" path="device/qcom/common" revision="2501e5940ba69ece7654ff85611c76ae5bda299c"/>
|
||||
<project name="codeaurora_kernel_msm" path="kernel" remote="b2g" revision="d620691cad7aee780018e98159ff03bf99840317"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
|
||||
|
@ -17,7 +17,7 @@
|
||||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -19,7 +19,7 @@
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="27eb2f04e149fc2c9976d881b1b5984bbe7ee089"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"git": {
|
||||
"git_revision": "285486b417f1cb8316b19c0698a6655fc053fbd6",
|
||||
"git_revision": "01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "79e34061945d4b9d3cefc2f2d8ec895b05323dd4",
|
||||
"revision": "d7e928f87e2cc34121db52e65f2eeb7598a01412",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="8d83715f08b7849f16a0dfc88f78d5c3a89c0a54">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
|
@ -18,7 +18,7 @@
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="828317e64d28138f24d578ab340c2a0ff8552df0"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="f004530b30a63c08a16d82536858600446b2abf5"/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<project name="platform_build" path="build" remote="b2g" revision="c9d4fe680662ee44a4bdea42ae00366f5df399cf">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="285486b417f1cb8316b19c0698a6655fc053fbd6"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="01ffe82cf088ca8fda9fe6783dc5cad2c3dde01c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="fake-qemu-kernel" path="prebuilts/qemu-kernel" remote="b2g" revision="939b377d55a2f081d94029a30a75d05e5a20daf3"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="9465d16f95ab87636b2ae07538ee88e5aeff2d7d"/>
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
#include "nsDocShell.h"
|
||||
#include "nsIAddonPolicyService.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
@ -27,6 +28,28 @@ namespace mozilla {
|
||||
|
||||
using dom::URLParams;
|
||||
|
||||
void OriginAttributes::InheritFromDocShellParent(const OriginAttributes& aParent)
|
||||
{
|
||||
mAppId = aParent.mAppId;
|
||||
mInBrowser = aParent.mInBrowser;
|
||||
mUserContextId = aParent.mUserContextId;
|
||||
mSignedPkg = aParent.mSignedPkg;
|
||||
}
|
||||
|
||||
bool OriginAttributes::CopyFromLoadContext(nsILoadContext* aLoadContext)
|
||||
{
|
||||
OriginAttributes attrs;
|
||||
bool result = aLoadContext->GetOriginAttributes(attrs);
|
||||
NS_ENSURE_TRUE(result, false);
|
||||
|
||||
mAppId = attrs.mAppId;
|
||||
mInBrowser = attrs.mInBrowser;
|
||||
mAddonId = attrs.mAddonId;
|
||||
mUserContextId = attrs.mUserContextId;
|
||||
mSignedPkg = attrs.mSignedPkg;
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
OriginAttributes::CreateSuffix(nsACString& aStr) const
|
||||
{
|
||||
@ -372,7 +395,7 @@ BasePrincipal::GetUnknownAppId(bool* aUnknownAppId)
|
||||
}
|
||||
|
||||
already_AddRefed<BasePrincipal>
|
||||
BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, OriginAttributes& aAttrs)
|
||||
BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAttrs)
|
||||
{
|
||||
// If the URI is supposed to inherit the security context of whoever loads it,
|
||||
// we shouldn't make a codebase principal for it.
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "mozilla/dom/ChromeUtilsBinding.h"
|
||||
|
||||
class nsIContentSecurityPolicy;
|
||||
class nsILoadContext;
|
||||
class nsIObjectOutputStream;
|
||||
class nsIObjectInputStream;
|
||||
|
||||
@ -44,6 +45,28 @@ public:
|
||||
return !(*this == aOther);
|
||||
}
|
||||
|
||||
// The docshell often influences the origin attributes of content loaded
|
||||
// inside of it, and in some cases also influences the origin attributes of
|
||||
// content loaded in child docshells. We say that a given attribute "lives on
|
||||
// the docshell" to indicate that this attribute is specified by the docshell
|
||||
// (if any) associated with a given content document.
|
||||
//
|
||||
// In practice, this usually means that we need to store a copy of those
|
||||
// attributes on each docshell, or provide methods on the docshell to compute
|
||||
// them on-demand.
|
||||
// We could track each of these attributes individually, but since the
|
||||
// majority of the existing origin attributes currently live on the docshell,
|
||||
// it's cleaner to simply store an entire OriginAttributes struct on each
|
||||
// docshell, and selectively copy them to child docshells and content
|
||||
// principals in a manner that implements our desired semantics.
|
||||
//
|
||||
// This method is used to propagate attributes from parent to child
|
||||
// docshells.
|
||||
void InheritFromDocShellParent(const OriginAttributes& aParent);
|
||||
|
||||
// Copy from the origin attributes of the nsILoadContext.
|
||||
bool CopyFromLoadContext(nsILoadContext* aLoadContext);
|
||||
|
||||
// Serializes/Deserializes non-default values into the suffix format, i.e.
|
||||
// |!key1=value1&key2=value2|. If there are no non-default attributes, this
|
||||
// returns an empty string.
|
||||
@ -136,7 +159,7 @@ public:
|
||||
virtual bool IsCodebasePrincipal() const { return false; };
|
||||
|
||||
static BasePrincipal* Cast(nsIPrincipal* aPrin) { return static_cast<BasePrincipal*>(aPrin); }
|
||||
static already_AddRefed<BasePrincipal> CreateCodebasePrincipal(nsIURI* aURI, OriginAttributes& aAttrs);
|
||||
static already_AddRefed<BasePrincipal> CreateCodebasePrincipal(nsIURI* aURI, const OriginAttributes& aAttrs);
|
||||
|
||||
const OriginAttributes& OriginAttributesRef() { return mOriginAttributes; }
|
||||
uint32_t AppId() const { return mOriginAttributes.mAppId; }
|
||||
|
@ -44,6 +44,7 @@ UNIFIED_SOURCES += [
|
||||
]
|
||||
|
||||
LOCAL_INCLUDES += [
|
||||
'/docshell/base',
|
||||
'/dom/base',
|
||||
'/js/xpconnect/src',
|
||||
]
|
||||
|
@ -1093,10 +1093,10 @@ nsScriptSecurityManager::
|
||||
nsILoadContext* aLoadContext,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
// XXXbholley - Make this more general in bug 1165466.
|
||||
OriginAttributes attrs;
|
||||
aLoadContext->GetAppId(&attrs.mAppId);
|
||||
aLoadContext->GetIsInBrowserElement(&attrs.mInBrowser);
|
||||
bool result = attrs.CopyFromLoadContext(aLoadContext);
|
||||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = MaybeSetAddonIdFromURI(attrs, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
@ -1109,8 +1109,11 @@ nsScriptSecurityManager::GetDocShellCodebasePrincipal(nsIURI* aURI,
|
||||
nsIDocShell* aDocShell,
|
||||
nsIPrincipal** aPrincipal)
|
||||
{
|
||||
// XXXbholley - Make this more general in bug 1165466.
|
||||
OriginAttributes attrs(aDocShell->GetAppId(), aDocShell->GetIsInBrowserElement());
|
||||
OriginAttributes attrs;
|
||||
nsDocShell* docShell= nsDocShell::Cast(aDocShell);
|
||||
bool result = attrs.CopyFromLoadContext(docShell);
|
||||
NS_ENSURE_TRUE(result, NS_ERROR_FAILURE);
|
||||
|
||||
nsresult rv = MaybeSetAddonIdFromURI(attrs, aURI);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
|
@ -194,18 +194,6 @@ var gData = [
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-different-appstatus", "child-has-same-appid" ],
|
||||
},
|
||||
// app inside a browser is an app.
|
||||
{
|
||||
src: "http://example.org/",
|
||||
isapp: false,
|
||||
browser: true,
|
||||
child: {
|
||||
app: "http://example.org/manifest.webapp",
|
||||
src: "http://example.org/chrome/",
|
||||
isapp: true,
|
||||
},
|
||||
test: [ "child-has-different-eo", "child-has-different-appstatus", "child-has-different-appid" ],
|
||||
},
|
||||
// browser inside a browser are two browsers
|
||||
{
|
||||
src: "http://example.org/",
|
||||
|
@ -5,6 +5,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/LoadContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
@ -22,9 +23,7 @@ LoadContext::LoadContext(nsIPrincipal* aPrincipal,
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
{
|
||||
MOZ_ALWAYS_TRUE(NS_SUCCEEDED(aPrincipal->GetAppId(&mAppId)));
|
||||
MOZ_ALWAYS_TRUE(
|
||||
NS_SUCCEEDED(aPrincipal->GetIsInBrowserElement(&mIsInBrowserElement)));
|
||||
mOriginAttributes = BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
|
||||
|
||||
if (!aOptionalBase) {
|
||||
return;
|
||||
@ -151,7 +150,7 @@ LoadContext::GetIsInBrowserElement(bool* aIsInBrowserElement)
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aIsInBrowserElement);
|
||||
|
||||
*aIsInBrowserElement = mIsInBrowserElement;
|
||||
*aIsInBrowserElement = mOriginAttributes.mInBrowser;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -162,7 +161,18 @@ LoadContext::GetAppId(uint32_t* aAppId)
|
||||
|
||||
NS_ENSURE_ARG_POINTER(aAppId);
|
||||
|
||||
*aAppId = mAppId;
|
||||
*aAppId = mOriginAttributes.mAppId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LoadContext::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||
{
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
|
||||
bool ok = ToJSValue(cx, mOriginAttributes, aAttrs);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "SerializedLoadContext.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "nsIWeakReferenceUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
@ -42,14 +43,13 @@ public:
|
||||
// by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId, bool aInBrowser)
|
||||
OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mNestedFrameId(0)
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
|
||||
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
|
||||
, mIsInBrowserElement(aInBrowser)
|
||||
, mOriginAttributes(aAttrs)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
@ -60,14 +60,13 @@ public:
|
||||
// by child process.
|
||||
LoadContext(const IPC::SerializedLoadContext& aToCopy,
|
||||
uint64_t aNestedFrameId,
|
||||
uint32_t aAppId, bool aInBrowser)
|
||||
OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(aNestedFrameId)
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(aToCopy.mIsContent)
|
||||
, mUsePrivateBrowsing(aToCopy.mUsePrivateBrowsing)
|
||||
, mUseRemoteTabs(aToCopy.mUseRemoteTabs)
|
||||
, mIsInBrowserElement(aInBrowser)
|
||||
, mOriginAttributes(aAttrs)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(aToCopy.mIsNotNull)
|
||||
#endif
|
||||
@ -75,18 +74,16 @@ public:
|
||||
}
|
||||
|
||||
LoadContext(dom::Element* aTopFrameElement,
|
||||
uint32_t aAppId,
|
||||
bool aIsContent,
|
||||
bool aUsePrivateBrowsing,
|
||||
bool aUseRemoteTabs,
|
||||
bool aIsInBrowserElement)
|
||||
OriginAttributes& aAttrs)
|
||||
: mTopFrameElement(do_GetWeakReference(aTopFrameElement))
|
||||
, mNestedFrameId(0)
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(aIsContent)
|
||||
, mUsePrivateBrowsing(aUsePrivateBrowsing)
|
||||
, mUseRemoteTabs(aUseRemoteTabs)
|
||||
, mIsInBrowserElement(aIsInBrowserElement)
|
||||
, mOriginAttributes(aAttrs)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
@ -97,11 +94,10 @@ public:
|
||||
explicit LoadContext(uint32_t aAppId)
|
||||
: mTopFrameElement(nullptr)
|
||||
, mNestedFrameId(0)
|
||||
, mAppId(aAppId)
|
||||
, mIsContent(false)
|
||||
, mUsePrivateBrowsing(false)
|
||||
, mUseRemoteTabs(false)
|
||||
, mIsInBrowserElement(false)
|
||||
, mOriginAttributes(aAppId, false)
|
||||
#ifdef DEBUG
|
||||
, mIsNotNull(true)
|
||||
#endif
|
||||
@ -118,11 +114,10 @@ private:
|
||||
|
||||
nsWeakPtr mTopFrameElement;
|
||||
uint64_t mNestedFrameId;
|
||||
uint32_t mAppId;
|
||||
bool mIsContent;
|
||||
bool mUsePrivateBrowsing;
|
||||
bool mUseRemoteTabs;
|
||||
bool mIsInBrowserElement;
|
||||
OriginAttributes mOriginAttributes;
|
||||
#ifdef DEBUG
|
||||
bool mIsNotNull;
|
||||
#endif
|
||||
|
@ -62,8 +62,9 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
||||
aLoadContext->GetIsContent(&mIsContent);
|
||||
aLoadContext->GetUsePrivateBrowsing(&mUsePrivateBrowsing);
|
||||
aLoadContext->GetUseRemoteTabs(&mUseRemoteTabs);
|
||||
aLoadContext->GetAppId(&mAppId);
|
||||
aLoadContext->GetIsInBrowserElement(&mIsInBrowserElement);
|
||||
if (!aLoadContext->GetOriginAttributes(mOriginAttributes)) {
|
||||
NS_WARNING("GetOriginAttributes failed");
|
||||
}
|
||||
} else {
|
||||
mIsNotNull = false;
|
||||
mIsPrivateBitValid = false;
|
||||
@ -72,8 +73,6 @@ SerializedLoadContext::Init(nsILoadContext* aLoadContext)
|
||||
mIsContent = true;
|
||||
mUsePrivateBrowsing = false;
|
||||
mUseRemoteTabs = false;
|
||||
mAppId = 0;
|
||||
mIsInBrowserElement = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
class nsILoadContext;
|
||||
|
||||
@ -48,8 +49,7 @@ public:
|
||||
bool mIsContent;
|
||||
bool mUsePrivateBrowsing;
|
||||
bool mUseRemoteTabs;
|
||||
bool mIsInBrowserElement;
|
||||
uint32_t mAppId;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
// Function to serialize over IPDL
|
||||
@ -60,26 +60,29 @@ struct ParamTraits<SerializedLoadContext>
|
||||
|
||||
static void Write(Message* aMsg, const paramType& aParam)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
aParam.mOriginAttributes.CreateSuffix(suffix);
|
||||
|
||||
WriteParam(aMsg, aParam.mIsNotNull);
|
||||
WriteParam(aMsg, aParam.mIsContent);
|
||||
WriteParam(aMsg, aParam.mIsPrivateBitValid);
|
||||
WriteParam(aMsg, aParam.mUsePrivateBrowsing);
|
||||
WriteParam(aMsg, aParam.mUseRemoteTabs);
|
||||
WriteParam(aMsg, aParam.mAppId);
|
||||
WriteParam(aMsg, aParam.mIsInBrowserElement);
|
||||
WriteParam(aMsg, suffix);
|
||||
}
|
||||
|
||||
static bool Read(const Message* aMsg, void** aIter, paramType* aResult)
|
||||
{
|
||||
nsAutoCString suffix;
|
||||
if (!ReadParam(aMsg, aIter, &aResult->mIsNotNull) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsContent) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsPrivateBitValid) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUsePrivateBrowsing) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mUseRemoteTabs) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mAppId) ||
|
||||
!ReadParam(aMsg, aIter, &aResult->mIsInBrowserElement)) {
|
||||
!ReadParam(aMsg, aIter, &suffix)) {
|
||||
return false;
|
||||
}
|
||||
aResult->mOriginAttributes.PopulateFromSuffix(suffix);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9388,17 +9388,7 @@ nsresult
|
||||
nsDocShell::CreatePrincipalFromReferrer(nsIURI* aReferrer,
|
||||
nsIPrincipal** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
uint32_t appId;
|
||||
rv = GetAppId(&appId);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
bool isInBrowserElement;
|
||||
rv = GetIsInBrowserElement(&isInBrowserElement);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// TODO: Bug 1165466 - Pass mOriginAttributes directly.
|
||||
OriginAttributes attrs(appId, isInBrowserElement);
|
||||
OriginAttributes attrs = GetOriginAttributes();
|
||||
nsCOMPtr<nsIPrincipal> prin =
|
||||
BasePrincipal::CreateCodebasePrincipal(aReferrer, attrs);
|
||||
prin.forget(aResult);
|
||||
@ -13715,6 +13705,38 @@ nsDocShell::GetAppId(uint32_t* aAppId)
|
||||
return parent->GetAppId(aAppId);
|
||||
}
|
||||
|
||||
OriginAttributes
|
||||
nsDocShell::GetOriginAttributes()
|
||||
{
|
||||
OriginAttributes attrs;
|
||||
nsRefPtr<nsDocShell> parent = GetParentDocshell();
|
||||
if (parent) {
|
||||
attrs.InheritFromDocShellParent(parent->GetOriginAttributes());
|
||||
}
|
||||
|
||||
if (mOwnOrContainingAppId != nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
attrs.mAppId = mOwnOrContainingAppId;
|
||||
}
|
||||
|
||||
if (mFrameType == eFrameTypeBrowser) {
|
||||
attrs.mInBrowser = true;
|
||||
}
|
||||
|
||||
return attrs;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetOriginAttributes(JS::MutableHandle<JS::Value> aVal)
|
||||
{
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
|
||||
OriginAttributes attrs = GetOriginAttributes();
|
||||
bool ok = ToJSValue(cx, attrs, aVal);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetAppManifestURL(nsAString& aAppManifestURL)
|
||||
{
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "nsIContentViewerContainer.h"
|
||||
#include "nsIDOMStorageManager.h"
|
||||
#include "nsDocLoader.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "mozilla/WeakPtr.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
@ -230,6 +231,7 @@ public:
|
||||
NS_IMETHOD SetPrivateBrowsing(bool) override;
|
||||
NS_IMETHOD GetUseRemoteTabs(bool*) override;
|
||||
NS_IMETHOD SetRemoteTabs(bool) override;
|
||||
NS_IMETHOD GetOriginAttributes(JS::MutableHandle<JS::Value>) override;
|
||||
|
||||
// Restores a cached presentation from history (mLSHE).
|
||||
// This method swaps out the content viewer and simulates loads for
|
||||
@ -268,6 +270,8 @@ public:
|
||||
}
|
||||
bool InFrameSwap();
|
||||
|
||||
mozilla::OriginAttributes GetOriginAttributes();
|
||||
|
||||
private:
|
||||
// An observed docshell wrapper is created when recording markers is enabled.
|
||||
mozilla::UniquePtr<mozilla::ObservedDocShell> mObserved;
|
||||
@ -295,6 +299,11 @@ public:
|
||||
nsIURI* aNewURI,
|
||||
bool aInPrivateBrowsing);
|
||||
|
||||
static nsDocShell* Cast(nsIDocShell* aDocShell)
|
||||
{
|
||||
return static_cast<nsDocShell*>(aDocShell);
|
||||
}
|
||||
|
||||
protected:
|
||||
virtual ~nsDocShell();
|
||||
virtual void DestroyChildren() override;
|
||||
|
@ -9,12 +9,21 @@
|
||||
interface nsIDOMWindow;
|
||||
interface nsIDOMElement;
|
||||
|
||||
%{C++
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
#include "mozilla/BasePrincipal.h" // for OriginAttributes
|
||||
#include "mozilla/dom/ScriptSettings.h" // for AutoJSAPI
|
||||
#include "xpcpublic.h" // for PrivilegedJunkScope
|
||||
#include "nsContentUtils.h" // for IsSystemPrincipal
|
||||
#endif
|
||||
%}
|
||||
|
||||
/**
|
||||
* An nsILoadContext represents the context of a load. This interface
|
||||
* can be queried for various information about where the load is
|
||||
* happening.
|
||||
*/
|
||||
[scriptable, uuid(6ec837fa-af93-4350-bbb8-0985d54c74ca)]
|
||||
[scriptable, uuid(1220e340-b337-4c35-aaa1-f51362763621)]
|
||||
interface nsILoadContext : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -120,4 +129,39 @@ interface nsILoadContext : nsISupports
|
||||
*/
|
||||
readonly attribute unsigned long appId;
|
||||
|
||||
/**
|
||||
* A dictionary of the non-default origin attributes associated with this
|
||||
* nsILoadContext.
|
||||
*/
|
||||
readonly attribute jsval originAttributes;
|
||||
|
||||
%{C++
|
||||
#ifdef MOZILLA_INTERNAL_API
|
||||
/**
|
||||
* The C++ getter for origin attributes.
|
||||
*/
|
||||
bool GetOriginAttributes(mozilla::OriginAttributes& aAttrs)
|
||||
{
|
||||
mozilla::dom::AutoJSAPI jsapi;
|
||||
bool ok = jsapi.Init(xpc::PrivilegedJunkScope());
|
||||
NS_ENSURE_TRUE(ok, false);
|
||||
JS::Rooted<JS::Value> v(jsapi.cx());
|
||||
nsresult rv = GetOriginAttributes(&v);
|
||||
NS_ENSURE_SUCCESS(rv, false);
|
||||
MOZ_ASSERT(v.isObject());
|
||||
JS::Rooted<JSObject*> obj(jsapi.cx(), &v.toObject());
|
||||
|
||||
// If we're JS-implemented, the object will be left in a different (System-Principaled)
|
||||
// scope, so we may need to enter its compartment.
|
||||
MOZ_ASSERT(nsContentUtils::IsSystemPrincipal(nsContentUtils::ObjectPrincipal(obj)));
|
||||
JSAutoCompartment ac(jsapi.cx(), obj);
|
||||
|
||||
mozilla::OriginAttributes attrs;
|
||||
ok = attrs.Init(jsapi.cx(), v);
|
||||
NS_ENSURE_TRUE(ok, false);
|
||||
aAttrs = attrs;
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
%}
|
||||
};
|
||||
|
@ -425,15 +425,14 @@ StructuredCloneHelper::ReadFullySerializableObjects(JSContext* aCx,
|
||||
} else if (aTag == SCTAG_DOM_NULL_PRINCIPAL) {
|
||||
info = mozilla::ipc::NullPrincipalInfo();
|
||||
} else {
|
||||
uint32_t appId = aIndex;
|
||||
|
||||
uint32_t isInBrowserElement, specLength;
|
||||
if (!JS_ReadUint32Pair(aReader, &isInBrowserElement, &specLength)) {
|
||||
uint32_t suffixLength, specLength;
|
||||
if (!JS_ReadUint32Pair(aReader, &suffixLength, &specLength)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t signedPkgLength, dummy;
|
||||
if (!JS_ReadUint32Pair(aReader, &signedPkgLength, &dummy)) {
|
||||
nsAutoCString suffix;
|
||||
suffix.SetLength(suffixLength);
|
||||
if (!JS_ReadBytes(aReader, suffix.BeginWriting(), suffixLength)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -443,14 +442,9 @@ StructuredCloneHelper::ReadFullySerializableObjects(JSContext* aCx,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsAutoCString signedPkg;
|
||||
signedPkg.SetLength(signedPkgLength);
|
||||
if (!JS_ReadBytes(aReader, signedPkg.BeginWriting(), signedPkgLength)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
info = mozilla::ipc::ContentPrincipalInfo(appId, isInBrowserElement,
|
||||
spec, signedPkg);
|
||||
OriginAttributes attrs;
|
||||
attrs.PopulateFromSuffix(suffix);
|
||||
info = mozilla::ipc::ContentPrincipalInfo(attrs, spec);
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
@ -577,13 +571,12 @@ StructuredCloneHelper::WriteFullySerializableObjects(JSContext* aCx,
|
||||
|
||||
MOZ_ASSERT(info.type() == mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = info;
|
||||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_CONTENT_PRINCIPAL,
|
||||
cInfo.appId()) &&
|
||||
JS_WriteUint32Pair(aWriter, cInfo.isInBrowserElement(),
|
||||
cInfo.spec().Length()) &&
|
||||
JS_WriteUint32Pair(aWriter, cInfo.signedPkg().Length(), 0) &&
|
||||
JS_WriteBytes(aWriter, cInfo.spec().get(), cInfo.spec().Length()) &&
|
||||
JS_WriteBytes(aWriter, cInfo.signedPkg().get(), cInfo.signedPkg().Length());
|
||||
nsAutoCString suffix;
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
return JS_WriteUint32Pair(aWriter, SCTAG_DOM_CONTENT_PRINCIPAL, 0) &&
|
||||
JS_WriteUint32Pair(aWriter, suffix.Length(), cInfo.spec().Length()) &&
|
||||
JS_WriteBytes(aWriter, suffix.get(), suffix.Length()) &&
|
||||
JS_WriteBytes(aWriter, cInfo.spec().get(), cInfo.spec().Length());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -839,15 +839,12 @@ BrowserElementParent.prototype = {
|
||||
debug('Malformed referrer -- ' + e);
|
||||
}
|
||||
|
||||
// TODO Bug 1165466: use originAttributes from nsILoadContext.
|
||||
let attrs = {appId: this._frameLoader.loadContext.appId,
|
||||
inBrowser: this._frameLoader.loadContext.isInBrowserElement};
|
||||
// This simply returns null if there is no principal available
|
||||
// for the requested uri. This is an acceptable fallback when
|
||||
// calling newChannelFromURI2.
|
||||
principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
referrer, attrs);
|
||||
referrer, this._frameLoader.loadContext.originAttributes);
|
||||
}
|
||||
|
||||
debug('Using principal? ' + !!principal);
|
||||
|
2
dom/cache/CacheStorage.cpp
vendored
2
dom/cache/CacheStorage.cpp
vendored
@ -81,7 +81,7 @@ IsTrusted(const PrincipalInfo& aPrincipalInfo, bool aTestingPrefEnabled)
|
||||
// worker. We require exact knowledge of this information before allowing
|
||||
// the caller to touch the disk using the Cache API.
|
||||
if (NS_WARN_IF(aPrincipalInfo.type() != PrincipalInfo::TContentPrincipalInfo ||
|
||||
aPrincipalInfo.get_ContentPrincipalInfo().appId() ==
|
||||
aPrincipalInfo.get_ContentPrincipalInfo().attrs().mAppId ==
|
||||
nsIScriptSecurityManager::UNKNOWN_APP_ID)) {
|
||||
return false;
|
||||
}
|
||||
|
7
dom/cache/DBSchema.cpp
vendored
7
dom/cache/DBSchema.cpp
vendored
@ -1740,10 +1740,8 @@ InsertEntry(mozIStorageConnection* aConn, CacheId aCacheId,
|
||||
|
||||
serializedInfo.Append(cInfo.spec());
|
||||
|
||||
MOZ_ASSERT(cInfo.appId() != nsIScriptSecurityManager::UNKNOWN_APP_ID);
|
||||
OriginAttributes attrs(cInfo.appId(), cInfo.isInBrowserElement());
|
||||
nsAutoCString suffix;
|
||||
attrs.CreateSuffix(suffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
serializedInfo.Append(suffix);
|
||||
}
|
||||
|
||||
@ -1913,9 +1911,8 @@ ReadResponse(mozIStorageConnection* aConn, EntryId aEntryId,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCString signedPkg = NS_ConvertUTF16toUTF8(attrs.mSignedPkg);
|
||||
aSavedResponseOut->mValue.principalInfo() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, originNoSuffix, signedPkg);
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, originNoSuffix);
|
||||
}
|
||||
|
||||
int32_t redirected;
|
||||
|
@ -2974,12 +2974,13 @@ TabParent::GetLoadContext()
|
||||
if (mLoadContext) {
|
||||
loadContext = mLoadContext;
|
||||
} else {
|
||||
// TODO Bug 1191740 - Add OriginAttributes in TabContext
|
||||
OriginAttributes attrs = OriginAttributes(OwnOrContainingAppId(), IsBrowserElement());
|
||||
loadContext = new LoadContext(GetOwnerElement(),
|
||||
OwnOrContainingAppId(),
|
||||
true /* aIsContent */,
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_PRIVATE_WINDOW,
|
||||
mChromeFlags & nsIWebBrowserChrome::CHROME_REMOTE_WINDOW,
|
||||
IsBrowserElement());
|
||||
attrs);
|
||||
mLoadContext = loadContext;
|
||||
}
|
||||
return loadContext.forget();
|
||||
@ -3348,6 +3349,7 @@ public:
|
||||
NS_IMETHOD SetPrivateBrowsing(bool) NO_IMPL
|
||||
NS_IMETHOD GetIsInBrowserElement(bool*) NO_IMPL
|
||||
NS_IMETHOD GetAppId(uint32_t*) NO_IMPL
|
||||
NS_IMETHOD GetOriginAttributes(JS::MutableHandleValue) NO_IMPL
|
||||
NS_IMETHOD GetUseRemoteTabs(bool*) NO_IMPL
|
||||
NS_IMETHOD SetRemoteTabs(bool) NO_IMPL
|
||||
#undef NO_IMPL
|
||||
|
@ -156,6 +156,27 @@ VolumeManager::FindAddVolumeByName(const nsCSubstring& aName)
|
||||
return vol.forget();
|
||||
}
|
||||
|
||||
//static
|
||||
bool
|
||||
VolumeManager::RemoveVolumeByName(const nsCSubstring& aName)
|
||||
{
|
||||
if (!sVolumeManager) {
|
||||
return false;
|
||||
}
|
||||
VolumeArray::size_type numVolumes = NumVolumes();
|
||||
VolumeArray::index_type volIndex;
|
||||
for (volIndex = 0; volIndex < numVolumes; volIndex++) {
|
||||
RefPtr<Volume> vol = GetVolume(volIndex);
|
||||
if (vol->Name().Equals(aName)) {
|
||||
sVolumeManager->mVolumeArray.RemoveElementAt(volIndex);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No volume found. Return false to indicate this.
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//static
|
||||
void VolumeManager::InitConfig()
|
||||
{
|
||||
@ -236,6 +257,17 @@ void VolumeManager::InitConfig()
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (command.EqualsLiteral("ignore")) {
|
||||
// This command is useful to remove volumes which are being tracked by
|
||||
// vold, but for which we have no interest.
|
||||
if (!tokenizer.hasMoreTokens()) {
|
||||
ERR("No vol_name in %s line %d", filename, n);
|
||||
continue;
|
||||
}
|
||||
nsCString volName(tokenizer.nextToken());
|
||||
RemoveVolumeByName(volName);
|
||||
continue;
|
||||
}
|
||||
ERR("Unrecognized command: '%s'", command.get());
|
||||
}
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ public:
|
||||
static already_AddRefed<Volume> GetVolume(VolumeArray::index_type aIndex);
|
||||
static already_AddRefed<Volume> FindVolumeByName(const nsCSubstring& aName);
|
||||
static already_AddRefed<Volume> FindAddVolumeByName(const nsCSubstring& aName);
|
||||
static bool RemoveVolumeByName(const nsCSubstring& aName);
|
||||
static void InitConfig();
|
||||
|
||||
static void PostCommand(VolumeCommand* aCommand);
|
||||
|
@ -332,9 +332,8 @@ ServiceWorkerRegistrar::ReadData()
|
||||
}
|
||||
|
||||
GET_LINE(line);
|
||||
nsCString signedPkg = NS_ConvertUTF16toUTF8(attrs.mSignedPkg);
|
||||
entry->principal() =
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs.mAppId, attrs.mInBrowser, line, signedPkg);
|
||||
mozilla::ipc::ContentPrincipalInfo(attrs, line);
|
||||
|
||||
GET_LINE(entry->scope());
|
||||
GET_LINE(entry->scriptSpec());
|
||||
@ -549,9 +548,8 @@ ServiceWorkerRegistrar::WriteData()
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo =
|
||||
info.get_ContentPrincipalInfo();
|
||||
|
||||
OriginAttributes attrs(cInfo.appId(), cInfo.isInBrowserElement());
|
||||
nsAutoCString suffix;
|
||||
attrs.CreateSuffix(suffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
||||
buffer.Truncate();
|
||||
buffer.Append(suffix.get());
|
||||
|
@ -163,9 +163,8 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
ASSERT_EQ(info0.type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) << "First principal must be content";
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo0 = data[0].principal();
|
||||
|
||||
mozilla::OriginAttributes attrs0(cInfo0.appId(), cInfo0.isInBrowserElement());
|
||||
nsAutoCString suffix0;
|
||||
attrs0.CreateSuffix(suffix0);
|
||||
cInfo0.attrs().CreateSuffix(suffix0);
|
||||
|
||||
ASSERT_STREQ("^appId=123&inBrowser=1", suffix0.get());
|
||||
ASSERT_STREQ("spec 0", cInfo0.spec().get());
|
||||
@ -179,9 +178,8 @@ TEST(ServiceWorkerRegistrar, TestReadData)
|
||||
ASSERT_EQ(info1.type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo) << "First principal must be content";
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo1 = data[1].principal();
|
||||
|
||||
mozilla::OriginAttributes attrs1(cInfo1.appId(), cInfo1.isInBrowserElement());
|
||||
nsAutoCString suffix1;
|
||||
attrs1.CreateSuffix(suffix1);
|
||||
cInfo1.attrs().CreateSuffix(suffix1);
|
||||
|
||||
ASSERT_STREQ("", suffix1.get());
|
||||
ASSERT_STREQ("spec 1", cInfo1.spec().get());
|
||||
@ -221,7 +219,7 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
|
||||
nsAutoCString spec;
|
||||
spec.AppendPrintf("spec write %d", i);
|
||||
d->principal() = mozilla::ipc::ContentPrincipalInfo(i, i % 2, spec, EmptyCString());
|
||||
d->principal() = mozilla::ipc::ContentPrincipalInfo(mozilla::OriginAttributes(i, i % 2), spec);
|
||||
d->scope().AppendPrintf("scope write %d", i);
|
||||
d->scriptSpec().AppendPrintf("scriptSpec write %d", i);
|
||||
d->currentWorkerURL().AppendPrintf("currentWorkerURL write %d", i);
|
||||
@ -247,8 +245,12 @@ TEST(ServiceWorkerRegistrar, TestWriteData)
|
||||
ASSERT_EQ(data[i].principal().type(), mozilla::ipc::PrincipalInfo::TContentPrincipalInfo);
|
||||
const mozilla::ipc::ContentPrincipalInfo& cInfo = data[i].principal();
|
||||
|
||||
ASSERT_EQ((uint32_t)i, cInfo.appId());
|
||||
ASSERT_EQ((uint32_t)(i % 2), (uint32_t)cInfo.isInBrowserElement());
|
||||
mozilla::OriginAttributes attrs(i, i % 2);
|
||||
nsAutoCString suffix, expectSuffix;
|
||||
attrs.CreateSuffix(expectSuffix);
|
||||
cInfo.attrs().CreateSuffix(suffix);
|
||||
|
||||
ASSERT_STREQ(expectSuffix.get(), suffix.get());
|
||||
|
||||
test.AppendPrintf("spec write %d", i);
|
||||
ASSERT_STREQ(test.get(), cInfo.spec().get());
|
||||
|
@ -46,7 +46,8 @@ NotificationCallbacks.prototype = {
|
||||
if (iid.equals(Ci.nsILoadContext))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
},
|
||||
originAttributes: {}
|
||||
};
|
||||
|
||||
var gImgPath = 'http://localhost:' + server.identity.primaryPort + '/image.png';
|
||||
|
@ -25,7 +25,6 @@ class OptionalLoadInfoArgs;
|
||||
}
|
||||
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::OriginAttributes;
|
||||
using namespace mozilla::net;
|
||||
|
||||
namespace ipc {
|
||||
@ -77,13 +76,10 @@ PrincipalInfoToPrincipal(const PrincipalInfo& aPrincipalInfo,
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info.appId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
if (info.attrs().mAppId == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
|
||||
rv = secMan->GetSimpleCodebasePrincipal(uri, getter_AddRefs(principal));
|
||||
} else {
|
||||
// TODO: Bug 1167100 - User nsIPrincipal.originAttribute in ContentPrincipalInfo
|
||||
OriginAttributes attrs(info.appId(), info.isInBrowserElement());
|
||||
attrs.mSignedPkg = NS_ConvertUTF8toUTF16(info.signedPkg());
|
||||
principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
principal = BasePrincipal::CreateCodebasePrincipal(uri, info.attrs());
|
||||
rv = principal ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
@ -203,33 +199,14 @@ PrincipalToPrincipalInfo(nsIPrincipal* aPrincipal,
|
||||
return rv;
|
||||
}
|
||||
|
||||
const mozilla::OriginAttributes& attr =
|
||||
mozilla::BasePrincipal::Cast(aPrincipal)->OriginAttributesRef();
|
||||
nsCString signedPkg = NS_ConvertUTF16toUTF8(attr.mSignedPkg);
|
||||
|
||||
bool isUnknownAppId;
|
||||
rv = aPrincipal->GetUnknownAppId(&isUnknownAppId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
uint32_t appId;
|
||||
if (isUnknownAppId) {
|
||||
appId = nsIScriptSecurityManager::UNKNOWN_APP_ID;
|
||||
} else {
|
||||
rv = aPrincipal->GetAppId(&appId);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
bool isInBrowserElement;
|
||||
rv = aPrincipal->GetIsInBrowserElement(&isInBrowserElement);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
|
||||
*aPrincipalInfo = ContentPrincipalInfo(appId, isInBrowserElement, spec, signedPkg);
|
||||
*aPrincipalInfo = ContentPrincipalInfo(BasePrincipal::Cast(aPrincipal)->OriginAttributesRef(),
|
||||
spec);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
using mozilla::OriginAttributes from "mozilla/ipc/BackgroundUtils.h";
|
||||
using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
|
||||
|
||||
namespace mozilla {
|
||||
@ -9,10 +10,8 @@ namespace ipc {
|
||||
|
||||
struct ContentPrincipalInfo
|
||||
{
|
||||
uint32_t appId;
|
||||
bool isInBrowserElement;
|
||||
OriginAttributes attrs;
|
||||
nsCString spec;
|
||||
nsCString signedPkg;
|
||||
};
|
||||
|
||||
struct SystemPrincipalInfo
|
||||
|
@ -51,6 +51,7 @@
|
||||
|
||||
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
|
||||
<uses-permission android:name="android.permission.SET_WALLPAPER" />
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
<application android:label="@string/b2g"
|
||||
android:icon="@drawable/b2g"
|
||||
|
@ -18,6 +18,7 @@ import android.graphics.BitmapFactory;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings.System;
|
||||
import android.telephony.TelephonyManager;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
@ -164,7 +165,8 @@ class SettingsMapper extends ContentObserver implements GeckoEventListener {
|
||||
mContext = context;
|
||||
EventDispatcher.getInstance()
|
||||
.registerGeckoThreadListener(this,
|
||||
"Settings:Change");
|
||||
"Settings:Change",
|
||||
"Android:GetIMEI");
|
||||
|
||||
mContext.getContentResolver()
|
||||
.registerContentObserver(System.CONTENT_URI,
|
||||
@ -194,7 +196,8 @@ class SettingsMapper extends ContentObserver implements GeckoEventListener {
|
||||
void destroy() {
|
||||
EventDispatcher.getInstance()
|
||||
.unregisterGeckoThreadListener(this,
|
||||
"Settings:Change");
|
||||
"Settings:Change",
|
||||
"Android:GetIMEI");
|
||||
mGeckoSettings.clear();
|
||||
mGeckoSettings = null;
|
||||
mAndroidSettings.clear();
|
||||
@ -205,17 +208,30 @@ class SettingsMapper extends ContentObserver implements GeckoEventListener {
|
||||
public void handleMessage(String event, JSONObject message) {
|
||||
Log.w(LOGTAG, "Received " + event);
|
||||
|
||||
try {
|
||||
String setting = message.getString("setting");
|
||||
BaseMapping mapping = mGeckoSettings.get(setting);
|
||||
if (mapping != null) {
|
||||
Log.d(LOGTAG, "Changing gecko setting " + setting);
|
||||
mapping.onGeckoChange(setting, message);
|
||||
} else {
|
||||
Log.d(LOGTAG, "No gecko mapping registered for " + setting);
|
||||
if ("Settings:Change".equals(event)) {
|
||||
try {
|
||||
String setting = message.getString("setting");
|
||||
BaseMapping mapping = mGeckoSettings.get(setting);
|
||||
if (mapping != null) {
|
||||
Log.d(LOGTAG, "Changing gecko setting " + setting);
|
||||
mapping.onGeckoChange(setting, message);
|
||||
} else {
|
||||
Log.d(LOGTAG, "No gecko mapping registered for " + setting);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
Log.d(LOGTAG, "Error getting setting name", ex);
|
||||
}
|
||||
} catch(Exception ex) {
|
||||
Log.d(LOGTAG, "Error getting setting name", ex);
|
||||
} else if ("Android:GetIMEI".equals(event)) {
|
||||
TelephonyManager telManager =
|
||||
(TelephonyManager)mContext.getSystemService(Context.TELEPHONY_SERVICE);
|
||||
JSONObject ret = new JSONObject();
|
||||
Log.d(LOGTAG, "Getting IMEI: " + telManager.getDeviceId());
|
||||
try {
|
||||
ret.put("imei", telManager.getDeviceId());
|
||||
} catch(Exception jsonEx) {
|
||||
Log.wtf(LOGTAG, "Error getting IMEI", jsonEx);
|
||||
}
|
||||
EventDispatcher.sendResponse(message, ret);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,14 @@ this.MessagesBridge = {
|
||||
Services.obs.addObserver(this.onAndroidSetting, "Android:Setting", false);
|
||||
Services.obs.addObserver(this.onSettingChange, "mozsettings-changed", false);
|
||||
Services.obs.addObserver(this, "xpcom-shutdown", false);
|
||||
|
||||
// Send a request to get the device's IMEI.
|
||||
Messaging.sendRequestForResult({ type: "Android:GetIMEI" })
|
||||
.then(aData => {
|
||||
debug("Got IMEI: " + aData.imei);
|
||||
let lock = settings.createLock();
|
||||
lock.set("deviceinfo.imei", aData.imei, null);
|
||||
});
|
||||
},
|
||||
|
||||
onAndroidMessage: function(aSubject, aTopic, aData) {
|
||||
|
@ -376,8 +376,6 @@
|
||||
@BINPATH@/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.manifest
|
||||
@BINPATH@/components/txEXSLTRegExFunctions.js
|
||||
@BINPATH@/components/nsDefaultCLH.manifest
|
||||
@BINPATH@/components/nsDefaultCLH.js
|
||||
@BINPATH@/components/nsContentPrefService.manifest
|
||||
@BINPATH@/components/nsContentPrefService.js
|
||||
@BINPATH@/components/nsContentDispatchChooser.manifest
|
||||
|
@ -75,10 +75,10 @@ CookieServiceParent::GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoa
|
||||
aIsInBrowserElement = false;
|
||||
aIsPrivate = false;
|
||||
|
||||
OriginAttributes attrs;
|
||||
const char* error = NeckoParent::GetValidatedAppInfo(aLoadContext,
|
||||
Manager()->Manager(),
|
||||
&aAppId,
|
||||
&aIsInBrowserElement);
|
||||
attrs);
|
||||
if (error) {
|
||||
NS_WARNING(nsPrintfCString("CookieServiceParent: GetAppInfoFromParams: "
|
||||
"FATAL error: %s: KILLING CHILD PROCESS\n",
|
||||
@ -86,6 +86,8 @@ CookieServiceParent::GetAppInfoFromParams(const IPC::SerializedLoadContext &aLoa
|
||||
return false;
|
||||
}
|
||||
|
||||
aAppId = attrs.mAppId;
|
||||
aIsInBrowserElement = attrs.mInBrowser;
|
||||
if (aLoadContext.IsPrivateBitValid()) {
|
||||
aIsPrivate = aLoadContext.mUsePrivateBrowsing;
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
#include "nsISpeculativeConnect.h"
|
||||
|
||||
using mozilla::OriginAttributes;
|
||||
using mozilla::dom::ContentParent;
|
||||
using mozilla::dom::TabContext;
|
||||
using mozilla::dom::TabParent;
|
||||
@ -109,12 +110,8 @@ PBOverrideStatusFromLoadContext(const SerializedLoadContext& aSerialized)
|
||||
const char*
|
||||
NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PContentParent* aContent,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement)
|
||||
OriginAttributes& aAttrs)
|
||||
{
|
||||
*aAppId = NECKO_UNKNOWN_APP_ID;
|
||||
*aInBrowserElement = false;
|
||||
|
||||
if (UsingNeckoIPCSecurity()) {
|
||||
if (!aSerialized.IsNotNull()) {
|
||||
return "SerializedLoadContext from child is null";
|
||||
@ -126,8 +123,9 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
for (uint32_t i = 0; i < contextArray.Length(); i++) {
|
||||
TabContext tabContext = contextArray[i];
|
||||
uint32_t appId = tabContext.OwnOrContainingAppId();
|
||||
bool inBrowserElement = aSerialized.IsNotNull() ? aSerialized.mIsInBrowserElement
|
||||
: tabContext.IsBrowserElement();
|
||||
bool inBrowserElement = aSerialized.IsNotNull() ?
|
||||
aSerialized.mOriginAttributes.mInBrowser :
|
||||
tabContext.IsBrowserElement();
|
||||
|
||||
if (appId == NECKO_UNKNOWN_APP_ID) {
|
||||
continue;
|
||||
@ -145,8 +143,7 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*aAppId = appId;
|
||||
*aInBrowserElement = inBrowserElement;
|
||||
aAttrs = OriginAttributes(appId, inBrowserElement);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -157,10 +154,9 @@ NeckoParent::GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
if (!UsingNeckoIPCSecurity()) {
|
||||
// We are running xpcshell tests
|
||||
if (aSerialized.IsNotNull()) {
|
||||
*aAppId = aSerialized.mAppId;
|
||||
*aInBrowserElement = aSerialized.mIsInBrowserElement;
|
||||
aAttrs = aSerialized.mOriginAttributes;
|
||||
} else {
|
||||
*aAppId = NECKO_NO_APP_ID;
|
||||
aAttrs = OriginAttributes(NECKO_NO_APP_ID, false);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
@ -174,9 +170,8 @@ NeckoParent::CreateChannelLoadContext(const PBrowserOrId& aBrowser,
|
||||
const SerializedLoadContext& aSerialized,
|
||||
nsCOMPtr<nsILoadContext> &aResult)
|
||||
{
|
||||
uint32_t appId = NECKO_UNKNOWN_APP_ID;
|
||||
bool inBrowser = false;
|
||||
const char* error = GetValidatedAppInfo(aSerialized, aContent, &appId, &inBrowser);
|
||||
OriginAttributes attrs;
|
||||
const char* error = GetValidatedAppInfo(aSerialized, aContent, attrs);
|
||||
if (error) {
|
||||
return error;
|
||||
}
|
||||
@ -193,14 +188,12 @@ NeckoParent::CreateChannelLoadContext(const PBrowserOrId& aBrowser,
|
||||
if (tabParent) {
|
||||
topFrameElement = tabParent->GetOwnerElement();
|
||||
}
|
||||
aResult = new LoadContext(aSerialized, topFrameElement,
|
||||
appId, inBrowser);
|
||||
aResult = new LoadContext(aSerialized, topFrameElement, attrs);
|
||||
break;
|
||||
}
|
||||
case PBrowserOrId::TTabId:
|
||||
{
|
||||
aResult = new LoadContext(aSerialized, aBrowser.get_TabId(),
|
||||
appId, inBrowser);
|
||||
aResult = new LoadContext(aSerialized, aBrowser.get_TabId(), attrs);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@ -566,7 +559,7 @@ NeckoParent::AllocPRemoteOpenFileParent(const SerializedLoadContext& aSerialized
|
||||
// Note: this enforces that SerializedLoadContext.appID is one of the apps
|
||||
// in the child process, but there's currently no way to verify the
|
||||
// request is not from a different app in that process.
|
||||
if (appId == aSerialized.mAppId) {
|
||||
if (appId == aSerialized.mOriginAttributes.mAppId) {
|
||||
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(mozApp));
|
||||
if (NS_FAILED(rv) || !mozApp) {
|
||||
break;
|
||||
@ -878,11 +871,12 @@ NeckoParent::RecvPredPredict(const ipc::OptionalURIParams& aTargetURI,
|
||||
nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
|
||||
|
||||
// We only actually care about the loadContext.mPrivateBrowsing, so we'll just
|
||||
// pass dummy params for nestFrameId, inBrowser and appId
|
||||
// pass dummy params for nestFrameId, and originAttributes.
|
||||
uint64_t nestedFrameId = 0;
|
||||
OriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (aLoadContext.IsNotNull()) {
|
||||
loadContext = new LoadContext(aLoadContext, nestedFrameId, NECKO_UNKNOWN_APP_ID, false);
|
||||
loadContext = new LoadContext(aLoadContext, nestedFrameId, attrs);
|
||||
}
|
||||
|
||||
// Get the current predictor
|
||||
@ -909,11 +903,12 @@ NeckoParent::RecvPredLearn(const ipc::URIParams& aTargetURI,
|
||||
nsCOMPtr<nsIURI> sourceURI = DeserializeURI(aSourceURI);
|
||||
|
||||
// We only actually care about the loadContext.mPrivateBrowsing, so we'll just
|
||||
// pass dummy params for nestFrameId, inBrowser and appId
|
||||
// pass dummy params for nestFrameId, and originAttributes;
|
||||
uint64_t nestedFrameId = 0;
|
||||
OriginAttributes attrs(NECKO_UNKNOWN_APP_ID, false);
|
||||
nsCOMPtr<nsILoadContext> loadContext;
|
||||
if (aLoadContext.IsNotNull()) {
|
||||
loadContext = new LoadContext(aLoadContext, nestedFrameId, NECKO_UNKNOWN_APP_ID, false);
|
||||
loadContext = new LoadContext(aLoadContext, nestedFrameId, attrs);
|
||||
}
|
||||
|
||||
// Get the current predictor
|
||||
|
@ -5,6 +5,7 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/net/PNeckoParent.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/net/OfflineObserver.h"
|
||||
@ -38,8 +39,7 @@ public:
|
||||
static const char *
|
||||
GetValidatedAppInfo(const SerializedLoadContext& aSerialized,
|
||||
PContentParent* aBrowser,
|
||||
uint32_t* aAppId,
|
||||
bool* aInBrowserElement);
|
||||
mozilla::OriginAttributes& aAttrs);
|
||||
|
||||
/*
|
||||
* Creates LoadContext for parent-side of an e10s channel.
|
||||
|
@ -521,13 +521,11 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
|
||||
}
|
||||
|
||||
if (setChooseApplicationCache) {
|
||||
bool inBrowser = false;
|
||||
OriginAttributes attrs;
|
||||
if (mLoadContext) {
|
||||
mLoadContext->GetIsInBrowserElement(&inBrowser);
|
||||
attrs.CopyFromLoadContext(mLoadContext);
|
||||
}
|
||||
|
||||
// TODO: Bug 1165466 - use originAttribute in nsILoadContext.
|
||||
OriginAttributes attrs(appId, inBrowser);
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
|
||||
|
@ -211,6 +211,10 @@ ChannelEventSink.prototype = {
|
||||
function LoadContextCallback(appId, inBrowserElement, isPrivate, isContent) {
|
||||
this.appId = appId;
|
||||
this.isInBrowserElement = inBrowserElement;
|
||||
this.originAttributes = {
|
||||
appId: appId,
|
||||
inBrowser: inBrowserElement
|
||||
};
|
||||
this.usePrivateBrowsing = isPrivate;
|
||||
this.isContent = isContent;
|
||||
}
|
||||
|
@ -31,6 +31,10 @@ function makeChan(url, appId, inBrowser) {
|
||||
chan.notificationCallbacks = {
|
||||
appId: appId,
|
||||
isInBrowserElement: inBrowser,
|
||||
originAttributes: {
|
||||
appId: appId,
|
||||
inBrowser: inBrowser,
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsILoadContext))
|
||||
return this;
|
||||
|
@ -33,7 +33,9 @@ LoadContext.prototype = {
|
||||
if (iid.equals(Ci.nsILoadContext))
|
||||
return this;
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
},
|
||||
|
||||
originAttributes: {}
|
||||
};
|
||||
|
||||
PrivateBrowsingLoadContext = new LoadContext(true);
|
||||
|
@ -38,7 +38,9 @@ LoadContext.prototype = {
|
||||
}
|
||||
|
||||
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||
}
|
||||
},
|
||||
|
||||
originAttributes: {}
|
||||
};
|
||||
|
||||
var load_context = new LoadContext();
|
||||
|
@ -19,6 +19,10 @@ function makeChan(url, appId, inBrowser) {
|
||||
chan.notificationCallbacks = {
|
||||
appId: appId,
|
||||
isInBrowserElement: inBrowser,
|
||||
originAttributes: {
|
||||
appId: appId,
|
||||
inBrowser: inBrowser,
|
||||
},
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsILoadContext))
|
||||
return this;
|
||||
|
@ -103,7 +103,8 @@ if CONFIG['NIGHTLY_BUILD']: # Bug 1136927 - Performance Monitoring is not ready
|
||||
|
||||
DIRS += ['build']
|
||||
|
||||
EXTRA_COMPONENTS += [
|
||||
'nsDefaultCLH.js',
|
||||
'nsDefaultCLH.manifest',
|
||||
]
|
||||
if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
|
||||
EXTRA_COMPONENTS += [
|
||||
'nsDefaultCLH.js',
|
||||
'nsDefaultCLH.manifest',
|
||||
]
|
||||
|
@ -51,11 +51,11 @@ NS_IMPL_ISUPPORTS(OfflineCacheUpdateParent,
|
||||
// OfflineCacheUpdateParent <public>
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
// TODO: Bug 1191740 - Add OriginAttributes in TabContext
|
||||
OfflineCacheUpdateParent::OfflineCacheUpdateParent(uint32_t aAppId,
|
||||
bool aIsInBrowser)
|
||||
: mIPCClosed(false)
|
||||
, mIsInBrowserElement(aIsInBrowser)
|
||||
, mAppId(aAppId)
|
||||
, mOriginAttributes(aAppId, aIsInBrowser)
|
||||
{
|
||||
// Make sure the service has been initialized
|
||||
nsOfflineCacheUpdateService::EnsureService();
|
||||
@ -93,10 +93,8 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
||||
|
||||
bool offlinePermissionAllowed = false;
|
||||
|
||||
// TODO: Bug 1165466 - use OriginAttributes
|
||||
OriginAttributes attrs(mAppId, mIsInBrowserElement);
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(manifestURI, attrs);
|
||||
BasePrincipal::CreateCodebasePrincipal(manifestURI, mOriginAttributes);
|
||||
|
||||
nsresult rv = service->OfflineAppAllowed(
|
||||
principal, nullptr, &offlinePermissionAllowed);
|
||||
@ -112,7 +110,11 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
||||
if (!NS_SecurityCompareURIs(manifestURI, documentURI, false))
|
||||
return NS_ERROR_DOM_SECURITY_ERR;
|
||||
|
||||
service->FindUpdate(manifestURI, mAppId, mIsInBrowserElement, nullptr,
|
||||
// TODO: Bug 1197093 - add originAttributes to nsIOfflineCacheUpdate
|
||||
service->FindUpdate(manifestURI,
|
||||
mOriginAttributes.mAppId,
|
||||
mOriginAttributes.mInBrowser,
|
||||
nullptr,
|
||||
getter_AddRefs(update));
|
||||
if (!update) {
|
||||
update = new nsOfflineCacheUpdate();
|
||||
@ -120,7 +122,7 @@ OfflineCacheUpdateParent::Schedule(const URIParams& aManifestURI,
|
||||
// Leave aDocument argument null. Only glues and children keep
|
||||
// document instances.
|
||||
rv = update->Init(manifestURI, documentURI, nullptr, nullptr,
|
||||
mAppId, mIsInBrowserElement);
|
||||
mOriginAttributes.mAppId, mOriginAttributes.mInBrowser);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = update->Schedule();
|
||||
@ -254,14 +256,25 @@ OfflineCacheUpdateParent::SetRemoteTabs(bool aUseRemoteTabs)
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetIsInBrowserElement(bool *aIsInBrowserElement)
|
||||
{
|
||||
*aIsInBrowserElement = mIsInBrowserElement;
|
||||
*aIsInBrowserElement = mOriginAttributes.mInBrowser;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetAppId(uint32_t *aAppId)
|
||||
{
|
||||
*aAppId = mAppId;
|
||||
*aAppId = mOriginAttributes.mAppId;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
OfflineCacheUpdateParent::GetOriginAttributes(JS::MutableHandleValue aAttrs)
|
||||
{
|
||||
JSContext* cx = nsContentUtils::GetCurrentJSContext();
|
||||
MOZ_ASSERT(cx);
|
||||
|
||||
bool ok = ToJSValue(cx, mOriginAttributes, aAttrs);
|
||||
NS_ENSURE_TRUE(ok, NS_ERROR_FAILURE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,7 @@
|
||||
#define nsOfflineCacheUpdateParent_h
|
||||
|
||||
#include "mozilla/docshell/POfflineCacheUpdateParent.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "nsIOfflineCacheUpdate.h"
|
||||
|
||||
#include "nsString.h"
|
||||
@ -45,14 +46,12 @@ public:
|
||||
OfflineCacheUpdateParent(uint32_t aAppId, bool aIsInBrowser);
|
||||
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
||||
private:
|
||||
~OfflineCacheUpdateParent();
|
||||
|
||||
bool mIPCClosed;
|
||||
|
||||
bool mIsInBrowserElement;
|
||||
uint32_t mAppId;
|
||||
mozilla::OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
||||
} // namespace docshell
|
||||
|
Loading…
x
Reference in New Issue
Block a user