-
Notifications
You must be signed in to change notification settings - Fork 312
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
e.preventDefault should block the network request in fetch event #51
Comments
So this results in a network error if nothing is done? |
Not a network error - it just means that the object is free to respond later. i.e. these two things should more or less be equivalent
|
The only issue with pattern 1 above is that it more or less requires the "event" object to be used after the scope of the event has completed... I think this breaks some basic DOM Event assumptions and I'm reluctant to say we should support it. I now think only pattern 2 should be allowed, and that preventDefault() should mostly be a no-op. |
Yeah, similar to replying to the install event, you should probably always reply with a promise somehow. |
If you have two listeners, should the respondWith method on the second listener throw if a promise is already registered? |
No they would race. I think everyone is agreed that what OP suggests is how this should work. |
Wait, I thought we discussed this on Wednesday, and calling .respondWith with a promise "claims" the response, so the second fetch handler wouldn't run at all. |
It wasn't clear to me that respondWith would also invoke stopImmediatePropagation. |
Was there any conclusion reached in the meantime? |
I don't remember anything. |
|
The current specification seems broken. E.g. "wait to respond flag" should not unset. Why would it be? |
|
At that point |
Will have |
Addressed that point: f60dfca |
I'm not sure what you just did makes sense or addresses my point. My point was that if |
|
Yes, but you unset it as I pointed out... |
Oh you're right. Will fix it tomorrow. Thanks for spotting. |
Fixed: dfa1536. Thanks. |
Tracked at crbug.com/410699 for Blink. |
I don't see where this part from Jake's comment is spec'd: |
Unless I'm missing something, this bug should be re-opened. The commits seem to just address calling respondWith() multiple times, whereas the original bug is about preventDefault(). Blink plans to implement the points in Jake's comment: #51 (comment) |
The rest of the points made in #51 (comment) have been addressed: f022c3a. |
Thanks! Looks good to me. |
Closing. |
If the fetch handler calls
e.preventDefault()
, it should behave like normal DOM events and prevent the default behavior. In this case, the default behavior is the default network fetch.The text was updated successfully, but these errors were encountered: