I have a scenario that I had to remove compartment check from the original API. 

1 - There is a JavaScript code runs under "Context A". This code creates inner 
"Context B" wrapped into a "JSObject B". 

2 - GC somehow starts collecting under "Context A". And then it comes to 
"JSObject B". 

At this point, I unwrap "Context B" from "JSObject B". So, right at this 
moment, I have to call JS_Destroy / JS_DestroyNoGC on "Context B" in order to 
prevent the "LinkedList" breaking during JS_DestroyRuntime. 

The problem is the actual compartment is still under 'Context A' and both of 
the options fail. 

JS_PUBLIC_API(void)
JS_DestroyContext(JSContext *cx)
{
--->    JS_ASSERT(!cx->compartment());
    DestroyContext(cx, DCM_FORCE_GC);
}


And there is no option to enter a compartment when the GC is collecting. 

As a temporary solution, I have an alternative method that skips the check but 
I'm wondering what could go wrong ? or is there a better way to overcome this 
situation. 

_______________________________________________
dev-tech-js-engine-internals mailing list
dev-tech-js-engine-internals@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-tech-js-engine-internals

Reply via email to