diff --git a/dom/src/base/nsJSEnvironment.cpp b/dom/src/base/nsJSEnvironment.cpp index 208c661f3ade..6408eccc8376 100644 --- a/dom/src/base/nsJSEnvironment.cpp +++ b/dom/src/base/nsJSEnvironment.cpp @@ -2313,9 +2313,10 @@ nsJSContext::ConnectToInner(nsIScriptGlobalObject *aNewInner, void *aOuterGlobal JSObject *newInnerJSObject = (JSObject *)aNewInner->GetScriptGlobal(JAVASCRIPT); JSObject *myobject = (JSObject *)aOuterGlobal; - // *Don't* call JS_ClearScope here since it's unnecessary - // and it confuses the JS engine as to which Function is - // on which window. See bug 343966. + // Call ClearScope to nuke any properties (e.g. Function and Object) on the + // outer object. From now on, anybody asking the outer object for these + // properties will be forwarded to the inner window. + ::JS_ClearScope(mContext, myobject); // Make the inner and outer window both share the same // prototype. The prototype we share is the outer window's diff --git a/js/src/xpconnect/src/nsXPConnect.cpp b/js/src/xpconnect/src/nsXPConnect.cpp index dd1db9bcc7a1..99997ebc06b7 100644 --- a/js/src/xpconnect/src/nsXPConnect.cpp +++ b/js/src/xpconnect/src/nsXPConnect.cpp @@ -1067,7 +1067,7 @@ TempGlobalResolve(JSContext *aJSContext, JSObject *obj, jsval id) } static JSClass xpcTempGlobalClass = { - "xpcTempGlobalClass", 0, + "xpcTempGlobalClass", JSCLASS_GLOBAL_FLAGS, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_PropertyStub, JS_EnumerateStub, TempGlobalResolve, JS_ConvertStub, JS_FinalizeStub, JSCLASS_NO_OPTIONAL_MEMBERS