12018-08-03 Ryosuke Niwa <rniwa@webkit.org>
2
3 Properties set on window.customElements can disappear due to GC
4 https://bugs.webkit.org/show_bug.cgi?id=172575
5 <rdar://problem/32440668>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Fixed the bug that JS wrapper of CustomElementsRegistry can erroneously get collected during GC
10 by keeping it alive as long as the global object is alive.
11
12 Test: fast/custom-elements/custom-element-registry-wrapper-should-stay-alive.html
13
14 * dom/CustomElementRegistry.cpp:
15 (WebCore::CustomElementRegistry::create):
16 (WebCore::CustomElementRegistry::CustomElementRegistry):
17 * dom/CustomElementRegistry.h:
18 (WebCore::CustomElementRegistry): Make this inherited from ContextDestructionObserver.
19 * dom/CustomElementRegistry.idl: Set GenerateIsReachable=ImplScriptExecutionContext in IDL. This will
20 make CustomElementRegistry reachable from the global object.
21 * page/DOMWindow.cpp:
22 (WebCore::DOMWindow::ensureCustomElementRegistry):
23