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

"abort" Event Isn't Fired When Aborting Document Load #3525

Closed
anthumchris opened this issue Mar 2, 2018 · 6 comments · Fixed by #6720
Closed

"abort" Event Isn't Fired When Aborting Document Load #3525

anthumchris opened this issue Mar 2, 2018 · 6 comments · Fixed by #6720

Comments

@anthumchris
Copy link

anthumchris commented Mar 2, 2018

Is firing an "abort" event still a valid HTML specification?

According to 7.8.12 Aborting a document load, "the user agent should...fire an event named abort at that Document's Window object". I've been testing with this abort event detection page and cannot capture the "abort" event anywhere from any browser.

Detecting the "abort" event in Service Workers would also be extremely useful, as we could effectively manage our Streams, FetchEvents, etc, and react accordingly. For example, this Service Worker Progress Indicator has no way to detect when the user signaled an abort/cancel on the page load. Firefox effectively cancels the download (without firing an "abort" event that SW can intercept, but Chrome does not)

@domenic
Copy link
Member

domenic commented Mar 2, 2018

Edge appears to fire it... although at the HTMLImageElement O_o

@wanderview
Copy link
Member

I think the FetchEvent.request.signal should reflect if the intercepted request is aborted. I don't think we have a WPT test for this yet. We had some bugs in FF around it before, but it may work now or be easier to make work.

@anthumchris
Copy link
Author

Thanks. Filed a Chromium bug:

https://bugs.chromium.org/p/chromium/issues/detail?id=818788

@domenic
Copy link
Member

domenic commented Mar 6, 2018

Should we still keep the event in the spec, given that only one browser seems to do it, and that browser does it wrong?

@anthumchris
Copy link
Author

I think the abort event is important and needed because it reflects direct action and intent initiated by users. Users canceling/aborting/stopping page load is also a valid stage in an application's lifecycle. Making this event visible allows for more robust application development and gives options to developers when needed.

The browsers already correctly execute the stop/cancel functionality internally. Browsers would only need to report when that functionality occurs by firing abort.

@annevk
Copy link
Member

annevk commented Jan 28, 2021

We should probably remove this given that no browser implements it.

cc @jakearchibald

domenic added a commit that referenced this issue May 25, 2021
* Makes the discussion of user agent interface invoke "stop document loading", not "abort a document", since the browser stop button also cancels ongoing navigations.

* Remove the "should" suggestion to fire an abort event. Closes #3525. Since this was the only case where abort was fired, this removes the event definition and event handler content attribute definition, effectively making use of the onabort="" content attribute nonconforming. (But, we keep the IDL definition in GlobalEventHandlers and the associated mapping.)

* Tweaks the active document check in "stop document loading" to be more correct.
domenic added a commit that referenced this issue May 26, 2021
* Makes the discussion of user agent interface invoke "stop document loading", not "abort a document", since the browser stop button also cancels ongoing navigations.

* Remove the "should" suggestion to fire an abort event. Closes #3525. Since this was the only case where abort was fired, this removes the event definition and event handler content attribute definition, effectively making use of the onabort="" content attribute nonconforming. (But, we keep the IDL definition in GlobalEventHandlers and the associated mapping.)

* Tweaks the active document check in "stop document loading" to be more correct.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

5 participants