Bug 945416 part 1. Move the Components shim into GlobalResolve. r=bholley
authorBoris Zbarsky <bzbarsky@mit.edu>
Wed, 29 Jan 2014 22:33:20 -0800
changeset 181957 16fd42fa8fc871c670501f80cd1dbf2d54ed675e
parent 181956 9e1b8cf5f2b269b80439a20837085f9b17e7bd09
child 181958 6674a720f76f870d66fc340b46592c6deb34f8fd
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs945416
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 945416 part 1. Move the Components shim into GlobalResolve. r=bholley
dom/base/nsDOMClassInfo.cpp
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -2795,22 +2795,30 @@ OldBindingConstructorEnabled(const nsGlo
   // Don't expose CSSFontFeatureValuesRule unless the pref is enabled
   if (aStruct->mDOMClassInfoID == eDOMClassInfo_CSSFontFeatureValuesRule_id) {
     return nsCSSFontFeatureValuesRule::PrefEnabled();
   }
 
   return true;
 }
 
+static nsresult
+DefineComponentsShim(JSContext *cx, JS::Handle<JSObject*> global, nsPIDOMWindow *win);
+
 // static
 nsresult
 nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
                           JS::Handle<JSObject*> obj, JS::Handle<jsid> id,
                           bool *did_resolve)
 {
+  if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_COMPONENTS)) {
+    *did_resolve = true;
+    return DefineComponentsShim(cx, obj, aWin);
+  }
+
   *did_resolve = false;
 
   nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
   NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
 
   nsDependentJSString name(id);
 
   const char16_t *class_name = nullptr;
@@ -3253,21 +3261,16 @@ nsWindowSH::NewResolve(nsIXPConnectWrapp
     return NS_OK;
   }
 
   MOZ_ASSERT(*_retval == true); // guaranteed by XPC_WN_Helper_NewResolve
 
   nsGlobalWindow *win = nsGlobalWindow::FromWrapper(wrapper);
   MOZ_ASSERT(win->IsInnerWindow());
 
-  if (id == XPCJSRuntime::Get()->GetStringID(XPCJSRuntime::IDX_COMPONENTS)) {
-    *objp = obj;
-    return DefineComponentsShim(cx, obj, win);
-  }
-
   // Don't resolve standard classes on XrayWrappers, only resolve them if we're
   // resolving on the real global object.
   bool isXray = xpc::WrapperFactory::IsXrayWrapper(obj);
   if (!isXray) {
     bool did_resolve = false;
     if (!JS_ResolveStandardClass(cx, obj, id, &did_resolve)) {
       // Return NS_OK to avoid stomping over the exception that was passed
       // down from the ResolveStandardClass call.