summaryrefslogtreecommitdiff
path: root/lib/js/urweb.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/js/urweb.js')
-rw-r--r--lib/js/urweb.js21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 335cb525..6cf8a3f3 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -149,6 +149,10 @@ function toMilliseconds(tm) {
return Math.round(tm / 1000);
}
+function fromMilliseconds(tm) {
+ return tm * 1000;
+}
+
function addSeconds(tm, n) {
return tm + n * 1000000;
}
@@ -468,8 +472,11 @@ function onConnectFail(f) {
connectHandlers = cons(flift(f), connectHandlers);
}
-function conn() {
- runHandlers("Connect", connectHandlers, null);
+function conn(msg) {
+ var rx = /(.*)<body>((.|\n|\r)*)<\/body>(.*)/g;
+ var arr = rx.exec(msg);
+ msg = (arr && arr.length >= 3) ? arr[2] : msg;
+ runHandlers("RPC failure", connectHandlers, msg);
}
var serverHandlers = null;
@@ -1468,6 +1475,14 @@ function strcmp(str1, str2) {
return ((str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1));
}
+function chr(n) {
+ return String.fromCharCode(n);
+}
+
+function htmlifySpecialChar(ch) {
+ return "&#" + ch.charCodeAt(0) + ";";
+}
+
// Remote calls
@@ -1591,7 +1606,7 @@ function rc(prefix, uri, parse, k, needsSig, isN) {
}
} else {
if (isN == null)
- conn();
+ conn(xhr.responseText);
else
k(null);
}