Bug 1319524 - Add JSAutoCompartment to GetNPObjectWrapper. r=bholley, a=ritu
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 29 Nov 2016 11:59:25 +0100
changeset 352779 f9e6219c5662390afc4ebfc27445c0b583036607
parent 352778 b7e54ef9cf8cafea209aca810b7f8aaae7dbe364
child 352780 3cde0a94e21bac52f2037f1f93cab1202e8e9f7e
push id6795
push userjlund@mozilla.com
push dateMon, 23 Jan 2017 14:19:46 +0000
treeherdermozilla-esr52@76101b503191 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley, ritu
bugs1319524
milestone52.0a2
Bug 1319524 - Add JSAutoCompartment to GetNPObjectWrapper. r=bholley, a=ritu
dom/plugins/base/nsJSNPRuntime.cpp
--- a/dom/plugins/base/nsJSNPRuntime.cpp
+++ b/dom/plugins/base/nsJSNPRuntime.cpp
@@ -1183,16 +1183,18 @@ GetNPObjectWrapper(JSContext *cx, JSObje
   JS::Rooted<JSObject*> obj(cx, aObj);
   while (obj && (obj = js::CheckedUnwrap(obj))) {
     if (nsNPObjWrapper::IsWrapper(obj)) {
       if (wrapResult && !JS_WrapObject(cx, &obj)) {
         return nullptr;
       }
       return obj;
     }
+
+    JSAutoCompartment ac(cx, obj);
     if (!::JS_GetPrototype(cx, obj, &obj)) {
       return nullptr;
     }
   }
   return nullptr;
 }
 
 static NPObject *