$OpenBSD$ index 834326a..a44017b 100644 --- js/src/jsworkers.cpp.orig Fri Feb 20 15:40:37 2015 +++ js/src/jsworkers.cpp Fri Feb 20 15:40:37 2015 @@ -605,6 +605,14 @@ CallNewScriptHookForAllScripts(JSContext *cx, HandleScript script) CallNewScriptHook(cx, script, function); } +static void +LeaveParseTaskZone(JSRuntime *rt, ParseTask *task) +{ + // Mark the zone as no longer in use by an ExclusiveContext, and available + // to be collected by the GC. + rt->clearUsedByExclusiveThread(task->cx->zone()); +} + JSScript * GlobalWorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void *token) { @@ -625,12 +633,11 @@ GlobalWorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void } JS_ASSERT(parseTask); - // Mark the zone as no longer in use by an ExclusiveContext, and available - // to be collected by the GC. - rt->clearUsedByExclusiveThread(parseTask->cx->zone()); if (!maybecx) { + LeaveParseTaskZone(rt, parseTask); return nullptr; } + JSContext *cx = maybecx; JS_ASSERT(cx->compartment()); @@ -643,9 +650,12 @@ GlobalWorkerThreadState::finishParseTask(JSContext *maybecx, JSRuntime *rt, void !GlobalObject::ensureConstructor(cx, global, JSProto_RegExp) || !GlobalObject::ensureConstructor(cx, global, JSProto_Iterator)) { + LeaveParseTaskZone(rt, parseTask); return nullptr; } + LeaveParseTaskZone(rt, parseTask); + // Point the prototypes of any objects in the script's compartment to refer // to the corresponding prototype in the new compartment. This will briefly // create cross compartment pointers, which will be fixed by the