зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1444132 - Fix the order of requests done by html_cause-test-page.html test. r=jdescottes
MozReview-Commit-ID: IY8TLzqjrnT --HG-- extra : rebase_source : b01a5cd462d920fe52eadb6b4ba8222d08898972
This commit is contained in:
Родитель
57ca676e5a
Коммит
d41a01a8c9
|
@ -38,14 +38,14 @@ const EXPECTED_REQUESTS = [
|
|||
url: EXAMPLE_URL + "xhr_request",
|
||||
causeType: "xhr",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performXhrRequest", file: CAUSE_FILE_NAME, line: 24 }]
|
||||
stack: [{ fn: "performXhrRequestCallback", file: CAUSE_FILE_NAME, line: 26 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
url: EXAMPLE_URL + "fetch_request",
|
||||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 28 }]
|
||||
stack: [{ fn: "performFetchRequest", file: CAUSE_FILE_NAME, line: 31 }]
|
||||
},
|
||||
{
|
||||
method: "GET",
|
||||
|
@ -53,8 +53,9 @@ const EXPECTED_REQUESTS = [
|
|||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 40 },
|
||||
{ fn: null, file: CAUSE_FILE_NAME, line: 39, asyncCause: "promise callback" },
|
||||
{ fn: "performPromiseFetchRequestCallback", file: CAUSE_FILE_NAME, line: 37 },
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 36,
|
||||
asyncCause: "promise callback" },
|
||||
]
|
||||
},
|
||||
{
|
||||
|
@ -63,8 +64,8 @@ const EXPECTED_REQUESTS = [
|
|||
causeType: "fetch",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [
|
||||
{ fn: "performTimeoutFetchRequest", file: CAUSE_FILE_NAME, line: 42 },
|
||||
{ fn: "performPromiseFetchRequest", file: CAUSE_FILE_NAME, line: 41,
|
||||
{ fn: "performTimeoutFetchRequestCallback2", file: CAUSE_FILE_NAME, line: 44 },
|
||||
{ fn: "performTimeoutFetchRequestCallback1", file: CAUSE_FILE_NAME, line: 43,
|
||||
asyncCause: "setTimeout handler" },
|
||||
]
|
||||
},
|
||||
|
@ -73,7 +74,7 @@ const EXPECTED_REQUESTS = [
|
|||
url: EXAMPLE_URL + "beacon_request",
|
||||
causeType: "beacon",
|
||||
causeUri: CAUSE_URL,
|
||||
stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 32 }]
|
||||
stack: [{ fn: "performBeaconRequest", file: CAUSE_FILE_NAME, line: 50 }]
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
@ -21,30 +21,44 @@
|
|||
function performXhrRequest() {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "xhr_request", true);
|
||||
xhr.send();
|
||||
return new Promise(function performXhrRequestCallback(resolve) {
|
||||
xhr.onload = resolve;
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
function performFetchRequest() {
|
||||
fetch("fetch_request");
|
||||
return fetch("fetch_request");
|
||||
}
|
||||
|
||||
// Perform some requests with async stacks
|
||||
function performPromiseFetchRequest() {
|
||||
return Promise.resolve().then(function performPromiseFetchRequestCallback() {
|
||||
return fetch("promise_fetch_request");
|
||||
});
|
||||
}
|
||||
|
||||
function performTimeoutFetchRequest() {
|
||||
return new Promise(function performTimeoutFetchRequestCallback1(resolve) {
|
||||
setTimeout(function performTimeoutFetchRequestCallback2() {
|
||||
resolve(fetch("timeout_fetch_request"));
|
||||
}, 0);
|
||||
});
|
||||
}
|
||||
|
||||
function performBeaconRequest() {
|
||||
navigator.sendBeacon("beacon_request");
|
||||
}
|
||||
|
||||
performXhrRequest();
|
||||
performFetchRequest();
|
||||
(async function() {
|
||||
await performXhrRequest();
|
||||
await performFetchRequest();
|
||||
await performPromiseFetchRequest();
|
||||
await performTimeoutFetchRequest();
|
||||
|
||||
// Perform some requests with async stacks
|
||||
Promise.resolve().then(function performPromiseFetchRequest() {
|
||||
fetch("promise_fetch_request");
|
||||
setTimeout(function performTimeoutFetchRequest() {
|
||||
fetch("timeout_fetch_request");
|
||||
|
||||
// Finally, send a beacon request
|
||||
performBeaconRequest();
|
||||
}, 0);
|
||||
});
|
||||
// Finally, send a beacon request
|
||||
performBeaconRequest();
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Загрузка…
Ссылка в новой задаче