Bug 1281366. Ensure that when unblocking the scriptloader we try to process scripts if we have _any_ scripts to process, not just parser-blocking ones. r=smaug

This commit is contained in:
Boris Zbarsky 2016-06-23 00:22:29 -04:00
Родитель 6ef497660b
Коммит 2a3c63b8e7
4 изменённых файлов: 45 добавлений и 1 удалений

Просмотреть файл

@ -2028,7 +2028,12 @@ nsScriptLoader::EvaluateScript(nsScriptLoadRequest* aRequest)
void
nsScriptLoader::ProcessPendingRequestsAsync()
{
if (mParserBlockingRequest || !mPendingChildLoaders.IsEmpty()) {
if (mParserBlockingRequest ||
!mXSLTRequests.isEmpty() ||
!mLoadedAsyncRequests.isEmpty() ||
!mNonAsyncExternalScriptInsertedRequests.isEmpty() ||
!mDeferRequests.isEmpty() ||
!mPendingChildLoaders.IsEmpty()) {
NS_DispatchToCurrentThread(NewRunnableMethod(this,
&nsScriptLoader::ProcessPendingRequests));
}

Просмотреть файл

@ -36006,6 +36006,12 @@
"url": "/XMLHttpRequest/xmlhttprequest-sync-block-scripts.html"
}
],
"XMLHttpRequest/xmlhttprequest-sync-not-hang-scriptloader.html": [
{
"path": "XMLHttpRequest/xmlhttprequest-sync-not-hang-scriptloader.html",
"url": "/XMLHttpRequest/xmlhttprequest-sync-not-hang-scriptloader.html"
}
],
"dom/events/EventListener-incumbent-global-1.sub.html": [
{
"path": "dom/events/EventListener-incumbent-global-1.sub.html",

Просмотреть файл

@ -0,0 +1,17 @@
<!DOCTYPE html>
<script>
function secondScriptRan() {
parent.postMessage("done", "*");
}
function createSecondScript() {
var script = document.createElement("script");
script.src = "data:application/javascript,secondScriptRan()";
document.head.appendChild(script);
var xhr = new XMLHttpRequest();
xhr.open("GET", "data:,", false);
xhr.send();
}
</script>
<script src="data:application/javascript,createSecondScript()" defer></script>

Просмотреть файл

@ -0,0 +1,16 @@
<!doctype html>
<meta charset=utf-8>
<title>Ensure that an async script added during a defer script that then does a
sync XHR still runs</title>
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<!--
We run the test in a subframe, because something in the testharness stuff
interferes with defer scripts -->
<script>
var t = async_test();
onmessage = t.step_func_done(function(e) {
assert_equals(e.data, "done");
});
</script>
<iframe src="xmlhttprequest-sync-not-hang-scriptloader-subframe.html"></iframe>