Closed Bug 1279007 Opened 8 years ago Closed 7 years ago

Conflated script tag async attribute behavior with sync xhr and message queue

Categories

(Core :: DOM: Core & HTML, defect, P2)

46 Branch
x86_64
macOS
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: ddcast, Unassigned, NeedInfo)

References

()

Details

Attachments

(4 files)

Attached image sync_bug.png
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36

Steps to reproduce:

Appended two script tags with async option `false` to document. The first script source invokes an xhr with async argument `false`, sets a variable (`myvalue`) on window with a string value `somevalue` just after the call (callback not involved). The second script source logs the value of `myvalue` set in the first source.

More details and repro example here: https://github.com/ddcast/firefox-sync-bug


Actual results:

I see `ReferenceError: myvalue is not defined` in log output.


Expected results:

I should see "somevalue" in log output.
I submitted the bug in a browser different than the one tested in. Tested UA:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:46.0) Gecko/20100101 Firefox/46.0
Version: 47 Branch → 46 Branch
OS: Unspecified → Mac OS X
Hardware: Unspecified → x86_64
Component: Untriaged → DOM
Product: Firefox → Core
From a footnote in some doc (linked below): "In older browsers that don't support the async attribute, parser-inserted scripts block the parser". A bit alarming because some symptom of the bug (see url- GitHub proj) is congruent with a blocked parser which could mean the async attribute is not, like, really supported or the the expected behavior is compromised.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script
Component: DOM → DOM: Core & HTML
baku, what do you think here?
Flags: needinfo?(amarchesini)
Devin, thanks for the bug report. Can you test this issue with nightly?
I can reproduce it with the latest FF release version but not with nightly. In nightly everything works as it should.
And also in release it's an intermittent failure.

Recently we did many many changes in XHR so maybe this bug has been already fixed.
If you can help me with this little test, I appreciate it.
Flags: needinfo?(amarchesini) → needinfo?(ddcast)
Use of sync XHR in the main thread is of course highly discouraged, but anyhow, 
isn't this actually a dup of bug 1267989?
That should be fixed in FF49, and there is a slight chance to get it to FF48 too.
(In reply to Andrea Marchesini (:baku) from comment #4)
> Devin, thanks for the bug report. Can you test this issue with nightly?
> I can reproduce it with the latest FF release version but not with nightly.
> In nightly everything works as it should.
> And also in release it's an intermittent failure.
> 
> Recently we did many many changes in XHR so maybe this bug has been already
> fixed.
> If you can help me with this little test, I appreciate it.

I can reproduce intermittently as well in nightly. Though I should have been more specific in my original report- It was also reproducible intermittently.
Attached image sync_bug_nightly.png
(In reply to Olli Pettay [:smaug] from comment #5)
> Use of sync XHR in the main thread is of course highly discouraged, but
> anyhow, 
> isn't this actually a dup of bug 1267989?
> That should be fixed in FF49, and there is a slight chance to get it to FF48
> too.

After reviewing the thread for that bug, it's not clear if it's the same - although there is some talk about the parser. If it is - or is related - this one seems like it might be going a different direction I think.
Flags: needinfo?(ddcast)
Smaug, it seems bug 1267989 must be re-opened again.
Why? Sounds like this is a different issue then after all. Or that bug 1267989 didn't fix all the variants of the issue. But why to re-open?
Priority: -- → P2
Devin, can you please re-test now that 49 (which has the fix for bug 1267989) is now the main released version of Firefox?
Flags: needinfo?(ddcast)
Attached image sync_bug_prod-49.png
Re-tested and I still see the issue in 49 after updating FF (OS X 10.11.6).
Flags: needinfo?(ddcast)
Thanks for re-testing, Devin.

baku, can you investigate?
Flags: needinfo?(amarchesini)
Attached file testcase
I'm not able to reproduce this issue. I also took the testcase and I make it a recursive version to see if it was a race condition. No luck.
Flags: needinfo?(amarchesini)
Devin, do you want to try my test and see if something is missing? Thanks.
Flags: needinfo?(ddcast)
Close as INCOMPLETE as without more information from the reporter, it's hardly we could move this forward.
Hi Devin, please feel free to reopen it if you get a chance to revisit this. Thanks.
Status: UNCONFIRMED → RESOLVED
Closed: 7 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: