Bug 627954, part 1: take out unnecessary compartment hack (r=gal)
authorLuke Wagner <lw@mozilla.com>
Tue, 01 Feb 2011 15:45:46 -0800
changeset 62404 d518bc36d7b4cc29b072902efe0b2fa3d4b7b4de
parent 62403 1b55728f51ad6428b1d3ee631eef5f98354b82fc
child 62405 02be97f9ef0dd3dc13f3eaeb982bc82fedbab608
push id18712
push usercleary@mozilla.com
push dateFri, 11 Feb 2011 17:56:41 +0000
treeherdermozilla-central@987efc5f8ba7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgal
bugs627954
milestone2.0b12pre
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 627954, part 1: take out unnecessary compartment hack (r=gal)
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -2300,29 +2300,22 @@ nsJSContext::GetGlobalObject()
 
   JSClass *c = JS_GET_CLASS(mContext, global);
 
   if (!c || ((~c->flags) & (JSCLASS_HAS_PRIVATE |
                             JSCLASS_PRIVATE_IS_NSISUPPORTS))) {
     return nsnull;
   }
 
-  JSAutoEnterCompartment ac;
-
-  // NB: This AutoCrossCompartmentCall is only here to silence a warning. If
-  // it fails, nothing bad will happen.
-  ac.enterAndIgnoreErrors(mContext, global);
-
-  nsCOMPtr<nsIScriptGlobalObject> sgo;
-  nsISupports *priv =
-    (nsISupports *)::JS_GetPrivate(mContext, global);
+  nsISupports *priv = (nsISupports *)global->getPrivate();
 
   nsCOMPtr<nsIXPConnectWrappedNative> wrapped_native =
     do_QueryInterface(priv);
 
+  nsCOMPtr<nsIScriptGlobalObject> sgo;
   if (wrapped_native) {
     // The global object is a XPConnect wrapped native, the native in
     // the wrapper might be the nsIScriptGlobalObject
 
     sgo = do_QueryWrappedNative(wrapped_native);
   } else {
     sgo = do_QueryInterface(priv);
   }