Fixing bug 406671. Speed up nsWindowSH::GetProperty(). r+sr=peterv@propagandism.org, a=jonas@sicking.cc

This commit is contained in:
jst@mozilla.org 2007-12-03 19:53:00 -08:00
parent d91b8ab657
commit e1961ddec2

View File

@ -4466,7 +4466,18 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
// child frame in nsWindowSH::NewResolve() (*vp will tell us if
// that's the case). If *vp is a window object (i.e. a child
// frame), return without doing a security check.
//
// Calling GetWrappedNativeOfJSObject() is not all that cheap, so
// only do that if the JSClass name is one that is likely to be a
// window object.
const char *name = JS_GET_CLASS(cx, JSVAL_TO_OBJECT(*vp))->name;
// The list of Window class names here need to be kept in sync
// with the actual class names!
if ((*name == 'W' && strcmp(name, "Window") == 0) ||
(*name == 'C' && strcmp(name, "ChromeWindow") == 0) ||
(*name == 'M' && strcmp(name, "ModalContentWindow") == 0)) {
nsCOMPtr<nsIXPConnectWrappedNative> vpwrapper;
sXPConnect->GetWrappedNativeOfJSObject(cx, JSVAL_TO_OBJECT(*vp),
getter_AddRefs(vpwrapper));
@ -4482,6 +4493,7 @@ nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
}
}
}
}
return NS_OK;
}