From dc74a1daaba03c2371db4e9763d42aad230d028f Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Thu, 14 Mar 2013 22:38:27 -0700 Subject: [PATCH] Bug 850517 - Remove nsWindowSH::GetProperty. r=mrbkap It no longer does anything useful. --- dom/base/nsDOMClassInfo.cpp | 74 +------------------------------------ dom/base/nsDOMClassInfo.h | 2 - 2 files changed, 1 insertion(+), 75 deletions(-) diff --git a/dom/base/nsDOMClassInfo.cpp b/dom/base/nsDOMClassInfo.cpp index c020b033ceb1..ccd05b29b72d 100644 --- a/dom/base/nsDOMClassInfo.cpp +++ b/dom/base/nsDOMClassInfo.cpp @@ -409,8 +409,7 @@ static const char kDOMStringBundleURL[] = // are defined in nsIDOMClassInfo.h. #define WINDOW_SCRIPTABLE_FLAGS \ - (nsIXPCScriptable::WANT_GETPROPERTY | \ - nsIXPCScriptable::WANT_PRECREATE | \ + (nsIXPCScriptable::WANT_PRECREATE | \ nsIXPCScriptable::WANT_FINALIZE | \ nsIXPCScriptable::WANT_ENUMERATE | \ nsIXPCScriptable::DONT_ENUM_QUERY_INTERFACE | \ @@ -3861,77 +3860,6 @@ nsWindowSH::InstallGlobalScopePolluter(JSContext *cx, JSObject *obj, return NS_OK; } -NS_IMETHODIMP -nsWindowSH::GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, - JSObject *obj, jsid id, jsval *vp, bool *_retval) -{ - DebugOnly win = nsGlobalWindow::FromWrapper(wrapper); - - JSAutoRequest ar(cx); - -#ifdef DEBUG_SH_FORWARDING - { - JSString *jsstr = ::JS_ValueToString(cx, id); - if (jsstr) { - nsDependentJSString str(jsstr); - - if (win->IsInnerWindow()) { -#ifdef DEBUG_PRINT_INNER - printf("Property '%s' get on inner window %p\n", - NS_ConvertUTF16toUTF8(str).get(), (void *)win); -#endif - } else { - printf("Property '%s' get on outer window %p\n", - NS_ConvertUTF16toUTF8(str).get(), (void *)win); - } - } - } -#endif - - // The order in which things are done in this method are a bit - // whacky, that's because this method is *extremely* performace - // critical. Don't touch this unless you know what you're doing. - - if (JSID_IS_STRING(id) && !JSVAL_IS_PRIMITIVE(*vp) && - ::JS_TypeOfValue(cx, *vp) != JSTYPE_FUNCTION) { - // A named property accessed which could have been resolved to a - // 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_GetClass(JSVAL_TO_OBJECT(*vp))->name; - - // The list of Window class names here need to be kept in sync - // with the actual class names! The class name - // XPCCrossOriginWrapper needs to be handled here too as XOWs - // define child frame names with a XOW as the value, and thus - // we'll need to get through here with XOWs class name too. - if ((*name == 'W' && strcmp(name, "Window") == 0) || - (*name == 'C' && strcmp(name, "ChromeWindow") == 0) || - (*name == 'M' && strcmp(name, "ModalContentWindow") == 0) || - (*name == 'I' && - (strcmp(name, "InnerWindow") == 0 || - strcmp(name, "InnerChromeWindow") == 0 || - strcmp(name, "InnerModalContentWindow") == 0)) || - (*name == 'X' && strcmp(name, "XPCCrossOriginWrapper") == 0)) { - nsCOMPtr window = do_QueryWrapper(cx, JSVAL_TO_OBJECT(*vp)); - - if (window) { - // Yup, *vp is a window object, return early (*vp is already - // the window, so no need to wrap it again). - - return NS_SUCCESS_I_DID_SOMETHING; - } - } - } - - return NS_OK; -} - struct ResolveGlobalNameClosure { JSContext* cx; diff --git a/dom/base/nsDOMClassInfo.h b/dom/base/nsDOMClassInfo.h index 555f5d9188dd..e5c00b78af4f 100644 --- a/dom/base/nsDOMClassInfo.h +++ b/dom/base/nsDOMClassInfo.h @@ -363,8 +363,6 @@ public: nsIXPCScriptable::WANT_POSTCREATE; } #endif - NS_IMETHOD GetProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx, - JSObject *obj, jsid id, jsval *vp, bool *_retval); NS_IMETHOD Enumerate(nsIXPConnectWrappedNative *wrapper, JSContext *cx, JSObject *obj, bool *_retval); NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,