mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Merge pull request #167 from logicog/browsser_trouble
Fix browser issues with Chrome and latest Firefox
This commit is contained in:
@@ -70,6 +70,8 @@ function update(callback) {
|
|||||||
continue;
|
continue;
|
||||||
var bgs = psvg.contentDocument.getElementsByClassName("bg");
|
var bgs = psvg.contentDocument.getElementsByClassName("bg");
|
||||||
var leds = psvg.contentDocument.getElementsByClassName("led");
|
var leds = psvg.contentDocument.getElementsByClassName("led");
|
||||||
|
if (leds[0] == null || leds[0].style == null)
|
||||||
|
continue;
|
||||||
if (p.enabled == 0) {
|
if (p.enabled == 0) {
|
||||||
pState[n] = -1;
|
pState[n] = -1;
|
||||||
bgs[0].style.fill = "red";
|
bgs[0].style.fill = "red";
|
||||||
@@ -127,9 +129,25 @@ function callbackXHTTP()
|
|||||||
x = currentRequests[0];
|
x = currentRequests[0];
|
||||||
currentCallback = x.onreadystatechange;
|
currentCallback = x.onreadystatechange;
|
||||||
x.onreadystatechange = callbackXHTTP;
|
x.onreadystatechange = callbackXHTTP;
|
||||||
|
var retries = 10;
|
||||||
|
while (retries) {
|
||||||
|
try {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
x.send();
|
x.send();
|
||||||
|
console.log("B1");
|
||||||
}, 20);
|
}, 20);
|
||||||
|
} catch (error) {
|
||||||
|
retries--;
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(`Retry ${retries}/${maxRetries} failed: ${error.message}`);
|
||||||
|
}, 200);
|
||||||
|
if (retries < 1) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("B2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendXHTTP(x)
|
function sendXHTTP(x)
|
||||||
@@ -139,7 +157,24 @@ function sendXHTTP(x)
|
|||||||
currentRequests.push(x);
|
currentRequests.push(x);
|
||||||
currentCallback = x.onreadystatechange;
|
currentCallback = x.onreadystatechange;
|
||||||
x.onreadystatechange = callbackXHTTP;
|
x.onreadystatechange = callbackXHTTP;
|
||||||
|
var retries = 10;
|
||||||
|
while (retries) {
|
||||||
|
try {
|
||||||
x.send();
|
x.send();
|
||||||
|
console.log("A1");
|
||||||
|
} catch (error) {
|
||||||
|
retries--;
|
||||||
|
setTimeout(() => {
|
||||||
|
console.log(`Retry ${retries}/${maxRetries} failed: ${error.message}`);
|
||||||
|
}, 200);
|
||||||
|
if (retries < 1) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
console.log("A2");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
console.log("A3");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentRequests.push(x);
|
currentRequests.push(x);
|
||||||
|
|||||||
+1
-1
@@ -630,7 +630,7 @@ void httpd_appcall(void)
|
|||||||
|
|
||||||
slen = strtox(outbuf, "HTTP/1.1 200 OK\r\nContent-Type: ");
|
slen = strtox(outbuf, "HTTP/1.1 200 OK\r\nContent-Type: ");
|
||||||
slen += strtox(outbuf + slen, mime_strings[f_data[entry].mime]);
|
slen += strtox(outbuf + slen, mime_strings[f_data[entry].mime]);
|
||||||
slen += strtox(outbuf + slen, "; charset=UTF-8\r\nCache-Control: max-age=60, must-revalidate\r\nAccess-Control-Allow-Origin: *\r\n\r\n");
|
slen += strtox(outbuf + slen, "; charset=UTF-8\r\nCache-Control: max-age=60, must-revalidate\r\nAccess-Control-Allow-Origin: *\r\nContent-Security-Policy: style-src 'self' 'unsafe-inline'\r\n\r\n");
|
||||||
|
|
||||||
len_left = f_data[entry].len;
|
len_left = f_data[entry].len;
|
||||||
if (len_left > (TCP_OUTBUF_SIZE - slen)) {
|
if (len_left > (TCP_OUTBUF_SIZE - slen)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user