Fix cross-origin access to the window.window getter. Bug 356474, r+sr=jst

git-svn-id: svn://10.0.0.236/trunk@213673 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2006-10-15 15:42:29 +00:00
parent 4fe7e728a5
commit 96e4988a5f

View File

@@ -6377,11 +6377,19 @@ nsWindowSH::NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
JSAutoRequest ar(cx);
if (!::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
::JS_GetStringLength(str),
OBJECT_TO_JSVAL(win->GetGlobalJSObject()),
nsnull, nsnull,
JSPROP_READONLY | JSPROP_ENUMERATE)) {
PRBool doSecurityCheckInAddProperty = sDoSecurityCheckInAddProperty;
sDoSecurityCheckInAddProperty = PR_FALSE;
PRBool ok =
::JS_DefineUCProperty(cx, obj, ::JS_GetStringChars(str),
::JS_GetStringLength(str),
OBJECT_TO_JSVAL(win->GetGlobalJSObject()),
nsnull, nsnull,
JSPROP_READONLY | JSPROP_ENUMERATE);
sDoSecurityCheckInAddProperty = doSecurityCheckInAddProperty;
if (!ok) {
return NS_ERROR_FAILURE;
}
*objp = obj;