Bug 180950 - We should use "error" redirect mode for fetching service worker scripts
Summary: We should use "error" redirect mode for fetching service worker scripts
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: Chris Dumez
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-12-18 15:05 PST by Chris Dumez
Modified: 2017-12-18 16:50 PST (History)
6 users (show)

See Also:


Attachments
Patch (10.08 KB, patch)
2017-12-18 15:08 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (12.07 KB, patch)
2017-12-18 15:42 PST, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (13.16 KB, patch)
2017-12-18 16:08 PST, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2017-12-18 15:05:09 PST
We should use "error" redirect mode for fetching service worker scripts, as per:
- https://w3c.github.io/ServiceWorker/#update (Step 7.5)
Comment 1 Chris Dumez 2017-12-18 15:08:44 PST
Created attachment 329689 [details]
Patch
Comment 2 Chris Dumez 2017-12-18 15:42:42 PST
Created attachment 329694 [details]
Patch
Comment 3 youenn fablet 2017-12-18 15:51:41 PST
Comment on attachment 329694 [details]
Patch

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

> LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:6
> +FAIL Registering redirected script assert_throws: Registration of redirected script should fail. function "function () { throw e }" threw object "TypeError: Script URL https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=%2Fresources%2Fregistration-worker.js fetch resulted in error: Redirections are not allowed" that is not a DOMException SecurityError: property "code" is equal to undefined, expected 18

It does not seem there is any change of behavior, except for the message to be more precise.
Maybe this test was throwing for a different reason?
Comment 4 Chris Dumez 2017-12-18 16:03:17 PST
Comment on attachment 329694 [details]
Patch

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

>> LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:6
>> +FAIL Registering redirected script assert_throws: Registration of redirected script should fail. function "function () { throw e }" threw object "TypeError: Script URL https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=%2Fresources%2Fregistration-worker.js fetch resulted in error: Redirections are not allowed" that is not a DOMException SecurityError: property "code" is equal to undefined, expected 18
> 
> It does not seem there is any change of behavior, except for the message to be more precise.
> Maybe this test was throwing for a different reason?

Yep, the test is bad and attempt to redirect to an invalid URL. I am about to submit a PR upstream.
Comment 5 Chris Dumez 2017-12-18 16:07:18 PST
(In reply to Chris Dumez from comment #4)
> Comment on attachment 329694 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=329694&action=review
> 
> >> LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/registration-security-error.https-expected.txt:6
> >> +FAIL Registering redirected script assert_throws: Registration of redirected script should fail. function "function () { throw e }" threw object "TypeError: Script URL https://localhost:9443/service-workers/service-worker/resources/redirect.py?Redirect=%2Fresources%2Fregistration-worker.js fetch resulted in error: Redirections are not allowed" that is not a DOMException SecurityError: property "code" is equal to undefined, expected 18
> > 
> > It does not seem there is any change of behavior, except for the message to be more precise.
> > Maybe this test was throwing for a different reason?
> 
> Yep, the test is bad and attempt to redirect to an invalid URL. I am about
> to submit a PR upstream.

-> https://github.com/w3c/web-platform-tests/pull/8733
Comment 6 Chris Dumez 2017-12-18 16:08:49 PST
Created attachment 329700 [details]
Patch
Comment 7 WebKit Commit Bot 2017-12-18 16:48:10 PST
Comment on attachment 329700 [details]
Patch

Clearing flags on attachment: 329700

Committed r226087: <https://trac.webkit.org/changeset/226087>
Comment 8 WebKit Commit Bot 2017-12-18 16:48:12 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2017-12-18 16:50:52 PST
<rdar://problem/36120116>