summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorGravatar Vladimir Shabanov <vshabanoff@gmail.com>2012-05-16 22:46:35 +0400
committerGravatar Vladimir Shabanov <vshabanoff@gmail.com>2012-05-16 22:46:35 +0400
commitcfa495696d87fb15d860a0d06881c11557785647 (patch)
treefdb57377024b18a1f94fd7595d0cbbc43c2caf49 /lib
parenta54e26601aec191bb8b3ec7790c4b07983363052 (diff)
Allow RPC and run it synchronously in onunload event.
Diffstat (limited to 'lib')
-rw-r--r--lib/js/urweb.js7
1 files changed, 1 insertions, 6 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 85d10d4a..40d080b8 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -1184,17 +1184,12 @@ var sig = null;
var unloading = false, inFlight = null;
function unload() {
- unloading = true;
-
for (; inFlight; inFlight = inFlight.next) {
inFlight.data.abort();
}
}
function requestUri(xhr, uri, needsSig, isRpc) {
- if (unloading)
- return;
-
var extraData = null;
if (isRpc && uri.length > 2000) {
@@ -1202,7 +1197,7 @@ function requestUri(xhr, uri, needsSig, isRpc) {
uri = uri.substring(0, 2000);
}
- xhr.open("POST", uri, true);
+ xhr.open("POST", uri, !unloading);
xhr.setRequestHeader("Content-type", "text/plain");
try {
xhr.setRequestHeader("Content-length", "0");