зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 307632. Make the DOM code wrap objects in the current inner window when requested to wrap an object in an outer window. This ensures that window.selection === selection, and window.selection.__proto__ === Selection.prototype. r=mrbkap@gmail.com, sr=brendan@mozilla.org
This commit is contained in:
Родитель
978063418a
Коммит
aee3973978
|
@ -373,6 +373,7 @@ enum nsDOMClassInfoID {
|
|||
nsIXPCScriptable::DONT_REFLECT_INTERFACE_NAMES | \
|
||||
nsIXPCScriptable::WANT_NEWRESOLVE | \
|
||||
nsIXPCScriptable::WANT_CHECKACCESS | \
|
||||
nsIXPCScriptable::WANT_PRECREATE | \
|
||||
nsIXPCScriptable::WANT_POSTCREATE)
|
||||
|
||||
#define DOM_DEFAULT_SCRIPTABLE_FLAGS \
|
||||
|
|
|
@ -3077,9 +3077,28 @@ NS_IMETHODIMP
|
|||
nsDOMClassInfo::PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj)
|
||||
{
|
||||
NS_ERROR("nsDOMClassInfo::PreCreate Don't call me!");
|
||||
*parentObj = globalObj;
|
||||
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
nsCOMPtr<nsIXPConnectWrappedNative> wrapper;
|
||||
nsresult rv =
|
||||
sXPConnect->GetWrappedNativeOfJSObject(cx, globalObj,
|
||||
getter_AddRefs(wrapper));
|
||||
if (NS_FAILED(rv)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> piwin = do_QueryWrappedNative(wrapper);
|
||||
|
||||
if (!piwin) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (piwin->IsOuterWindow()) {
|
||||
*parentObj = ((nsGlobalWindow *)piwin.get())->
|
||||
GetCurrentInnerWindowInternal()->GetGlobalJSObject();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
Загрузка…
Ссылка в новой задаче