mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 733651 - Snippet fails to load on about:home due to XMLHttpRequest.open error. r=mak
This commit is contained in:
parent
574e3a05b8
commit
e400b190f6
@ -210,13 +210,17 @@ function loadSnippets()
|
|||||||
let updateURL = localStorage["snippets-update-url"];
|
let updateURL = localStorage["snippets-update-url"];
|
||||||
if (updateURL && (!lastUpdate ||
|
if (updateURL && (!lastUpdate ||
|
||||||
Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS)) {
|
Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS)) {
|
||||||
|
// Try to update from network.
|
||||||
|
let xhr = new XMLHttpRequest();
|
||||||
|
try {
|
||||||
|
xhr.open("GET", updateURL, true);
|
||||||
|
} catch (ex) {
|
||||||
|
showSnippets();
|
||||||
|
return;
|
||||||
|
}
|
||||||
// Even if fetching should fail we don't want to spam the server, thus
|
// Even if fetching should fail we don't want to spam the server, thus
|
||||||
// set the last update time regardless its results. Will retry tomorrow.
|
// set the last update time regardless its results. Will retry tomorrow.
|
||||||
localStorage["snippets-last-update"] = Date.now();
|
localStorage["snippets-last-update"] = Date.now();
|
||||||
|
|
||||||
// Try to update from network.
|
|
||||||
let xhr = new XMLHttpRequest();
|
|
||||||
xhr.open('GET', updateURL, true);
|
|
||||||
xhr.onerror = function (event) {
|
xhr.onerror = function (event) {
|
||||||
showSnippets();
|
showSnippets();
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user