diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp index f80ae462cd..a19bdfc6eb 100644 --- a/js/src/frontend/ParseNode.cpp +++ b/js/src/frontend/ParseNode.cpp @@ -293,6 +293,8 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack) case PNK_SETTHIS: case PNK_FOR: case PNK_COMPREHENSIONFOR: + case PNK_IMPORT_META: + case PNK_CALL_IMPORT: case PNK_WITH: { BinaryNode* bn = &pn->as(); stack->push(bn->left()); @@ -493,8 +495,6 @@ PushNodeChildren(ParseNode* pn, NodeStack* stack) case PNK_EXPORT_SPEC_LIST: case PNK_PARAMSBODY: case PNK_CLASSMETHODLIST: - case PNK_IMPORT_META: - case PNK_CALL_IMPORT: return PushListNodeChildren(&pn->as(), stack); // Array comprehension nodes are lists with a single child: diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index e6308ceb22..ddb33a4de0 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1375,6 +1375,16 @@ ScriptSourceObject::finalize(FreeOp* fop, JSObject* obj) sso->source()->decref(); sso->setReservedSlot(SOURCE_SLOT, PrivateValue(nullptr)); + + Value value = sso->canonicalPrivate(); + if (!value.isUndefined()) { + // The embedding may need to dispose of its private data. + JS::AutoSuppressGCAnalysis suppressGC; + if (JS::ScriptPrivateFinalizeHook hook = + fop->runtime()->scriptPrivateFinalizeHook) { + hook(fop, value); + } + } } static const ClassOps ScriptSourceObjectClassOps = {