Did some testing and it seems to be related to the issue at hand.
This here script will sometimes (rarely, maybe 1 out of 20 reloads) produce the "sendSyncMessage deferring", but the deferred script is not executed on .35rc4. On .36rc1 it is executed, but onload listeners do not work.
Code: Select all
// Environment:
// protocol: http:
// scripts enabled
// Deferred script is the one with "console.log("Foo")".
<!DOCTYPE html>
<html>
<head>
<link href="temp.css" rel="stylesheet" type="text/css" >
<script>
let a = document.createElement('script');
let m = document.getElementsByTagName('script')[0];
a.src = 'temp.js';
m.parentNode.insertBefore(a,m)
</script>
<script>
window.onload = function(event) {
console.log("onload");
};
document.addEventListener('DOMContentLoaded', function(event) {
console.log("DOMContentLoaded");
});
console.log("Foo");
</script>
</head>
<body>
</body>
</html>
3 things in SyncMessage that are noteworthy:
1. The suspend done in beforescriptexecute does not prevent other scripts from running.
2. suspended-variable in suspend() is true for any script that comes after the first, allowing them to bypass the suspend.
3. Deferred scripts do not run (on .35rc4), likely for the same reason as in staticNS.js:113 (though .36rc1 does fix this too).
Using the staticNS fix alone is not enough (for .35rc4). The suspended-check needs to be removed or the beforescriptexecute will go into recursion. .36rc1 does work around this too, but the script execution is postponed too much so that any onload listeners will be late. Although removing the suspended-check seems to work, I do not remember what it was originally there for and if there is still some need for it. But with the current approach, each script needs to be suspended individually. In fact that way there won't be any need for script deferring as we should have the permissions when the suspend is lifted.
However a thing to note with this approach is that since the DOM is not suspended anymore, all event attributes can take effect. Need to check what ramifications that has.