зеркало из https://github.com/mozilla/pjs.git
bug 580128 - Make the Window constructor be defined on new windows. r=peterv
This commit is contained in:
Родитель
529085f882
Коммит
a0d344d742
|
@ -2571,6 +2571,19 @@ nsJSContext::CreateOuterObject(nsIScriptGlobalObject *aGlobalObject,
|
|||
JS_SetOptions(mContext, JS_GetOptions(mContext) | JSOPTION_XML);
|
||||
}
|
||||
|
||||
nsIXPConnect *xpc = nsContentUtils::XPConnect();
|
||||
nsCOMPtr<nsIXPConnectJSObjectHolder> holder;
|
||||
|
||||
nsresult rv = xpc->WrapNative(mContext, aCurrentInner->GetGlobalJSObject(),
|
||||
aCurrentInner, NS_GET_IID(nsISupports),
|
||||
getter_AddRefs(holder));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper(do_QueryInterface(holder));
|
||||
NS_ABORT_IF_FALSE(wrapper, "bad wrapper");
|
||||
|
||||
wrapper->RefreshPrototype();
|
||||
|
||||
JSObject *outer =
|
||||
NS_NewOuterWindowProxy(mContext, aCurrentInner->GetGlobalJSObject());
|
||||
if (!outer) {
|
||||
|
|
|
@ -1124,6 +1124,12 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
|
|||
if(!scope)
|
||||
return UnexpectedFailure(NS_ERROR_FAILURE);
|
||||
|
||||
// Note: This call cooperates with a call to wrapper->RefreshPrototype()
|
||||
// in nsJSEnvironment::CreateOuterObject in order to ensure that the
|
||||
// prototype defines its constructor on the right global object.
|
||||
if(wrapper->GetProto()->GetScriptableInfo())
|
||||
scope->RemoveWrappedNativeProtos();
|
||||
|
||||
NS_ASSERTION(scope->GetGlobalJSObject() == tempGlobal, "stealing scope!");
|
||||
|
||||
scope->SetGlobal(ccx, globalJSObj);
|
||||
|
|
Загрузка…
Ссылка в новой задаче