Bug 869800 - Remove JS_GetGlobalObject from workers. r=bent
authorBobby Holley <bobbyholley@gmail.com>
Wed, 08 May 2013 10:45:46 -0700
changeset 142220 cbebcd9f25319ce2f9d7a5ac781e982aa13a29dd
parent 142219 ce96360f44f56ca0b3509a0ce989b1eef66733ec
child 142221 469e647ccbf5b04df168bc249742eb2c57e1fe14
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs869800
milestone23.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 869800 - Remove JS_GetGlobalObject from workers. r=bent
dom/workers/ScriptLoader.cpp
dom/workers/WorkerPrivate.cpp
dom/workers/WorkerScope.cpp
--- a/dom/workers/ScriptLoader.cpp
+++ b/dom/workers/ScriptLoader.cpp
@@ -628,17 +628,17 @@ ScriptExecutorRunnable::WorkerRun(JSCont
     NS_ASSERTION(!loadInfo.mChannel, "Should no longer have a channel!");
     NS_ASSERTION(loadInfo.mExecutionScheduled, "Should be scheduled!");
 
     if (!loadInfo.mExecutionResult) {
       return true;
     }
   }
 
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  JS::RootedObject global(aCx, JS_GetGlobalForScopeChain(aCx));
   NS_ASSERTION(global, "Must have a global by now!");
 
   JSPrincipals* principal = GetWorkerPrincipal();
   NS_ASSERTION(principal, "This should never be null!");
 
   for (uint32_t index = mFirstIndex; index <= mLastIndex; index++) {
     ScriptLoadInfo& loadInfo = loadInfos.ElementAt(index);
 
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -716,17 +716,17 @@ public:
   CloseEventRunnable(WorkerPrivate* aWorkerPrivate)
   : WorkerRunnable(aWorkerPrivate, WorkerThread, UnchangedBusyCount,
                    SkipWhenClearing)
   { }
 
   bool
   WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
   {
-    JS::Rooted<JSObject*> target(aCx, JS_GetGlobalObject(aCx));
+    JS::Rooted<JSObject*> target(aCx, JS_GetGlobalForScopeChain(aCx));
     NS_ASSERTION(target, "This must never be null!");
 
     aWorkerPrivate->CloseHandlerStarted();
 
     JSString* type = JS_InternString(aCx, "close");
     if (!type) {
       return false;
     }
@@ -805,17 +805,17 @@ public:
       }
 
       aWorkerPrivate->AssertInnerWindowIsCorrect();
     }
     else {
       NS_ASSERTION(aWorkerPrivate == GetWorkerPrivateFromContext(aCx),
                    "Badness!");
       mainRuntime = false;
-      target = JS_GetGlobalObject(aCx);
+      target = JS_GetGlobalForScopeChain(aCx);
     }
 
     NS_ASSERTION(target, "This should never be null!");
 
     JSObject* event =
       CreateMessageEvent(aCx, buffer, mClonedObjects, mainRuntime);
     if (!event) {
       return false;
@@ -1520,17 +1520,17 @@ WorkerRunnable::Dispatch(JSContext* aCx)
       ok = DispatchInternal();
     }
     PostDispatch(nullptr, mWorkerPrivate, ok);
     return ok;
   }
 
   JSAutoRequest ar(aCx);
 
-  JSObject* global = JS_GetGlobalObject(aCx);
+  JSObject* global = JS_GetGlobalForScopeChain(aCx);
 
   Maybe<JSAutoCompartment> ac;
   if (global) {
     ac.construct(aCx, global);
   }
 
   ok = PreDispatch(aCx, mWorkerPrivate);
 
@@ -1617,17 +1617,17 @@ WorkerRunnable::Run()
       AssertIsOnMainThread();
       pusher.Push(cx);
     }
   }
 
   JS::Rooted<JSObject*> targetCompartmentObject(cx);
 
   if (mTarget == WorkerThread) {
-    targetCompartmentObject = JS_GetGlobalObject(cx);
+    targetCompartmentObject = JS_GetGlobalForScopeChain(cx);
   } else {
     targetCompartmentObject = mWorkerPrivate->GetJSObject();
   }
 
   NS_ASSERTION(cx, "Must have a context!");
 
   JSAutoRequest ar(cx);
 
@@ -3594,17 +3594,17 @@ WorkerPrivate::NotifyInternal(JSContext*
 
   // If we've run the close handler, we don't need to do anything else.
   if (mCloseHandlerFinished) {
     return true;
   }
 
   // If the worker script never ran, or failed to compile, we don't need to do
   // anything else, except pretend that we ran the close handler.
-  if (!JS_GetGlobalObject(aCx)) {
+  if (!JS_GetGlobalForScopeChain(aCx)) {
     mCloseHandlerStarted = true;
     mCloseHandlerFinished = true;
     return true;
   }
 
   // If this is the first time our status has changed we also need to schedule
   // the close handler unless we're being shut down.
   if (previousStatus == Running && aStatus != Killing) {
@@ -3919,17 +3919,17 @@ WorkerPrivate::RunExpiredTimeouts(JSCont
   }
 
   NS_ASSERTION(mTimer, "Must have a timer!");
   NS_ASSERTION(!mTimeouts.IsEmpty(), "Should have some work to do!");
 
   bool retval = true;
 
   AutoPtrComparator<TimeoutInfo> comparator = GetAutoPtrComparator(mTimeouts);
-  JS::RootedObject global(aCx, JS_GetGlobalObject(aCx));
+  JS::RootedObject global(aCx, JS_GetGlobalForScopeChain(aCx));
   JSPrincipals* principal = GetWorkerPrincipal();
 
   // We want to make sure to run *something*, even if the timer fired a little
   // early. Fudge the value of now to at least include the first timeout.
   const TimeStamp now = std::max(TimeStamp::Now(), mTimeouts[0]->mTargetTime);
 
   nsAutoTArray<TimeoutInfo*, 10> expiredTimeouts;
   for (uint32_t index = 0; index < mTimeouts.Length(); index++) {
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -350,17 +350,17 @@ private:
 
     if (JSVAL_IS_PRIMITIVE(aVp)) {
       JS_ReportError(aCx, "Not an event listener!");
       return false;
     }
 
     JSFunction* adaptor =
       js::NewFunctionWithReserved(aCx, UnwrapErrorEvent, 1, 0,
-                                  JS_GetGlobalObject(aCx), "unwrap");
+                                  JS_GetGlobalForScopeChain(aCx), "unwrap");
     if (!adaptor) {
       return false;
     }
 
     JSObject* listener = JS_GetFunctionObject(adaptor);
     if (!listener) {
       return false;
     }