Bug 1174861 - Remove unnecessary Rooted from Prefable::isEnabled(). r=bholley
authorAndrew McCreight <continuation@gmail.com>
Mon, 15 Jun 2015 17:22:00 -0400
changeset 279995 05bd2af568e227f30bd4104a00f9939e8927140e
parent 279994 709775ec03a28f0af8a3fea313435862f0e9800b
child 279996 e8b8cdc974ab970f93ed444bb529af0dffdaf414
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1174861
milestone41.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 1174861 - Remove unnecessary Rooted from Prefable::isEnabled(). r=bholley
dom/bindings/DOMJSClass.h
--- a/dom/bindings/DOMJSClass.h
+++ b/dom/bindings/DOMJSClass.h
@@ -47,35 +47,33 @@ struct ConstantSpec
   const char* name;
   JS::Value value;
 };
 
 typedef bool (*PropertyEnabled)(JSContext* cx, JSObject* global);
 
 template<typename T>
 struct Prefable {
-  inline bool isEnabled(JSContext* cx, JSObject* obj) const {
+  inline bool isEnabled(JSContext* cx, JS::Handle<JSObject*> obj) const {
     if (!enabled) {
       return false;
     }
     if (!enabledFunc && !availableFunc && !checkPermissions) {
       return true;
     }
-    // Just go ahead and root obj, in case enabledFunc GCs
-    JS::Rooted<JSObject*> rootedObj(cx, obj);
     if (enabledFunc &&
-        !enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(rootedObj))) {
+        !enabledFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
       return false;
     }
     if (availableFunc &&
-        !availableFunc(cx, js::GetGlobalForObjectCrossCompartment(rootedObj))) {
+        !availableFunc(cx, js::GetGlobalForObjectCrossCompartment(obj))) {
       return false;
     }
     if (checkPermissions &&
-        !CheckPermissions(cx, js::GetGlobalForObjectCrossCompartment(rootedObj),
+        !CheckPermissions(cx, js::GetGlobalForObjectCrossCompartment(obj),
                           checkPermissions)) {
       return false;
     }
     return true;
   }
 
   // A boolean indicating whether this set of specs is enabled
   bool enabled;