Bug 981218 - Remove the JSAutoCompartment from cx pushing. r=bobowen
authorBobby Holley <bobbyholley@gmail.com>
Thu, 21 Aug 2014 17:13:50 -0700
changeset 222725 32f80f97a32116a1d7d17f6a2a5be534ab41e310
parent 222724 543af9cd7448d28c386c353d917fc3b889472d94
child 222726 18ffee30e06a9c90ce52123749f59b25bbddd7c7
push id3979
push userraliiev@mozilla.com
push dateMon, 13 Oct 2014 16:35:44 +0000
treeherdermozilla-beta@30f2cc610691 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbobowen
bugs981218
milestone34.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 981218 - Remove the JSAutoCompartment from cx pushing. r=bobowen By this point, AutoJSAPI takes care of entering the correct compartment, so this no longer serves a purpose.
dom/base/ScriptSettings.cpp
dom/base/ScriptSettings.h
--- a/dom/base/ScriptSettings.cpp
+++ b/dom/base/ScriptSettings.cpp
@@ -403,29 +403,22 @@ danger::AutoCxPusher::AutoCxPusher(JSCon
   mPushedContext = cx;
   mCompartmentDepthOnEntry = cx ? js::GetEnterCompartmentDepth(cx) : 0;
 #endif
 
   // Enter a request and a compartment for the duration that the cx is on the
   // stack if non-null.
   if (cx) {
     mAutoRequest.emplace(cx);
-
-    // DOM JSContexts don't store their default compartment object on the cx.
-    JSObject *compartmentObject = mScx ? mScx->GetWindowProxy()
-                                       : js::DefaultObjectForContextOrNull(cx);
-    if (compartmentObject)
-      mAutoCompartment.emplace(cx, compartmentObject);
   }
 }
 
 danger::AutoCxPusher::~AutoCxPusher()
 {
-  // Leave the compartment and request before popping.
-  mAutoCompartment.reset();
+  // Leave the request before popping.
   mAutoRequest.reset();
 
   // When we push a context, we may save the frame chain and pretend like we
   // haven't entered any compartment. This gets restored on Pop(), but we can
   // run into trouble if a Push/Pop are interleaved with a
   // JSAutoEnterCompartment. Make sure the compartment depth right before we
   // pop is the same as it was right after we pushed.
   MOZ_ASSERT_IF(mPushedContext, mCompartmentDepthOnEntry ==
--- a/dom/base/ScriptSettings.h
+++ b/dom/base/ScriptSettings.h
@@ -41,17 +41,16 @@ public:
   nsIScriptContext* GetScriptContext() { return mScx; }
 
   // Returns true if this AutoCxPusher performed the push that is currently at
   // the top of the cx stack.
   bool IsStackTop() const;
 
 private:
   mozilla::Maybe<JSAutoRequest> mAutoRequest;
-  mozilla::Maybe<JSAutoCompartment> mAutoCompartment;
   nsCOMPtr<nsIScriptContext> mScx;
   uint32_t mStackDepthAfterPush;
 #ifdef DEBUG
   JSContext* mPushedContext;
   unsigned mCompartmentDepthOnEntry;
 #endif
 };