зеркало из https://github.com/mozilla/gecko-dev.git
Bug 604087 - Minor tweaks to JS_TransplantWrapper and JSAutoEnterCompartment. r=mrbkap
This commit is contained in:
Родитель
b72cd88563
Коммит
32baaed5fe
|
@ -1296,9 +1296,9 @@ JS_TransplantWrapper(JSContext *cx, JSObject *wrapper, JSObject *target)
|
||||||
|
|
||||||
// First, we wrap it in the new compartment. This will return a
|
// First, we wrap it in the new compartment. This will return a
|
||||||
// new wrapper.
|
// new wrapper.
|
||||||
JSAutoEnterCompartment ec;
|
AutoCompartment ac(cx, wobj);
|
||||||
JSObject *tobj = obj;
|
JSObject *tobj = obj;
|
||||||
if (!ec.enter(cx, wobj) || !wcompartment->wrap(cx, &tobj))
|
if (!ac.enter() || !wcompartment->wrap(cx, &tobj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Now, because we need to maintain object identity, we do a brain
|
// Now, because we need to maintain object identity, we do a brain
|
||||||
|
@ -1313,9 +1313,9 @@ JS_TransplantWrapper(JSContext *cx, JSObject *wrapper, JSObject *target)
|
||||||
|
|
||||||
// Lastly, update the old outer window proxy to point to the new one.
|
// Lastly, update the old outer window proxy to point to the new one.
|
||||||
{
|
{
|
||||||
JSAutoEnterCompartment ac;
|
AutoCompartment ac(cx, wrapper);
|
||||||
JSObject *tobj = obj;
|
JSObject *tobj = obj;
|
||||||
if (!ac.enter(cx, wrapper) || !JS_WrapObject(cx, &tobj))
|
if (!ac.enter() || !JS_WrapObject(cx, &tobj))
|
||||||
return NULL;
|
return NULL;
|
||||||
if (!wrapper->swap(cx, tobj))
|
if (!wrapper->swap(cx, tobj))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -980,8 +980,6 @@ class JS_PUBLIC_API(JSAutoEnterCompartment)
|
||||||
|
|
||||||
void swap(JSAutoEnterCompartment &other) {
|
void swap(JSAutoEnterCompartment &other) {
|
||||||
JSCrossCompartmentCall *tmp = call;
|
JSCrossCompartmentCall *tmp = call;
|
||||||
if (tmp == reinterpret_cast<JSCrossCompartmentCall*>(1))
|
|
||||||
tmp = NULL;
|
|
||||||
call = other.call;
|
call = other.call;
|
||||||
other.call = tmp;
|
other.call = tmp;
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче