Enter compartment while initializing in CreateDedicatedWorkerGlobalScope, bug 701458. r=bent
authorBrian Hackett <bhackett1024@gmail.com>
Thu, 10 Nov 2011 12:04:24 -0800
changeset 80146 6da51a2cebb0177a3e7efb0c0ee58d0aaeb30ebe
parent 80145 33d34da275ed942822531afb7b3739579dfb67a5
child 80147 bd9c1c9707b0a0a61ac7b57578357bf7c4349514
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersbent
bugs701458
milestone11.0a1
Enter compartment while initializing in CreateDedicatedWorkerGlobalScope, bug 701458. r=bent
dom/workers/WorkerScope.cpp
--- a/dom/workers/WorkerScope.cpp
+++ b/dom/workers/WorkerScope.cpp
@@ -827,16 +827,21 @@ CreateDedicatedWorkerGlobalScope(JSConte
 
   JSObject* global =
     JS_NewCompartmentAndGlobalObject(aCx, DedicatedWorkerGlobalScope::Class(),
                                      GetWorkerPrincipal());
   if (!global) {
     return NULL;
   }
 
+  JSAutoEnterCompartment ac;
+  if (!ac.enter(aCx, global)) {
+    return NULL;
+  }
+
   // Make the private slots now so that all our instance checks succeed.
   if (!DedicatedWorkerGlobalScope::InitPrivate(aCx, global, worker)) {
     return NULL;
   }
 
   // Proto chain should be:
   //   global -> DedicatedWorkerGlobalScope
   //          -> WorkerGlobalScope