Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,3 +1,18 @@
+2021-02-20 Yusuke Suzuki <[email protected]>
+
+ Support modules in service workers
+ https://bugs.webkit.org/show_bug.cgi?id=222155
+
+ Reviewed by Saam Barati.
+
+ * web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.tentative-expected.txt:
+ * web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/performance-timeline.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/update.https-expected.txt:
+ * web-platform-tests/service-workers/service-worker/worker-client-id.https-expected.txt:
+
2021-02-20 Rob Buis <[email protected]>
"min-content" & "max-content" keywords should behave as initial value in block axis (but WebKit improperly treats them as the content-size)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.tentative-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.tentative-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/json-module/json-module-service-worker-test.https.tentative-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,5 +1,5 @@
-FAIL _javascript_ importing JSON Module should load within the context of a service worker promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected string literal './module.json'. import call expects exactly one argument."
+FAIL _javascript_ importing JSON Module should load within the context of a service worker promise_test: Unhandled rejection with value: object "TypeError: TypeError: 'application/json' is not a valid _javascript_ MIME type."
FAIL JSON Modules should load within the context of a service worker promise_test: Unhandled rejection with value: object "SecurityError: MIME Type is not a _javascript_ MIME type"
PASS JSON Module dynamic import should not load within the context of a service worker
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/clients-matchall-client-types.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,5 +1,4 @@
-
PASS Verify matchAll() with window client type
FAIL Verify matchAll() with {window, sharedworker, worker} client types promise_test: Unhandled rejection with value: object "ReferenceError: Can't find variable: SharedWorker"
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/import-module-scripts.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,7 +1,7 @@
-FAIL Static import. promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument."
-FAIL Nested static import. promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument."
-FAIL Static import and then dynamic import. promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument."
+PASS Static import.
+PASS Nested static import.
+PASS Static import and then dynamic import.
PASS Dynamic import.
PASS Nested dynamic import.
PASS Dynamic import and then static import.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/performance-timeline.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,7 +1,7 @@
PASS Test Performance Timeline API in Service Worker
-FAIL empty service worker fetch event included in performance timings assert_greater_than: Slow service worker request should measure increased delay. expected a number greater than 1012 but got 12
+FAIL empty service worker fetch event included in performance timings assert_greater_than: Slow service worker request should measure increased delay. expected a number greater than 1136 but got 135
PASS User Timing
-FAIL Resource Timing assert_equals: expected 2 but got 1
+PASS Resource Timing
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update-registration-with-type.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,9 +1,9 @@
-FAIL Update the registration with a different script type (classic => module). promise_test: Unhandled rejection with value: object "TypeError: null is not an object (evaluating 'secondWorker.postMessage')"
-FAIL Update the registration with a different script type (module => classic). promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument."
+PASS Update the registration with a different script type (classic => module).
+PASS Update the registration with a different script type (module => classic).
PASS Update the registration with a different script type (classic => module) and with a same main script.
PASS Update the registration with a different script type (module => classic) and with a same main script.
PASS Does not update the registration with the same script type and the same main script.
-FAIL Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed. assert_unreached: Should have rejected: Registering with invalid evaluation should be failed. Reached unreachable code
-FAIL Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed. promise_test: Unhandled rejection with value: object "TypeError: SyntaxError: Unexpected token '*'. import call expects exactly one argument."
+PASS Update the registration with a different script type (classic => module) and with a same main script. Expect evaluation failed.
+PASS Update the registration with a different script type (module => classic) and with a same main script. Expect evaluation failed.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/update.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,7 +1,9 @@
PASS update() should succeed when new script is available.
PASS update() should fail when mime type is invalid.
-FAIL update() should fail when a response for the main script is redirect. assert_throws: function "function () { throw e }" threw object "SecurityError: Script https://localhost:9443/service-workers/service-worker/resources/update-worker.py?Key=53187c6b-e588-48ee-ad9b-272fe38aa9b8&Mode=redirect load failed" ("SecurityError") expected object "TypeError" ("TypeError")
+FAIL update() should fail when a response for the main script is redirect. promise_rejects_js: function "function () { throw e }" threw object "SecurityError: Script https://localhost:9443/service-workers/service-worker/resources/update-worker.py?Key=48e2907e-b632-491a-b285-2fd2b666386a&Mode=redirect load failed" ("SecurityError") expected instance of function "function TypeError() {
+ [native code]
+}" ("TypeError")
PASS update() should fail when a new script contains a syntax error.
PASS update() should resolve when the install event throws.
PASS update() should fail when the pending uninstall flag is set.
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-client-id.https-expected.txt (273223 => 273224)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-client-id.https-expected.txt 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/worker-client-id.https-expected.txt 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,3 +1,3 @@
-FAIL Verify workers have a unique client id separate from their owning documents window assert_not_equals: frame and worker client ids should be different got disallowed value "102-1083"
+FAIL Verify workers have a unique client id separate from their owning documents window assert_not_equals: frame and worker client ids should be different got disallowed value "12-358"
Modified: trunk/Source/WebCore/ChangeLog (273223 => 273224)
--- trunk/Source/WebCore/ChangeLog 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/ChangeLog 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1,3 +1,45 @@
+2021-02-20 Yusuke Suzuki <[email protected]>
+
+ Support modules in service workers
+ https://bugs.webkit.org/show_bug.cgi?id=222155
+
+ Reviewed by Saam Barati.
+
+ This patch adds module support to service-workers. Basically this just plumbs the type: "module" information to
+ service worker's job as described in the spec[1]: Each SW job should have workerType, and this is passed.
+ And we sometimes compare newestWorker->type() with this job.workerType (as defined in the spec). And we spawn
+ the SW with this job.workerType. Since Worker already supports "module" evaluation, this is automatically evaluated
+ as modules if we spawn SW thread with "module" type.
+
+ When using, we can pass "module" type to the register method as follows.
+
+ navigator.serviceWorker.register('script.mjs', {
+ type: "module"
+ });
+
+ [1]: https://w3c.github.io/ServiceWorker/
+
+ * workers/service/ServiceWorker.h:
+ * workers/service/ServiceWorkerContainer.cpp:
+ (WebCore::ServiceWorkerContainer::addRegistration):
+ (WebCore::ServiceWorkerContainer::updateRegistration):
+ * workers/service/ServiceWorkerJobData.cpp:
+ (WebCore::ServiceWorkerJobData::isolatedCopy const):
+ (WebCore::ServiceWorkerJobData::isEquivalent const):
+ * workers/service/ServiceWorkerJobData.h:
+ (WebCore::ServiceWorkerJobData::encode const):
+ (WebCore::ServiceWorkerJobData::decode):
+ * workers/service/ServiceWorkerRegistration.cpp:
+ (WebCore::ServiceWorkerRegistration::update):
+ * workers/service/context/ServiceWorkerThread.cpp:
+ (WebCore::ServiceWorkerThread::ServiceWorkerThread):
+ * workers/service/server/SWServer.cpp:
+ (WebCore::SWServer::softUpdate):
+ * workers/service/server/SWServerJobQueue.cpp:
+ (WebCore::SWServerJobQueue::scriptFetchFinished):
+ (WebCore::SWServerJobQueue::runRegisterJob):
+ (WebCore::SWServerJobQueue::runUpdateJob):
+
2021-02-21 Zalan Bujtas <[email protected]>
[LFC][IFC] Hittest should be using the border box (and not the margin box)
Modified: trunk/Source/WebCore/workers/service/ServiceWorker.h (273223 => 273224)
--- trunk/Source/WebCore/workers/service/ServiceWorker.h 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/ServiceWorker.h 2021-02-21 21:54:24 UTC (rev 273224)
@@ -64,6 +64,7 @@
ServiceWorkerIdentifier identifier() const { return m_data.identifier; }
ServiceWorkerRegistrationIdentifier registrationIdentifier() const { return m_data.registrationIdentifier; }
+ WorkerType workerType() const { return m_data.type; }
using RefCounted::ref;
using RefCounted::deref;
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerContainer.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -184,6 +184,7 @@
jobData.clientCreationURL = context->url();
jobData.topOrigin = context->topOrigin().data();
+ jobData.workerType = options.type;
jobData.type = ServiceWorkerJobType::Register;
jobData.registrationOptions = options;
@@ -205,7 +206,7 @@
});
}
-void ServiceWorkerContainer::updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType, RefPtr<DeferredPromise>&& promise)
+void ServiceWorkerContainer::updateRegistration(const URL& scopeURL, const URL& scriptURL, WorkerType workerType, RefPtr<DeferredPromise>&& promise)
{
ASSERT(!m_isStopped);
@@ -221,6 +222,7 @@
ServiceWorkerJobData jobData(m_swConnection->serverConnectionIdentifier(), contextIdentifier());
jobData.clientCreationURL = context.url();
jobData.topOrigin = context.topOrigin().data();
+ jobData.workerType = workerType;
jobData.type = ServiceWorkerJobType::Update;
jobData.scopeURL = scopeURL;
jobData.scriptURL = scriptURL;
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobData.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -63,6 +63,7 @@
ServiceWorkerJobData result;
result.m_identifier = identifier();
result.sourceContext = sourceContext;
+ result.workerType = workerType;
result.type = type;
result.scriptURL = scriptURL.isolatedCopy();
@@ -85,7 +86,7 @@
case ServiceWorkerJobType::Update:
return scopeURL == job.scopeURL
&& scriptURL == job.scriptURL
- && registrationOptions.type == job.registrationOptions.type
+ && workerType == job.workerType
&& registrationOptions.updateViaCache == job.registrationOptions.updateViaCache;
case ServiceWorkerJobType::Unregister:
return scopeURL == job.scopeURL;
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h (273223 => 273224)
--- trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerJobData.h 2021-02-21 21:54:24 UTC (rev 273224)
@@ -52,6 +52,7 @@
SecurityOriginData topOrigin;
URL scopeURL;
ServiceWorkerOrClientIdentifier sourceContext;
+ WorkerType workerType;
ServiceWorkerJobType type;
ServiceWorkerRegistrationOptions registrationOptions;
@@ -72,7 +73,7 @@
template<class Encoder>
void ServiceWorkerJobData::encode(Encoder& encoder) const
{
- encoder << identifier() << scriptURL << clientCreationURL << topOrigin << scopeURL << sourceContext;
+ encoder << identifier() << scriptURL << clientCreationURL << topOrigin << scopeURL << sourceContext << workerType;
encoder << type;
switch (type) {
case ServiceWorkerJobType::Register:
@@ -110,6 +111,8 @@
return WTF::nullopt;
if (!decoder.decode(jobData.sourceContext))
return WTF::nullopt;
+ if (!decoder.decode(jobData.workerType))
+ return WTF::nullopt;
if (!decoder.decode(jobData.type))
return WTF::nullopt;
Modified: trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/ServiceWorkerRegistration.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -148,8 +148,7 @@
return;
}
- // FIXME: Support worker types.
- m_container->updateRegistration(m_registrationData.scopeURL, newestWorker->scriptURL(), WorkerType::Classic, WTFMove(promise));
+ m_container->updateRegistration(m_registrationData.scopeURL, newestWorker->scriptURL(), newestWorker->workerType(), WTFMove(promise));
}
void ServiceWorkerRegistration::unregister(Ref<DeferredPromise>&& promise)
Modified: trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/context/ServiceWorkerThread.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -73,10 +73,8 @@
// FIXME: Use a valid WorkerObjectProxy
// FIXME: Use valid runtime flags
-// FIXME: Support modules in service-workers.
-// https://bugs.webkit.org/show_bug.cgi?id=222155
ServiceWorkerThread::ServiceWorkerThread(const ServiceWorkerContextData& data, String&& userAgent, const Settings::Values& settingsValues, WorkerLoaderProxy& loaderProxy, WorkerDebuggerProxy& debuggerProxy, IDBClient::IDBConnectionProxy* idbConnectionProxy, SocketProvider* socketProvider)
- : WorkerThread({ data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.contentSecurityPolicy, false, MonotonicTime::now(), { }, WorkerType::Classic, FetchRequestCredentials::SameOrigin, settingsValues }, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())
+ : WorkerThread({ data.scriptURL, emptyString(), "serviceworker:" + Inspector::IdentifiersFactory::createIdentifier(), WTFMove(userAgent), platformStrategies()->loaderStrategy()->isOnLine(), data.contentSecurityPolicy, false, MonotonicTime::now(), { }, data.workerType, FetchRequestCredentials::Omit, settingsValues }, data.script, loaderProxy, debuggerProxy, DummyServiceWorkerThreadProxy::shared(), WorkerThreadStartMode::Normal, data.registration.key.topOrigin().securityOrigin().get(), idbConnectionProxy, socketProvider, JSC::RuntimeFlags::createAllEnabled())
, m_data(data.isolatedCopy())
, m_workerObjectProxy(DummyServiceWorkerThreadProxy::shared())
, m_heartBeatTimeout(SWContextManager::singleton().connection()->shouldUseShortTimeout() ? heartBeatTimeoutForTest : heartBeatTimeout)
Modified: trunk/Source/WebCore/workers/service/server/SWServer.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/server/SWServer.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/server/SWServer.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -1095,10 +1095,17 @@
// https://w3c.github.io/ServiceWorker/#soft-update
void SWServer::softUpdate(SWServerRegistration& registration)
{
+ // Let newestWorker be the result of running Get Newest Worker algorithm passing registration as its argument.
+ // If newestWorker is null, abort these steps.
+ auto* newestWorker = registration.getNewestWorker();
+ if (!newestWorker)
+ return;
+
ServiceWorkerJobData jobData(Process::identifier(), ServiceWorkerIdentifier::generate());
jobData.scriptURL = registration.scriptURL();
jobData.topOrigin = registration.key().topOrigin();
jobData.scopeURL = registration.scopeURLWithoutFragment();
+ jobData.workerType = newestWorker->type();
jobData.type = ServiceWorkerJobType::Update;
scheduleJob(WTFMove(jobData));
}
Modified: trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp (273223 => 273224)
--- trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2021-02-21 21:38:41 UTC (rev 273223)
+++ trunk/Source/WebCore/workers/service/server/SWServerJobQueue.cpp 2021-02-21 21:54:24 UTC (rev 273224)
@@ -100,7 +100,7 @@
// If newestWorker is not null, newestWorker's script url equals job's script url with the exclude fragments
// flag set, and script's source text is a byte-for-byte match with newestWorker's script resource's source
// text, then:
- if (newestWorker && equalIgnoringFragmentIdentifier(newestWorker->scriptURL(), job.scriptURL) && result.script == newestWorker->script() && doCertificatesMatch(result.certificateInfo, newestWorker->certificateInfo())) {
+ if (newestWorker && equalIgnoringFragmentIdentifier(newestWorker->scriptURL(), job.scriptURL) && newestWorker->type() == job.workerType && result.script == newestWorker->script() && doCertificatesMatch(result.certificateInfo, newestWorker->certificateInfo())) {
RELEASE_LOG(ServiceWorker, "%p - SWServerJobQueue::scriptFetchFinished, script and certificate are matching for registrationID=%llu", this, registration->identifier().toUInt64());
// FIXME: for non classic scripts, check the script’s module record's [[ECMAScriptCode]].
@@ -114,8 +114,7 @@
// FIXME: Update all the imported scripts as per spec. For now, we just do as if there is none.
- // FIXME: Support the proper worker type (classic vs module)
- m_server.updateWorker(job.identifier(), *registration, job.scriptURL, result.script, result.certificateInfo, result.contentSecurityPolicy, result.referrerPolicy, WorkerType::Classic, { });
+ m_server.updateWorker(job.identifier(), *registration, job.scriptURL, result.script, result.certificateInfo, result.contentSecurityPolicy, result.referrerPolicy, job.workerType, { });
}
// https://w3c.github.io/ServiceWorker/#update-algorithm
@@ -287,7 +286,7 @@
// If registration is not null (in our parlance "empty"), then:
if (auto* registration = m_server.getRegistration(m_registrationKey)) {
auto* newestWorker = registration->getNewestWorker();
- if (newestWorker && equalIgnoringFragmentIdentifier(job.scriptURL, newestWorker->scriptURL()) && job.registrationOptions.updateViaCache == registration->updateViaCache()) {
+ if (newestWorker && equalIgnoringFragmentIdentifier(job.scriptURL, newestWorker->scriptURL()) && job.workerType == newestWorker->type() && job.registrationOptions.updateViaCache == registration->updateViaCache()) {
RELEASE_LOG(ServiceWorker, "%p - SWServerJobQueue::runRegisterJob: Found directly reusable registration %llu for job %s (DONE)", this, registration->identifier().toUInt64(), job.identifier().loggingString().utf8().data());
m_server.resolveRegistrationJob(job, registration->data(), ShouldNotifyWhenResolved::No);
finishCurrentJob();
@@ -349,7 +348,7 @@
// Let newestWorker be the result of running Get Newest Worker algorithm passing registration as the argument.
auto* newestWorker = registration->getNewestWorker();
- // If job's type is update, and newestWorker's script url does not equal job's script url with the exclude fragments flag set, then:
+ // If job’s type is update, and newestWorker is not null and its script url does not equal job’s script url, then:
if (job.type == ServiceWorkerJobType::Update && newestWorker && !equalIgnoringFragmentIdentifier(job.scriptURL, newestWorker->scriptURL()))
return rejectCurrentJob(ExceptionData { TypeError, "Cannot update a service worker with a requested script URL whose newest worker has a different script URL"_s });