summaryrefslogtreecommitdiff
path: root/lib/js
diff options
context:
space:
mode:
authorGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:08:01 -0500
committerGravatar Adam Chlipala <adamc@hcoop.net>2009-11-21 13:08:01 -0500
commit6d050ba6131055e85a46b282cb52552c3f6cc440 (patch)
tree6f1fcd7f0d6a13e05384f850f5546a1f0ed02233 /lib/js
parented279aaf89fd1d8b92b26adba6b3e8e34b88c254 (diff)
Fix for lack of 'apply' method of IE6 native functions
Diffstat (limited to 'lib/js')
-rw-r--r--lib/js/urweb.js21
1 files changed, 20 insertions, 1 deletions
diff --git a/lib/js/urweb.js b/lib/js/urweb.js
index 62f94f52..ba1e9625 100644
--- a/lib/js/urweb.js
+++ b/lib/js/urweb.js
@@ -891,8 +891,27 @@ function exec1(env, stack, e) {
case "f":
fr.args[fr.pos++] = v;
if (fr.a == null) {
+ var res;
stack = stack.next;
- e = {c: "c", v: fr.f.apply(null, fr.args)};
+
+ if (fr.f.apply)
+ res = fr.f.apply(null, fr.args);
+ else if (fr.args.length == 0)
+ res = fr.f();
+ else if (fr.args.length == 1)
+ res = fr.f(fr.args[0]);
+ else if (fr.args.length == 2)
+ res = fr.f(fr.args[0], fr.args[1]);
+ else if (fr.args.length == 3)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2]);
+ else if (fr.args.length == 4)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3]);
+ else if (fr.args.length == 5)
+ res = fr.f(fr.args[0], fr.args[1], fr.args[2], fr.args[3], fr.args[4]);
+ else
+ whine("Native function has " + fr.args.length + " args, but there is no special case for that count.");
+
+ e = {c: "c", v: res};
if (usedK) return null;
} else {
e = fr.a.data;