Lazily construct Navigator serviceWorker
authoryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 20:51:20 +0000 (20:51 +0000)
committeryouenn@apple.com <youenn@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 8 Apr 2019 20:51:20 +0000 (20:51 +0000)
commitb6ed79a8b6d9f58b31939b2a63c10d4bdd6ceed9
treeacb2a7787c23b295796448f304c24cbc5d14ba3f
parent839d785672cc64e4f11fa5dc45e005a9dea736a3
Lazily construct Navigator serviceWorker
https://bugs.webkit.org/show_bug.cgi?id=196692

Reviewed by Chris Dumez.

Make NavigatorBase a ContextDestructionObserver.
This allows to get the navigator script execution context.
Use it when creating the navigator ServiceWorkerContainer object.
For GC, introduce serviceWorkerIfAny which returns the container if created.
No JS observable change of behavior.
Covered by existing tests.

* bindings/js/JSNavigatorCustom.cpp:
(WebCore::JSNavigator::visitAdditionalChildren):
* bindings/js/JSWorkerNavigatorCustom.cpp:
(WebCore::JSWorkerNavigator::visitAdditionalChildren):
* page/NavigatorBase.cpp:
(WebCore::NavigatorBase::NavigatorBase):
(WebCore::NavigatorBase::serviceWorkerIfAny):
(WebCore::NavigatorBase::serviceWorker):
* page/NavigatorBase.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/JSNavigatorCustom.cpp
Source/WebCore/bindings/js/JSWorkerNavigatorCustom.cpp
Source/WebCore/page/NavigatorBase.cpp
Source/WebCore/page/NavigatorBase.h