diff --git a/js/src/jswrapper.cpp b/js/src/jswrapper.cpp index 3a0af41c2dee..808d8cde5ba4 100644 --- a/js/src/jswrapper.cpp +++ b/js/src/jswrapper.cpp @@ -295,6 +295,7 @@ JSObject * JSWrapper::New(JSContext *cx, JSObject *obj, JSObject *proto, JSObject *parent, JSWrapper *handler) { + JS_ASSERT(parent); return NewProxyObject(cx, handler, ObjectValue(*obj), proto, parent, obj->isCallable() ? obj : NULL, NULL); } @@ -345,6 +346,7 @@ AutoCompartment::enter() context->compartment = destination; JSObject *scopeChain = target->getGlobal(); + JS_ASSERT(scopeChain->isNative()); frame.construct(); if (!context->stack().pushDummyFrame(context, *scopeChain, &frame.ref())) { frame.destroy(); diff --git a/js/src/xpconnect/wrappers/WrapperFactory.cpp b/js/src/xpconnect/wrappers/WrapperFactory.cpp index 639c7cdc78d2..100fcb4249b8 100644 --- a/js/src/xpconnect/wrappers/WrapperFactory.cpp +++ b/js/src/xpconnect/wrappers/WrapperFactory.cpp @@ -71,7 +71,7 @@ DoubleWrap(JSContext *cx, JSObject *obj, uintN flags) { if (flags & WrapperFactory::WAIVE_XRAY_WRAPPER_FLAG) { js::SwitchToCompartment sc(cx, obj->compartment()); - return JSWrapper::New(cx, obj, NULL, obj->getParent(), + return JSWrapper::New(cx, obj, NULL, obj->getGlobal(), &WaiveXrayWrapperWrapper); } return obj; @@ -323,7 +323,7 @@ WrapperFactory::WaiveXrayAndWrap(JSContext *cx, jsval *vp) { js::SwitchToCompartment sc(cx, obj->compartment()); - obj = JSWrapper::New(cx, obj, NULL, obj->getParent(), &WaiveXrayWrapperWrapper); + obj = JSWrapper::New(cx, obj, NULL, obj->getGlobal(), &WaiveXrayWrapperWrapper); if (!obj) return false; }