Project

General

Profile

Bug #7040 » 0002-Additional-waitingForJavaScript-debugging-code.patch

Bruce Toll, 05/11/2019 02:24 AM

View differences:

src/web/skeleton/Wt.js
return;
while (!waitingForJavaScript && handleResponseQueue.length > 0) {
console.log("handleResponse: calling queued handleResponse");
(handleResponseQueue.shift())();
}
if (waitingForJavaScript) {
console.log("handleResponse: queueing handleResponse with status: " + status + ", waitingForJavaScript: " + waitingForJavaScript);
// NOTE: To test failure, remove comment on following line [setTimeout...] and comment out the line after [handleResponseQueue.push...]
// setTimeout(function() { handleResponse(status, msg, timer); }, 2000);
handleResponseQueue.push(function() { handleResponse(status, msg, timer); });
return;
}
console.log("handleResponse: handleResponse continuing with status: " + status + ", waitingForJavaScript: " + waitingForJavaScript);
if (status == 0) {
WT.resolveRelativeAnchors();
_$_$if_CATCH_ERROR_$_();
......
if (websocket.state == WebSocketAckConnect)
webSocketAckConnect();
console.log("handleResponse: pendingEvents.length: " + pendingEvents.length + ", status: " + status);
if ((serverPush && !waitingForJavaScript) || pendingEvents.length > 0) {
if (status == 1) {
var ms = Math.min(120000, Math.exp(commErrors) * 500);
......
}
function sendUpdate() {
console.log("sendUpdate: waitingForJavaScript: " + waitingForJavaScript);
if (self != window._$_APP_CLASS_$_) {
quit(null);
return;
......
setTimeout(function() {
if (jsLibsLoaded[path] === true) {
waitingForJavaScript = false;
console.log("onJsLoad timeout: path = '" + path + "': calling f(), waitingForJavaScript: " + waitingForJavaScript);
f();
if (!waitingForJavaScript && serverPush)
sendUpdate();
} else
console.log("onJsLoad timeout: path = '" + path + "': setting jsLibsLoaded[path] = f()");
jsLibsLoaded[path] = f;
}, 20);
waitingForJavaScript = true;
console.log("onJsLoad: path = '" + path + "': setting waitingForJavaScript: " + waitingForJavaScript);
};
function jsLoaded(path)
......
else {
if (typeof jsLibsLoaded[path] !== UNDEFINED) {
waitingForJavaScript = false;
console.log("jsLoaded: waitingForJavaScript is: " + waitingForJavaScript);
jsLibsLoaded[path]();
if (!waitingForJavaScript && serverPush)
sendUpdate();
(3-3/3)