mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-24 09:08:07 +02:00
Replace XMLHttpRequest usage with the Fetch API in the reftest-analyzer
This commit is contained in:
parent
3ac2053d97
commit
90445679e8
1 changed files with 6 additions and 9 deletions
|
@ -147,20 +147,17 @@ window.onload = function () {
|
|||
}
|
||||
}
|
||||
|
||||
function loadFromWeb(url) {
|
||||
async function loadFromWeb(url) {
|
||||
const lastSlash = url.lastIndexOf("/");
|
||||
if (lastSlash) {
|
||||
gPath = url.substring(0, lastSlash + 1);
|
||||
}
|
||||
|
||||
const r = new XMLHttpRequest();
|
||||
r.open("GET", url);
|
||||
r.onreadystatechange = function () {
|
||||
if (r.readyState === 4) {
|
||||
processLog(r.response);
|
||||
}
|
||||
};
|
||||
r.send(null);
|
||||
const response = await fetch(url);
|
||||
if (!response.ok) {
|
||||
throw new Error(response.statusText);
|
||||
}
|
||||
processLog(await response.text());
|
||||
}
|
||||
|
||||
function fileEntryChanged() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue