Bug 1319524 - Add JSAutoCompartment to GetNPObjectWrapper. r=bholley
authorJan de Mooij <jdemooij@mozilla.com>
Tue, 29 Nov 2016 11:59:25 +0100
changeset 324666 f15f2cb856457694dec7390802ccf5578a13e152
parent 324665 782e8cbcc2c07889fe018ef160c2515558b615a8
child 324667 8d8846f63b74eb930e48b410730ae088e9bdbee8
child 324691 892a0318ffbe197aa1342c93b5ff78715fab2a7b
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewersbholley
bugs1319524
milestone53.0a1
Bug 1319524 - Add JSAutoCompartment to GetNPObjectWrapper. r=bholley
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 *