зеркало из https://github.com/mozilla/gecko-dev.git
Bug 761422, part 3 - get security wrappers before changing maps. r=bholley
This commit is contained in:
Родитель
e90b0700ba
Коммит
29adcd066e
|
@ -1606,6 +1606,16 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
|
||||||
JS_SetPrivate(flat, nullptr);
|
JS_SetPrivate(flat, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Before proceeding, eagerly create any same-compartment security wrappers
|
||||||
|
// that the object might have. This forces us to take the 'WithWrapper' path
|
||||||
|
// while transplanting that handles this stuff correctly.
|
||||||
|
{
|
||||||
|
JSAutoEnterCompartment innerAC;
|
||||||
|
if (!innerAC.enter(ccx, aOldScope->GetGlobalJSObject()) ||
|
||||||
|
!wrapper->GetSameCompartmentSecurityWrapper(ccx))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
{ // scoped lock
|
{ // scoped lock
|
||||||
Native2WrappedNativeMap* oldMap = aOldScope->GetWrappedNativeMap();
|
Native2WrappedNativeMap* oldMap = aOldScope->GetWrappedNativeMap();
|
||||||
Native2WrappedNativeMap* newMap = aNewScope->GetWrappedNativeMap();
|
Native2WrappedNativeMap* newMap = aNewScope->GetWrappedNativeMap();
|
||||||
|
@ -1641,16 +1651,6 @@ XPCWrappedNative::ReparentWrapperIfFound(XPCCallContext& ccx,
|
||||||
(void) newMap->Add(wrapper);
|
(void) newMap->Add(wrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Before proceeding, eagerly create any same-compartment security wrappers
|
|
||||||
// that the object might have. This forces us to take the 'WithWrapper' path
|
|
||||||
// while transplanting that handles this stuff correctly.
|
|
||||||
{
|
|
||||||
JSAutoEnterCompartment innerAC;
|
|
||||||
if (!innerAC.enter(ccx, aOldScope->GetGlobalJSObject()) ||
|
|
||||||
!wrapper->GetSameCompartmentSecurityWrapper(ccx))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSObject *ww = wrapper->GetWrapper();
|
JSObject *ww = wrapper->GetWrapper();
|
||||||
if (ww) {
|
if (ww) {
|
||||||
JSObject *newwrapper;
|
JSObject *newwrapper;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче