Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the perform the fetch steps in Update algorithm #1175

Closed
wants to merge 1 commit into from

Conversation

jungkees
Copy link
Collaborator

This fixes the peform the fetch steps so as for it not to synchronously
return true on success but to asynchronously coplete with response. This
factors the promise rejection of the fail cases out of the perform the
fetch steps so the fetch a * worker script algorithm's remaining step
will invoke the Reject Job Promise with provided error data.

This fixes the peform the fetch steps so as for it not to synchronously
return true on success but to asynchronously coplete with response. This
factors the promise rejection of the fail cases out of the perform the
fetch steps so the fetch a * worker script algorithm's remaining step
will invoke the Reject Job Promise with provided error data.
@jungkees jungkees requested a review from domenic July 25, 2017 02:59
1. Invoke [=Reject Job Promise=] with |job| and "{{SecurityError}}" {{DOMException}}.
1. Asynchronously complete these steps with a [=network error=].
1. Let |mimeType| be the result of [=extracting a MIME type=] from the |response|'s [=response/header list=].
1. If |mimeType| (ignoring parameters) is not a [=JavaScript MIME type=], asynchronously complete these steps with a [=network error=] and "{{SecurityError}}" {{DOMException}}, and abort these steps.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@domenic, I'm not sure if this change makes it better. My intention is to remove the Reject Job Promise call (here and other fail cases) within the perform the fetch steps and uniformly handle them in https://github.com/w3c/ServiceWorker/pull/1175/files#diff-27b79860afe28f01aed4f1f6228367faL2688. For this change, we need to change HTML as well to pass |error data| from the perform the fetch steps to fetch a * worker script to the post fetch steps.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another option is to call Reject Job Promise here (and other fail cases) as-is and run https://github.com/w3c/ServiceWorker/pull/1175/files#diff-27b79860afe28f01aed4f1f6228367faL2690 conditionally when the job promise is still pending. Which would be better?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: Passing |error data| may be tricky for the synchronous fetch case where the response is the single return value.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, yeah, this is pretty invasive. I think the "another option" is probably better.

However note that rejecting a promise that's already resolved (including being rejected) is a no-op. So maybe things are already fine? Or is it important to avoid the equivalentJob stuff too?

@domenic
Copy link
Contributor

domenic commented Jul 26, 2017

FYI I am looking forwarding to reviewing and helping with this but am at TC39 for the rest of the week so might not be able to get to it that soon :).

@jungkees
Copy link
Collaborator Author

Thanks for letting me know. Good meeting :).

@mfalken
Copy link
Member

mfalken commented Mar 13, 2019

I think the code here has changed since this PR, eg at #1380 . So I'll close this as obsolete.

@mfalken mfalken closed this Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants