Opened 7 years ago
Last modified 5 years ago
#18609 assigned defect
IE < 11: Loader inconsistently runs factory synchronously for module with no deps
Reported by: | Kenneth G. Franqueiro | Owned by: | dylan |
---|---|---|---|
Priority: | low | Milestone: | 1.14 |
Component: | Loader | Version: | 1.10.4 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
Most browsers, including IE 11, will run a module's factory function on the next turn, even if that module has no dependencies. This is not true for IE < 11, which takes a different code path.
Test case: https://gist.github.com/kfranqueiro/7e3c9594918dbc3bea32
On modern browsers, this logs:
after factory in factory all loaded
In IE < 11, this logs:
in factory all loaded after factory
(Note that I've only been testing this in async mode specifically.)
I played around initially with wrapping https://github.com/dojo/dojo/blob/1.10.4/dojo.js#L1860 in a setTimeout, which seemed to resolve the issue with no regressions... But then I noticed that even removing the line entirely resolves it with no regressions as well.
Wondering if Rawld could comment on whether this change seems sane.
Change History (8)
comment:1 Changed 7 years ago by
Milestone: | tbd → 1.11 |
---|
comment:2 Changed 7 years ago by
Priority: | undecided → low |
---|
comment:3 Changed 6 years ago by
comment:5 Changed 6 years ago by
Owner: | changed from Rawld Gill to dylan |
---|---|
Status: | new → assigned |
comment:6 Changed 6 years ago by
Milestone: | 1.11 → 1.12 |
---|
comment:7 Changed 6 years ago by
Milestone: | 1.12 → 1.13 |
---|
Ticket planning... move current 1.12 tickets out to 1.13 that likely won't get fixed in 1.12.
comment:8 Changed 5 years ago by
Milestone: | 1.13 → 1.14 |
---|
The IE path is different because IE would (will?) not trigger the load event on a script node consistently many years ago. I tried to duplicate this behavior on WinXP x (IE7, IE8) and Win7 x (IE8, IE9, IE10), but was unsuccessful. Maybe those browsers have been patched? Or maybe I wasn't providing a good test?
In any event, I believe Ken's proposed fix should work fine in async mode; indeed, if the IE browsers no longer exhibit the error, then the checkComplete() application can be removed.
I'm somewhat concerned of making any changes in sync mode as the code paths are extremely complex.
I believe the best/safest path is to trigger the checkComplete() in question with a timeout, but only have one such timeout pending (in other words, don't just blindly add another timeout with each trip through this code). If the browser is working correctly, then the checkComplete() timeout will accomplish nothing and will not slow the loader.