Bug 239847 - Make sure to fail importScripts as per https://w3c.github.io/ServiceWorker/#importscripts step 4
Summary: Make sure to fail importScripts as per https://w3c.github.io/ServiceWorker/#i...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Service Workers (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: youenn fablet
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-04-28 05:39 PDT by youenn fablet
Modified: 2022-04-29 00:16 PDT (History)
3 users (show)

See Also:


Attachments
Patch (4.82 KB, patch)
2022-04-28 05:41 PDT, youenn fablet
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description youenn fablet 2022-04-28 05:39:44 PDT
Make sure to fail importScripts as per https://w3c.github.io/ServiceWorker/#importscripts step 4
Comment 1 youenn fablet 2022-04-28 05:41:45 PDT
Created attachment 458519 [details]
Patch
Comment 2 Chris Dumez 2022-04-28 10:58:00 PDT
Comment on attachment 458519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458519&action=review

r=me

> Source/WebCore/workers/WorkerScriptLoader.cpp:85
> +    auto* serviceWorkerGlobalScope = dynamicDowncast<ServiceWorkerGlobalScope>(workerGlobalScope);

Would be nice to reduce scoping and do this in the if condition:
`if (auto* serviceWorkerGlobalScope = dynamicDowncast<ServiceWorkerGlobalScope>(workerGlobalScope))`
Comment 3 youenn fablet 2022-04-28 23:34:19 PDT
Comment on attachment 458519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=458519&action=review

>> Source/WebCore/workers/WorkerScriptLoader.cpp:85
>> +    auto* serviceWorkerGlobalScope = dynamicDowncast<ServiceWorkerGlobalScope>(workerGlobalScope);
> 
> Would be nice to reduce scoping and do this in the if condition:
> `if (auto* serviceWorkerGlobalScope = dynamicDowncast<ServiceWorkerGlobalScope>(workerGlobalScope))`

serviceWorkerGlobalScope is reused below, and it seems a tad better to have a wider scope instead of two casts.
Comment 4 EWS 2022-04-29 00:15:39 PDT
Committed r293607 (250113@main): <https://commits.webkit.org/250113@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 458519 [details].
Comment 5 Radar WebKit Bug Importer 2022-04-29 00:16:13 PDT
<rdar://problem/92510321>