Support "name" option for dedicated workers
authoryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2018 04:58:26 +0000 (04:58 +0000)
committeryusukesuzuki@slowstart.org <yusukesuzuki@slowstart.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Aug 2018 04:58:26 +0000 (04:58 +0000)
commit07c0cbe318ff671deeb00c644a84a1470a96b082
tree239afaa9c61b0c02a888929458d18070b0c8e687
parent2646465aec7b5c476149ffa68d5728dba3bf4288
Support "name" option for dedicated workers
https://bugs.webkit.org/show_bug.cgi?id=188779

Reviewed by Joseph Pecoraro.

LayoutTests/imported/w3c:

* web-platform-tests/workers/interfaces.worker-expected.txt:
* web-platform-tests/workers/name-property-expected.txt:

Source/WebCore:

This patch adds `new Worker(url, { name: "Worker Name" })` option support[1].
This name can be accessible from `self.name` of DedicatedWorkerGlobalScope.
It is useful for debugging dedicated workers if the inspector can show the
names of the workers. This enhancement is tracked by [2].

[1]: https://github.com/whatwg/html/issues/2477
[2]: https://bugs.webkit.org/show_bug.cgi?id=164678

Tests: http/wpt/workers/name-property-enhanced.html
       http/wpt/workers/name-property-no-name.html

* workers/DedicatedWorkerGlobalScope.cpp:
(WebCore::DedicatedWorkerGlobalScope::create):
(WebCore::DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope):
Hold `name` member.

* workers/DedicatedWorkerGlobalScope.h:
* workers/DedicatedWorkerGlobalScope.idl:
Add `name` attribute.

* workers/DedicatedWorkerThread.cpp:
(WebCore::DedicatedWorkerThread::DedicatedWorkerThread):
(WebCore::DedicatedWorkerThread::createWorkerGlobalScope):
* workers/DedicatedWorkerThread.h:
* workers/Worker.cpp:
(WebCore::Worker::Worker):
(WebCore::Worker::create):
(WebCore::Worker::notifyFinished):
* workers/Worker.h:
* workers/Worker.idl:
Add WorkerOptions for dedicated worker creation.

* workers/WorkerGlobalScopeProxy.h:
* workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* workers/WorkerMessagingProxy.h:
* workers/WorkerThread.cpp:
(WebCore::WorkerThreadStartupData::WorkerThreadStartupData):
Isolate copy the given `name` to pass the worker thread.

(WebCore::WorkerThread::WorkerThread):
(WebCore::WorkerThread::workerThread):
* workers/WorkerThread.h:
* workers/service/context/ServiceWorkerThread.cpp:
(WebCore::ServiceWorkerThread::ServiceWorkerThread):
(WebCore::ServiceWorkerThread::createWorkerGlobalScope):
* workers/service/context/ServiceWorkerThread.h:

LayoutTests:

* http/wpt/workers/name-property-enhanced-expected.txt: Added.
* http/wpt/workers/name-property-enhanced.html: Added.
* http/wpt/workers/name-property-no-name-expected.txt: Added.
* http/wpt/workers/name-property-no-name.html: Added.
* http/wpt/workers/support/name.js: Added.
(test):
* http/wpt/workers/support/no-name.js: Added.
(test):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@235159 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
LayoutTests/ChangeLog
LayoutTests/http/wpt/workers/name-property-enhanced-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/workers/name-property-enhanced.html [new file with mode: 0644]
LayoutTests/http/wpt/workers/name-property-no-name-expected.txt [new file with mode: 0644]
LayoutTests/http/wpt/workers/name-property-no-name.html [new file with mode: 0644]
LayoutTests/http/wpt/workers/support/name.js [new file with mode: 0644]
LayoutTests/http/wpt/workers/support/no-name.js [new file with mode: 0644]
LayoutTests/imported/w3c/ChangeLog
LayoutTests/imported/w3c/web-platform-tests/workers/interfaces.worker-expected.txt
LayoutTests/imported/w3c/web-platform-tests/workers/name-property-expected.txt
Source/WebCore/ChangeLog
Source/WebCore/workers/DedicatedWorkerGlobalScope.cpp
Source/WebCore/workers/DedicatedWorkerGlobalScope.h
Source/WebCore/workers/DedicatedWorkerGlobalScope.idl
Source/WebCore/workers/DedicatedWorkerThread.cpp
Source/WebCore/workers/DedicatedWorkerThread.h
Source/WebCore/workers/Worker.cpp
Source/WebCore/workers/Worker.h
Source/WebCore/workers/Worker.idl
Source/WebCore/workers/WorkerGlobalScopeProxy.h
Source/WebCore/workers/WorkerMessagingProxy.cpp
Source/WebCore/workers/WorkerMessagingProxy.h
Source/WebCore/workers/WorkerThread.cpp
Source/WebCore/workers/WorkerThread.h
Source/WebCore/workers/service/context/ServiceWorkerThread.cpp
Source/WebCore/workers/service/context/ServiceWorkerThread.h