Bug 930097 - Fix an exact rooting false positive in worker event dispatch; r=bent
authorTerrence Cole <terrence@mozilla.com>
Wed, 23 Oct 2013 15:32:50 -0700
changeset 165730 2dc38d7aba6f9125122c446d635747518948b320
parent 165729 04fc2a77dcad19d38f4d793a736a09c4e0013674
child 165731 9d1266f5c051ad7f05c9df990dc39dca18dfa08f
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs930097
milestone27.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 930097 - Fix an exact rooting false positive in worker event dispatch; r=bent
dom/workers/EventListenerManager.cpp
--- a/dom/workers/EventListenerManager.cpp
+++ b/dom/workers/EventListenerManager.cpp
@@ -333,39 +333,24 @@ EventListenerManager::DispatchEvent(JSCo
   }
 
   ListenerCollection* collection =
     GetCollectionForType(mCollections, INTERNED_STRING_TO_JSID(aCx, eventType));
   if (!collection) {
     return false;
   }
 
-  ContextAllocPolicy ap(aCx);
-
-  // XXXbent There is no reason to use nsAutoJSValHolder here as we should be
-  //         able to use js::AutoValueVector. Worse, nsAutoJSValHolder is much
-  //         slower. However, js::AutoValueVector causes crashes on Android at
-  //         the moment so we don't have much choice.
-  js::Vector<nsAutoJSValHolder, 10, ContextAllocPolicy> listeners(ap);
-
+  JS::AutoValueVector listeners(aCx);
   for (ListenerData* listenerData = collection->mListeners.getFirst();
        listenerData;
        listenerData = listenerData->getNext()) {
     // Listeners that don't want untrusted events will be skipped if this is an
     // untrusted event.
     if (eventIsTrusted || listenerData->mWantsUntrusted) {
-      nsAutoJSValHolder holder;
-      if (!holder.Hold(aCx)) {
-        aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
-        return false;
-      }
-
-      holder = listenerData->mListener;
-
-      if (!listeners.append(holder)) {
+      if (!listeners.append(OBJECT_TO_JSVAL(listenerData->mListener))) {
         aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
         return false;
       }
     }
   }
 
   if (listeners.empty()) {
     return false;