diff --git a/mozilla/js/src/jsapi.c b/mozilla/js/src/jsapi.c index b3fe61cece1..ba9a79e0418 100644 --- a/mozilla/js/src/jsapi.c +++ b/mozilla/js/src/jsapi.c @@ -767,6 +767,12 @@ JS_DestroyRuntime(JSRuntime *rt) js_FreeRuntimeScriptState(rt); js_FinishAtomState(rt); + + /* + * Finish the deflated string cache after the last GC and after + * calling js_FinishAtomState, which finalizes strings. + */ + js_FinishDeflatedStringCache(rt); js_FinishGC(rt); #ifdef JS_THREADSAFE if (rt->gcLock) diff --git a/mozilla/js/src/jscntxt.c b/mozilla/js/src/jscntxt.c index 27c6a60f259..58d76fae7e0 100644 --- a/mozilla/js/src/jscntxt.c +++ b/mozilla/js/src/jscntxt.c @@ -409,12 +409,6 @@ js_DestroyContext(JSContext *cx, JSDestroyContextMode mode) if (rt->scriptFilenameTable && rt->scriptFilenameTable->nentries == 0) js_FinishRuntimeScriptState(rt); - /* - * Free the deflated string cache, but only after the last GC has - * collected all unleaked strings. - */ - js_FinishDeflatedStringCache(rt); - /* * Free unit string storage only after the last GC has completed, so * that js_FinalizeStringRT can detect unit strings and avoid calling