Open Bug 1414123 Opened 8 years ago Updated 3 years ago

Firefox shows loading state when XHR request is loading in background

Categories

(Core :: DOM: Navigation, defect, P3)

56 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: jmareda, Unassigned)

Details

Attachments

(1 file, 1 obsolete file)

User Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:56.0) Gecko/20100101 Firefox/56.0 Build ID: 20171002220106 Steps to reproduce: I initiate XHR request before website has loaded, using oboe.js library. The request streams data for 5 seconds. Example I made:http://u8.8u.cz/test_xhr/ Actual results: Firefox shows loading animation and document.readyState is "interactive" Expected results: document.readyState should not be influenced by background XHR. Compare: - Google Chrome: https://i.stack.imgur.com/cZiLU.png - Firefox: https://i.stack.imgur.com/cDqPv.png
Shawn, do you have any comments about this XHR issue?
Flags: needinfo?(shuang)
The spec said: Returns "loading" while the Document is loading, "interactive" once it is finished parsing but still loading subresources, and "complete" once it has loaded. So if the browser is getting subresources, readyState should be interactive. Anne, the specification doesn't seem to define subresources clearly in HTML5 specification, FWIW things except for documents and worker scripts are subresources. Not sure it's the same term like Fetch spec (https://fetch.spec.whatwg.org/#subresource-request). I guess this is the correct behavior. Do you have any comment?
Flags: needinfo?(shuang) → needinfo?(annevk)
Based on the specification. 6. Spin the event loop until there is nothing that delays the load event in the Document. 7. Queue a task to run the following substeps: Set the current document readiness to "complete". Hmm. XHR shouldn't block load event, right?
I'm not sure how the specification defined subresoures, so i think if xhr request can considering subresources then interactive makes sense. Maybe it's different from what I know about fetch subresource request.
The green box you quote from is non-normative and only there to help web developers get an idea what the feature does (that's why it says "Note", but perhaps we need to make that more clear). We might want to make the box more precise though, as you note (please file an issue on that). The actual normative definition here is > The readyState IDL attribute must, on getting, return the current document readiness. and the modification of "current document readiness" throughout the loading pipeline. I think only HTML defines which resources delay the load event and XMLHttpRequest is indeed not among them. Hope that helps.
Flags: needinfo?(annevk)
Comment on attachment 8925854 [details] Bug 1414123 - Don't try to scroll image if the image document is not visible; sorry, wrong bug ...
Attachment #8925854 - Attachment is obsolete: true
(In reply to Anne (:annevk) from comment #5) > > The readyState IDL attribute must, on getting, return the current document readiness. > > and the modification of "current document readiness" throughout the loading > pipeline. I think only HTML defines which resources delay the load event and > XMLHttpRequest is indeed not among them. > > Hope that helps. Thanks for the explanation. Sometimes normative definition is too short and concise, and MDN also mentioned what the "green box" defines. I will investigate why we are setting readyState is "interactive", in theory unless something delays the load events.
(In reply to Anne (:annevk) from comment #5) > The green box you quote from is non-normative and only there to help web > developers get an idea what the feature does (that's why it says "Note", but > perhaps we need to make that more clear). We might want to make the box more > precise though, as you note (please file an issue on that). https://github.com/whatwg/html/issues/3214
I don't believe this is a necko bug, likely more of a docshell bug.
Component: Networking → Document Navigation
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: