[ES6 modules] Fix context leak. ModuleScript should use TraceWrapperV8Reference to hold onto v8::Module.
Before this CL, ModuleScript referenced v8::Module via SharedPersistent<> in ScriptModule. This created cycle of v8::Context -> V8PerContextData -> Modulator -> ModuleMap -> ModuleScript -(persistent)-> v8::Module -> v8::Context.
This CL breaks the cycle (partially) by making ModuleScript use TraceWrapperV8Reference to reference v8::Module, and create ScriptModule on the fly. More CLs will follow to break other parts of the cycle graph.
[ES6 modules] Detach ScriptModuleResolverImpl refs when detaching context.
Before this CL, we kept around strong v8::Module refs from ScriptModuleResolverImpl after the context is detached. v8::Module refers to the settings object Document via Modulator, so lead to leaks detected by Blink Leak Detector.
This CL detaches the v8::Module strong refs from ScriptModuleResolverImpl when we detach Document from the context.
This CL is meant to be a temporary fix. Ideally, we should convert all v8::Module refs in ScriptModuleResolverImpl to weak refs. However, it is not trivial as we need to rework ScriptModule.
Unblocking bugs and lowering the priority, as now the leak is workaround. Will be set to "Fixed" when the strong ref is removed from ScriptModuleResolverImpl.
kou… via monorail
unread,
May 31, 2017, 8:32:51 AM5/31/17
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
[ES6 modules] TraceWrapper from ScriptLoader and ModuleTreeLinkerRegistry
Before this CL, TraceWrapperV8References on ModuleScript were relying on trace from Modulator->ModuleMap. However, this is insufficient, as inline module scripts would not have an entry on module map.
This CL fixes the issue by introducing wrapper tracing to ScriptLoader and ModuleTreeLinkerRegistry->ModuleTreeLinker object graphs.
[ES6 modules] TraceWrapper ModuleScript via HTMLParserScriptRunner
This CL adds another TraceWrapper path to ModuleScript to cover case where: - Module script is an inline script - <script> element for the inline script is removed at the time of execution