summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-01-21 14:04:18 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-01-21 14:04:33 +0100
commitbce20e1372c20ea6ad5292a13c4a9505635edba1 (patch)
treeb09d931097509846c6e66213c3ba5ff1971e9acc
parentaa48c2f0ecc773989b7ed785462b1c21baf379f6 (diff)
downloadmupdf-bce20e1372c20ea6ad5292a13c4a9505635edba1.tar.xz
Update MuJS.
-rw-r--r--source/pdf/js/pdf-jsimp-mu.c17
m---------thirdparty/mujs0
2 files changed, 11 insertions, 6 deletions
diff --git a/source/pdf/js/pdf-jsimp-mu.c b/source/pdf/js/pdf-jsimp-mu.c
index 37a5cc76..bdeba2d1 100644
--- a/source/pdf/js/pdf-jsimp-mu.c
+++ b/source/pdf/js/pdf-jsimp-mu.c
@@ -32,7 +32,7 @@ pdf_jsimp *pdf_new_jsimp(fz_context *ctx, void *jsctx)
js_State *J;
pdf_jsimp *imp;
- J = js_newstate(alloc, ctx);
+ J = js_newstate(alloc, ctx, 0);
js_setcontext(J, jsctx);
imp = fz_malloc_struct(ctx, pdf_jsimp);
@@ -189,7 +189,7 @@ void pdf_jsimp_addmethod(pdf_jsimp *imp, pdf_jsimp_type *type, char *name, pdf_j
js_pushstring(J, (const char *)type);
js_defproperty(J, -2, "__type", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
}
- js_defproperty(J, -2, name, JS_READONLY | JS_DONTENUM | JS_DONTCONF);
+ js_defproperty(J, -2, name, JS_READONLY | JS_DONTCONF);
}
js_pop(J, 1);
}
@@ -215,7 +215,7 @@ void pdf_jsimp_addproperty(pdf_jsimp *imp, pdf_jsimp_type *type, char *name, pdf
js_pushstring(J, (const char *)type);
js_defproperty(J, -2, "__type", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
}
- js_defaccessor(J, -3, name, JS_READONLY | JS_DONTENUM | JS_DONTCONF);
+ js_defaccessor(J, -3, name, JS_READONLY | JS_DONTCONF);
}
js_pop(J, 1);
}
@@ -223,10 +223,15 @@ void pdf_jsimp_addproperty(pdf_jsimp *imp, pdf_jsimp_type *type, char *name, pdf
void pdf_jsimp_set_global_type(pdf_jsimp *imp, pdf_jsimp_type *type)
{
js_State *J = imp->J;
+ const char *name;
+
js_getregistry(J, (const char *)type);
- js_setglobal(J, "global");
- js_dostring(J, "Object.getOwnPropertyNames(global).forEach(function(k){this[k]=global[k]}, this)", 0);
- js_dostring(J, "delete global", 0);
+ js_pushiterator(J, -1, 1);
+ while ((name = js_nextiterator(J, -1)))
+ {
+ js_getproperty(J, -2, name);
+ js_setglobal(J, name);
+ }
}
pdf_jsimp_obj *pdf_jsimp_new_obj(pdf_jsimp *imp, pdf_jsimp_type *type, void *natobj)
diff --git a/thirdparty/mujs b/thirdparty/mujs
-Subproject 031513b25b73ce5e5fc7d6bafd512a822d8ded7
+Subproject d9ed73fd717ebbefe5595d139a133b762cea4e9