mirror of
https://github.com/classilla/tenfourfox.git
synced 2025-01-01 06:33:22 +00:00
#451: M1410106 (thanks to Andrew Sutherland)
This commit is contained in:
parent
fe74dde015
commit
8247519187
@ -19407,21 +19407,33 @@ FactoryOp::CheckPermission(ContentParent* aContentParent,
|
|||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(mState == State::Initial || mState == State::PermissionRetry);
|
MOZ_ASSERT(mState == State::Initial || mState == State::PermissionRetry);
|
||||||
|
|
||||||
|
// TenFourFox issue 451 for Mozilla bug 1410106
|
||||||
const PrincipalInfo& principalInfo = mCommonParams.principalInfo();
|
const PrincipalInfo& principalInfo = mCommonParams.principalInfo();
|
||||||
if (principalInfo.type() != PrincipalInfo::TSystemPrincipalInfo &&
|
if (principalInfo.type() != PrincipalInfo::TSystemPrincipalInfo) {
|
||||||
NS_WARN_IF(!Preferences::GetBool(kPrefIndexedDBEnabled, false))) {
|
if (principalInfo.type() != PrincipalInfo::TContentPrincipalInfo) {
|
||||||
|
if (aContentParent) {
|
||||||
|
// We just want ContentPrincipalInfo or SystemPrincipalInfo.
|
||||||
|
aContentParent->KillHard("IndexedDB CheckPermission 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NS_WARN_IF(!Preferences::GetBool(kPrefIndexedDBEnabled, false))) {
|
||||||
if (aContentParent) {
|
if (aContentParent) {
|
||||||
// The DOM in the other process should have kept us from receiving any
|
// The DOM in the other process should have kept us from receiving any
|
||||||
// indexedDB messages so assume that the child is misbehaving.
|
// indexedDB messages so assume that the child is misbehaving.
|
||||||
aContentParent->KillHard("IndexedDB CheckPermission 1");
|
aContentParent->KillHard("IndexedDB CheckPermission 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_WARN_IF(mCommonParams.privateBrowsingMode())) {
|
if (NS_WARN_IF(mCommonParams.privateBrowsingMode())) {
|
||||||
// XXX This is only temporary.
|
// IndexedDB is currently disabled in privateBrowsing.
|
||||||
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
return NS_ERROR_DOM_INDEXEDDB_NOT_ALLOWED_ERR;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mFileHandleDisabled = !Preferences::GetBool(kPrefFileHandleEnabled);
|
mFileHandleDisabled = !Preferences::GetBool(kPrefFileHandleEnabled);
|
||||||
|
|
||||||
|
@ -199,7 +199,10 @@ IDBFactory::CreateForMainThreadJS(JSContext* aCx,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = CreateForMainThreadJSInternal(aCx, aOwningObject, principalInfo, aFactory);
|
rv = CreateForMainThreadJSInternal(aCx, aOwningObject, principalInfo, aFactory,
|
||||||
|
/* Only IndexedDatabaseManager::DefineIndexedDB
|
||||||
|
can call this, which is always chrome, thus ... */
|
||||||
|
/* aIsPrivateBrowsing */ false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -224,7 +227,9 @@ IDBFactory::CreateForDatastore(JSContext* aCx,
|
|||||||
new PrincipalInfo(SystemPrincipalInfo()));
|
new PrincipalInfo(SystemPrincipalInfo()));
|
||||||
|
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
CreateForMainThreadJSInternal(aCx, aOwningObject, principalInfo, aFactory);
|
CreateForMainThreadJSInternal(aCx, aOwningObject, principalInfo, aFactory,
|
||||||
|
/* Only chrome can get here, therefore ... */
|
||||||
|
/* aIsPrivateBrowsing */ false);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -240,7 +245,8 @@ IDBFactory::CreateForWorker(JSContext* aCx,
|
|||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
const PrincipalInfo& aPrincipalInfo,
|
const PrincipalInfo& aPrincipalInfo,
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
IDBFactory** aFactory)
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(!NS_IsMainThread());
|
MOZ_ASSERT(!NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPrincipalInfo.type() != PrincipalInfo::T__None);
|
MOZ_ASSERT(aPrincipalInfo.type() != PrincipalInfo::T__None);
|
||||||
@ -252,7 +258,8 @@ IDBFactory::CreateForWorker(JSContext* aCx,
|
|||||||
aOwningObject,
|
aOwningObject,
|
||||||
principalInfo,
|
principalInfo,
|
||||||
aInnerWindowID,
|
aInnerWindowID,
|
||||||
aFactory);
|
aFactory,
|
||||||
|
aIsPrivateBrowsing);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -268,7 +275,8 @@ IDBFactory::CreateForMainThreadJSInternal(
|
|||||||
JSContext* aCx,
|
JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
||||||
IDBFactory** aFactory)
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(aPrincipalInfo);
|
MOZ_ASSERT(aPrincipalInfo);
|
||||||
@ -290,7 +298,8 @@ IDBFactory::CreateForMainThreadJSInternal(
|
|||||||
aOwningObject,
|
aOwningObject,
|
||||||
aPrincipalInfo,
|
aPrincipalInfo,
|
||||||
/* aInnerWindowID */ 0,
|
/* aInnerWindowID */ 0,
|
||||||
aFactory);
|
aFactory,
|
||||||
|
aIsPrivateBrowsing);
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
@ -304,7 +313,8 @@ IDBFactory::CreateForJSInternal(JSContext* aCx,
|
|||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
IDBFactory** aFactory)
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aCx);
|
MOZ_ASSERT(aCx);
|
||||||
MOZ_ASSERT(aOwningObject);
|
MOZ_ASSERT(aOwningObject);
|
||||||
@ -327,6 +337,7 @@ IDBFactory::CreateForJSInternal(JSContext* aCx,
|
|||||||
factory->mOwningObject = aOwningObject;
|
factory->mOwningObject = aOwningObject;
|
||||||
mozilla::HoldJSObjects(factory.get());
|
mozilla::HoldJSObjects(factory.get());
|
||||||
factory->mInnerWindowID = aInnerWindowID;
|
factory->mInnerWindowID = aInnerWindowID;
|
||||||
|
factory->mPrivateBrowsingMode = aIsPrivateBrowsing;
|
||||||
|
|
||||||
factory.forget(aFactory);
|
factory.forget(aFactory);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -100,7 +100,8 @@ public:
|
|||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
const PrincipalInfo& aPrincipalInfo,
|
const PrincipalInfo& aPrincipalInfo,
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
IDBFactory** aFactory);
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing);
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
AllowedForWindow(nsPIDOMWindow* aWindow);
|
AllowedForWindow(nsPIDOMWindow* aWindow);
|
||||||
@ -217,14 +218,16 @@ private:
|
|||||||
CreateForMainThreadJSInternal(JSContext* aCx,
|
CreateForMainThreadJSInternal(JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
||||||
IDBFactory** aFactory);
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing);
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
CreateForJSInternal(JSContext* aCx,
|
CreateForJSInternal(JSContext* aCx,
|
||||||
JS::Handle<JSObject*> aOwningObject,
|
JS::Handle<JSObject*> aOwningObject,
|
||||||
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
nsAutoPtr<PrincipalInfo>& aPrincipalInfo,
|
||||||
uint64_t aInnerWindowID,
|
uint64_t aInnerWindowID,
|
||||||
IDBFactory** aFactory);
|
IDBFactory** aFactory,
|
||||||
|
bool aIsPrivateBrowsing);
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
AllowedForWindowInternal(nsPIDOMWindow* aWindow,
|
AllowedForWindowInternal(nsPIDOMWindow* aWindow,
|
||||||
|
@ -379,7 +379,8 @@ WorkerGlobalScope::GetIndexedDB(ErrorResult& aErrorResult)
|
|||||||
owningObject,
|
owningObject,
|
||||||
principalInfo,
|
principalInfo,
|
||||||
mWorkerPrivate->WindowID(),
|
mWorkerPrivate->WindowID(),
|
||||||
getter_AddRefs(indexedDB));
|
getter_AddRefs(indexedDB),
|
||||||
|
mWorkerPrivate->IsInPrivateBrowsing());
|
||||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||||
aErrorResult = rv;
|
aErrorResult = rv;
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
Loading…
Reference in New Issue
Block a user