mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
[mozjs45] Code is unstable, but at least compiles.
This commit is contained in:
parent
01c511f52d
commit
a5b68a25a1
@ -612,11 +612,11 @@ case "$with_spidermonkey" in
|
||||
;;
|
||||
esac
|
||||
|
||||
for package in mozjs-38; do
|
||||
for package in mozjs-45; do
|
||||
if test -n "$CONFIG_SPIDERMONKEY"; then
|
||||
break
|
||||
else
|
||||
AC_MSG_CHECKING([for SpiderMonkey (mozjs-38) in pkg-config $package])
|
||||
AC_MSG_CHECKING([for SpiderMonkey (mozjs-45) in pkg-config $package])
|
||||
if $PKG_CONFIG --cflags --libs $package > /dev/null 2>&AS_MESSAGE_LOG_FD; then
|
||||
SPIDERMONKEY_LIBS="$($PKG_CONFIG --libs $package)"
|
||||
SPIDERMONKEY_CFLAGS="$($PKG_CONFIG --cflags $package)"
|
||||
|
@ -271,7 +271,7 @@ if conf_data.get('CONFIG_BZIP2')
|
||||
endif
|
||||
|
||||
if conf_data.get('CONFIG_ECMASCRIPT')
|
||||
mozjsdeps = dependency('mozjs-38')
|
||||
mozjsdeps = dependency('mozjs-45')
|
||||
deps += mozjsdeps
|
||||
endif
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey-shared.h"
|
||||
#include <js/Initialization.h>
|
||||
|
||||
/** A shared runtime used for both user scripts (scripting/smjs/) and
|
||||
* scripts on web pages (ecmascript/spidermonkey/).
|
||||
|
@ -53,20 +53,20 @@ JSObject *spidermonkey_InitClass(JSContext *cx, JSObject *obj,
|
||||
JSPropertySpec *static_ps,
|
||||
const spidermonkeyFunctionSpec *static_fs);
|
||||
|
||||
static void undef_to_jsval(JSContext *ctx, jsval *vp);
|
||||
static unsigned char *jsval_to_string(JSContext *ctx, jsval *vp);
|
||||
static void undef_to_jsval(JSContext *ctx, JS::Value *vp);
|
||||
static unsigned char *jsval_to_string(JSContext *ctx, JS::Value *vp);
|
||||
static unsigned char *jsid_to_string(JSContext *ctx, jsid *id);
|
||||
|
||||
/* Inline functions */
|
||||
|
||||
static inline void
|
||||
undef_to_jsval(JSContext *ctx, jsval *vp)
|
||||
undef_to_jsval(JSContext *ctx, JS::Value *vp)
|
||||
{
|
||||
*vp = JSVAL_NULL;
|
||||
*vp = JS::NullValue();
|
||||
}
|
||||
|
||||
static inline unsigned char *
|
||||
jsval_to_string(JSContext *ctx, jsval *vp)
|
||||
jsval_to_string(JSContext *ctx, JS::Value *vp)
|
||||
{
|
||||
JS::RootedValue r_vp(ctx, *vp);
|
||||
JSString *str = r_vp.toString();
|
||||
@ -85,6 +85,6 @@ jsid_to_string(JSContext *ctx, jsid *id)
|
||||
}
|
||||
|
||||
#define ELINKS_CAST_PROP_PARAMS JSObject *obj = (hobj.get()); \
|
||||
jsval *vp = (hvp.address());
|
||||
JS::Value *vp = (hvp.address());
|
||||
|
||||
#endif
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include <jsprf.h>
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "cache/cache.h"
|
||||
@ -66,6 +67,8 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
unsigned char *strict, *exception, *warning, *error;
|
||||
struct string msg;
|
||||
|
||||
char *prefix = nullptr;
|
||||
|
||||
assert(interpreter && interpreter->vs && interpreter->vs->doc_view
|
||||
&& ses && ses->tab);
|
||||
if_assert_failed goto reported;
|
||||
@ -92,6 +95,20 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
add_to_string(&msg, ":\n\n");
|
||||
add_to_string(&msg, message);
|
||||
|
||||
if (report->filename) {
|
||||
prefix = JS_smprintf("%s:", report->filename);
|
||||
}
|
||||
|
||||
if (report->lineno) {
|
||||
char* tmp = prefix;
|
||||
prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column);
|
||||
JS_free(ctx, tmp);
|
||||
}
|
||||
|
||||
if (prefix) {
|
||||
add_to_string(&msg, prefix);
|
||||
}
|
||||
#if 0
|
||||
if (report->linebuf && report->tokenptr) {
|
||||
int pos = report->tokenptr - report->linebuf;
|
||||
|
||||
@ -100,6 +117,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
pos - 2, " ",
|
||||
strlen(report->linebuf) - pos - 1, " ");
|
||||
}
|
||||
#endif
|
||||
|
||||
info_box(term, MSGBOX_FREE_TEXT, N_("JavaScript Error"), ALIGN_CENTER,
|
||||
msg.source);
|
||||
@ -182,6 +200,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
if (!forms_obj) {
|
||||
goto release_and_fail;
|
||||
}
|
||||
// JS_SetPrivate(forms_obj, interpreter->vs);
|
||||
|
||||
history_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
|
||||
&history_class, NULL, 0,
|
||||
@ -191,6 +210,8 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
if (!history_obj) {
|
||||
goto release_and_fail;
|
||||
}
|
||||
// JS_SetPrivate(history_obj, interpreter->vs);
|
||||
|
||||
|
||||
location_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
|
||||
&location_class, NULL, 0,
|
||||
@ -200,8 +221,10 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
if (!location_obj) {
|
||||
goto release_and_fail;
|
||||
}
|
||||
// JS_SetPrivate(location_obj, interpreter->vs);
|
||||
|
||||
menubar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(),
|
||||
|
||||
menubar_obj = JS_InitClass(ctx, window_obj, nullptr,
|
||||
&menubar_class, NULL, 0,
|
||||
unibar_props, NULL,
|
||||
NULL, NULL);
|
||||
@ -210,7 +233,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
}
|
||||
JS_SetPrivate(menubar_obj, "t"); /* to @menubar_class */
|
||||
|
||||
statusbar_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(),
|
||||
statusbar_obj = JS_InitClass(ctx, window_obj, nullptr,
|
||||
&statusbar_class, NULL, 0,
|
||||
unibar_props, NULL,
|
||||
NULL, NULL);
|
||||
@ -219,13 +242,14 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
}
|
||||
JS_SetPrivate(statusbar_obj, "s"); /* to @statusbar_class */
|
||||
|
||||
navigator_obj = JS_InitClass(ctx, window_obj, JS::NullPtr(),
|
||||
navigator_obj = JS_InitClass(ctx, window_obj, nullptr,
|
||||
&navigator_class, NULL, 0,
|
||||
navigator_props, NULL,
|
||||
NULL, NULL);
|
||||
if (!navigator_obj) {
|
||||
goto release_and_fail;
|
||||
}
|
||||
// JS_SetPrivate(navigator_obj, interpreter->vs);
|
||||
|
||||
return ctx;
|
||||
|
||||
@ -252,7 +276,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
|
||||
struct string *code, struct string *ret)
|
||||
{
|
||||
JSContext *ctx;
|
||||
jsval rval;
|
||||
JS::Value rval;
|
||||
|
||||
assert(interpreter);
|
||||
if (!js_module_init_ok) {
|
||||
@ -267,7 +291,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
|
||||
JS::RootedValue r_val(ctx, rval);
|
||||
JS::CompileOptions options(ctx);
|
||||
|
||||
JS::Evaluate(ctx, cg, options, code->source, code->length, &r_val);
|
||||
JS::Evaluate(ctx, options, code->source, code->length, &r_val);
|
||||
done_heartbeat(interpreter->heartbeat);
|
||||
}
|
||||
|
||||
@ -278,7 +302,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
|
||||
{
|
||||
bool ret;
|
||||
JSContext *ctx;
|
||||
jsval rval;
|
||||
JS::Value rval;
|
||||
|
||||
assert(interpreter);
|
||||
if (!js_module_init_ok) return NULL;
|
||||
@ -295,7 +319,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
|
||||
// .setCompileAndGo(true)
|
||||
// .setNoScriptRval(true);
|
||||
|
||||
ret = JS::Evaluate(ctx, cg, options, code->source, code->length, &r_rval);
|
||||
ret = JS::Evaluate(ctx, options, code->source, code->length, &r_rval);
|
||||
done_heartbeat(interpreter->heartbeat);
|
||||
|
||||
if (ret == false) {
|
||||
@ -315,8 +339,7 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
|
||||
struct string *code)
|
||||
{
|
||||
JSContext *ctx;
|
||||
JS::RootedFunction fun(ctx);
|
||||
jsval rval;
|
||||
JS::Value rval;
|
||||
int ret;
|
||||
|
||||
assert(interpreter);
|
||||
@ -324,9 +347,11 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
|
||||
ctx = interpreter->backend_data;
|
||||
interpreter->ret = NULL;
|
||||
|
||||
JS::RootedFunction fun(ctx);
|
||||
|
||||
JS::CompileOptions options(ctx);
|
||||
JS::AutoObjectVector ag(ctx);
|
||||
if (!JS::CompileFunction(ctx, ag, options, "", 0, nullptr, code->source,
|
||||
if (!JS::CompileFunction(ctx, ag, options, "aaa", 0, nullptr, code->source,
|
||||
code->length, &fun)) {
|
||||
return -1;
|
||||
};
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include <jsfriendapi.h>
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "cache/cache.h"
|
||||
@ -60,11 +61,11 @@ JSClass document_class = {
|
||||
|
||||
#ifdef CONFIG_COOKIES
|
||||
static bool
|
||||
document_get_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_get_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct string *cookies;
|
||||
|
||||
@ -92,15 +93,14 @@ document_get_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
document_set_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_set_property_cookie(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct string *cookies;
|
||||
|
||||
parent_win = JS_GetParent(hobj);
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
@ -117,11 +117,11 @@ document_set_property_cookie(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
#endif
|
||||
|
||||
static bool
|
||||
document_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
@ -132,11 +132,11 @@ document_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
document_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
|
||||
@ -156,11 +156,11 @@ document_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
|
||||
|
||||
static bool
|
||||
document_get_property_referrer(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_get_property_referrer(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct document *document;
|
||||
@ -220,11 +220,11 @@ document_get_property_referrer(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
|
||||
|
||||
static bool
|
||||
document_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct document *document;
|
||||
@ -245,11 +245,11 @@ document_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
document_set_property_title(JSContext *ctx, int argc, jsval *vp)
|
||||
document_set_property_title(JSContext *ctx, int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct document *document;
|
||||
@ -271,11 +271,11 @@ document_set_property_title(JSContext *ctx, int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
document_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct document *document;
|
||||
@ -303,11 +303,11 @@ document_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
document_set_property_url(JSContext *ctx, int argc, jsval *vp)
|
||||
document_set_property_url(JSContext *ctx, int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct document *document;
|
||||
@ -360,7 +360,7 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
|
||||
if (classPtr != &document_class)
|
||||
return false;
|
||||
|
||||
parent_win = JS_GetParent(obj);
|
||||
parent_win = js::GetGlobalForObjectCrossCompartment(hobj);
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
@ -381,8 +381,8 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool document_write(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool document_writeln(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool document_write(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
static bool document_writeln(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
const spidermonkeyFunctionSpec document_funcs[] = {
|
||||
{ "write", document_write, 1 },
|
||||
@ -391,9 +391,9 @@ const spidermonkeyFunctionSpec document_funcs[] = {
|
||||
};
|
||||
|
||||
static bool
|
||||
document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline)
|
||||
document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newline)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
struct string *ret = interpreter->ret;
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
|
||||
@ -428,7 +428,7 @@ document_write_do(JSContext *ctx, unsigned int argc, jsval *rval, int newline)
|
||||
|
||||
/* @document_funcs{"write"} */
|
||||
static bool
|
||||
document_write(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
document_write(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
|
||||
return document_write_do(ctx, argc, rval, 0);
|
||||
@ -436,7 +436,7 @@ document_write(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
|
||||
/* @document_funcs{"writeln"} */
|
||||
static bool
|
||||
document_writeln(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
document_writeln(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
return document_write_do(ctx, argc, rval, 1);
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -11,6 +11,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include <jsfriendapi.h>
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "cache/cache.h"
|
||||
@ -45,9 +46,9 @@
|
||||
#include "viewer/text/vs.h"
|
||||
|
||||
|
||||
static bool history_back(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool history_forward(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool history_go(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool history_back(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
static bool history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
static bool history_go(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
JSClass history_class = {
|
||||
"history",
|
||||
@ -66,7 +67,7 @@ const spidermonkeyFunctionSpec history_funcs[] = {
|
||||
|
||||
/* @history_funcs{"back"} */
|
||||
static bool
|
||||
history_back(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
history_back(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
struct document_view *doc_view = interpreter->vs->doc_view;
|
||||
@ -85,7 +86,7 @@ history_back(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
|
||||
/* @history_funcs{"forward"} */
|
||||
static bool
|
||||
history_forward(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
struct document_view *doc_view = interpreter->vs->doc_view;
|
||||
@ -100,7 +101,7 @@ history_forward(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
|
||||
/* @history_funcs{"go"} */
|
||||
static bool
|
||||
history_go(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
history_go(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
struct document_view *doc_view = interpreter->vs->doc_view;
|
||||
@ -130,8 +131,8 @@ history_go(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
}
|
||||
|
||||
|
||||
static bool location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
/* Each @location_class object must have a @window_class parent. */
|
||||
JSClass location_class = {
|
||||
@ -156,7 +157,7 @@ JSPropertySpec location_props[] = {
|
||||
|
||||
|
||||
static bool
|
||||
location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -169,7 +170,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, hobj, &location_class, NULL))
|
||||
return false;
|
||||
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj));
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
@ -192,7 +193,7 @@ location_get_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -206,7 +207,7 @@ location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
if (!JS_InstanceOf(ctx, hobj, &location_class, NULL))
|
||||
return false;
|
||||
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, GetGlobalForObjectCrossCompartment(hobj));
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
@ -222,7 +223,7 @@ location_set_property_href(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
|
||||
static bool location_toString(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool location_toString(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
const spidermonkeyFunctionSpec location_funcs[] = {
|
||||
{ "toString", location_toString, 0 },
|
||||
@ -232,9 +233,9 @@ const spidermonkeyFunctionSpec location_funcs[] = {
|
||||
|
||||
/* @location_funcs{"toString"}, @location_funcs{"toLocaleString"} */
|
||||
static bool
|
||||
location_toString(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
location_toString(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
|
||||
JS::RootedObject hobj(ctx, obj);
|
||||
|
@ -44,12 +44,12 @@
|
||||
#include "viewer/text/vs.h"
|
||||
|
||||
|
||||
static bool navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool navigator_get_property_appName(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool navigator_get_property_language(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool navigator_get_property_platform(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
JSClass navigator_class = {
|
||||
"navigator",
|
||||
@ -87,7 +87,7 @@ JSPropertySpec navigator_props[] = {
|
||||
/* @navigator_class.getProperty */
|
||||
|
||||
static bool
|
||||
navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setString(JS_NewStringCopyZ(ctx, "Mozilla")); /* More like a constant nowadays. */
|
||||
@ -96,7 +96,7 @@ navigator_get_property_appCodeName(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_appName(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setString(JS_NewStringCopyZ(ctx,
|
||||
@ -106,7 +106,7 @@ navigator_get_property_appName(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setString(JS_NewStringCopyZ(ctx, VERSION));
|
||||
@ -115,7 +115,7 @@ navigator_get_property_appVersion(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_language(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
@ -131,7 +131,7 @@ navigator_get_property_language(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_platform(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setString(JS_NewStringCopyZ(ctx, system_name));
|
||||
@ -140,7 +140,7 @@ navigator_get_property_platform(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
navigator_get_property_userAgent(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
unsigned char *optstr;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include <jsfriendapi.h>
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "cache/cache.h"
|
||||
@ -44,8 +45,8 @@
|
||||
#include "viewer/text/link.h"
|
||||
#include "viewer/text/vs.h"
|
||||
|
||||
static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
/* Each @menubar_class object must have a @window_class parent. */
|
||||
JSClass menubar_class = {
|
||||
@ -79,7 +80,7 @@ JSPropertySpec unibar_props[] = {
|
||||
|
||||
|
||||
static bool
|
||||
unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -96,7 +97,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
&& !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL))
|
||||
return false;
|
||||
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
@ -130,7 +131,7 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -147,7 +148,7 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
&& !JS_InstanceOf(ctx, hobj, &statusbar_class, NULL))
|
||||
return false;
|
||||
|
||||
JS::RootedObject parent_win(ctx, JS_GetParent(hobj));
|
||||
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
|
||||
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
|
||||
if_assert_failed return false;
|
||||
|
||||
|
@ -5,56 +5,56 @@
|
||||
#include "ecmascript/spidermonkey-shared.h"
|
||||
#include "util/memory.h"
|
||||
|
||||
static void string_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string);
|
||||
static void astring_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string);
|
||||
static void int_to_jsval(JSContext *ctx, jsval *vp, int number);
|
||||
static void object_to_jsval(JSContext *ctx, jsval *vp, JSObject *object);
|
||||
static void boolean_to_jsval(JSContext *ctx, jsval *vp, int boolean);
|
||||
static void string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string);
|
||||
static void astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string);
|
||||
static void int_to_jsval(JSContext *ctx, JS::Value *vp, int number);
|
||||
static void object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object);
|
||||
static void boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean);
|
||||
|
||||
static int jsval_to_boolean(JSContext *ctx, jsval *vp);
|
||||
static int jsval_to_boolean(JSContext *ctx, JS::Value *vp);
|
||||
|
||||
|
||||
|
||||
/** Inline functions */
|
||||
|
||||
static inline void
|
||||
string_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string)
|
||||
string_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string)
|
||||
{
|
||||
if (!string) {
|
||||
*vp = JSVAL_NULL;
|
||||
*vp = JS::NullValue();
|
||||
} else {
|
||||
*vp = STRING_TO_JSVAL(JS_NewStringCopyZ(ctx, string));
|
||||
*vp = JS::StringValue(JS_NewStringCopyZ(ctx, string));
|
||||
}
|
||||
}
|
||||
|
||||
static inline void
|
||||
astring_to_jsval(JSContext *ctx, jsval *vp, unsigned char *string)
|
||||
astring_to_jsval(JSContext *ctx, JS::Value *vp, unsigned char *string)
|
||||
{
|
||||
string_to_jsval(ctx, vp, string);
|
||||
mem_free_if(string);
|
||||
}
|
||||
|
||||
static inline void
|
||||
int_to_jsval(JSContext *ctx, jsval *vp, int number)
|
||||
int_to_jsval(JSContext *ctx, JS::Value *vp, int number)
|
||||
{
|
||||
*vp = INT_TO_JSVAL(number);
|
||||
*vp = JS::Int32Value(number);
|
||||
}
|
||||
|
||||
static inline void
|
||||
object_to_jsval(JSContext *ctx, jsval *vp, JSObject *object)
|
||||
object_to_jsval(JSContext *ctx, JS::Value *vp, JSObject *object)
|
||||
{
|
||||
*vp = OBJECT_TO_JSVAL(object);
|
||||
*vp = JS::ObjectValue(*object);
|
||||
}
|
||||
|
||||
static inline void
|
||||
boolean_to_jsval(JSContext *ctx, jsval *vp, int boolean)
|
||||
boolean_to_jsval(JSContext *ctx, JS::Value *vp, int boolean)
|
||||
{
|
||||
*vp = BOOLEAN_TO_JSVAL(boolean);
|
||||
*vp = JS::BooleanValue(boolean);
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
jsval_to_boolean(JSContext *ctx, jsval *vp)
|
||||
jsval_to_boolean(JSContext *ctx, JS::Value *vp)
|
||||
{
|
||||
JS::RootedValue r_vp(ctx, *vp);
|
||||
return (int)r_vp.toBoolean();
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "elinks.h"
|
||||
|
||||
#include "ecmascript/spidermonkey/util.h"
|
||||
#include <js/Conversions.h>
|
||||
|
||||
#include "bfu/dialog.h"
|
||||
#include "cache/cache.h"
|
||||
@ -45,12 +46,12 @@
|
||||
|
||||
|
||||
static bool window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool window_get_property_closed(JSContext *cx, unsigned int argc, jsval *vp);
|
||||
static bool window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool window_get_property_closed(JSContext *cx, unsigned int argc, JS::Value *vp);
|
||||
static bool window_get_property_parent(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool window_get_property_self(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool window_get_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
JSClass window_class = {
|
||||
"window",
|
||||
@ -129,7 +130,6 @@ find_child_frame(struct document_view *doc_view, struct frame_desc *tframe)
|
||||
static bool
|
||||
window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
ELINKS_CAST_PROP_PARAMS
|
||||
jsid id = hid.get();
|
||||
|
||||
struct view_state *vs;
|
||||
@ -152,7 +152,7 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
/* TODO: Try other lookups (mainly element lookup) until
|
||||
* something yields data. */
|
||||
if (obj) {
|
||||
object_to_jsval(ctx, vp, obj);
|
||||
hvp.setObject(*obj);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -160,17 +160,17 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
if (!JSID_IS_INT(id))
|
||||
return true;
|
||||
|
||||
undef_to_jsval(ctx, vp);
|
||||
hvp.setUndefined();
|
||||
|
||||
switch (JSID_TO_INT(id)) {
|
||||
case JSP_WIN_CLOSED:
|
||||
/* TODO: It will be a major PITA to implement this properly.
|
||||
* Well, perhaps not so much if we introduce reference tracking
|
||||
* for (struct session)? Still... --pasky */
|
||||
boolean_to_jsval(ctx, vp, 0);
|
||||
hvp.setBoolean(false);
|
||||
break;
|
||||
case JSP_WIN_SELF:
|
||||
object_to_jsval(ctx, vp, obj);
|
||||
hvp.setObject(*hobj.get());
|
||||
break;
|
||||
case JSP_WIN_PARENT:
|
||||
/* XXX: It would be nice if the following worked, yes.
|
||||
@ -235,8 +235,9 @@ found_parent:
|
||||
* is alien but some other child window is not, we should still
|
||||
* let the script walk thru. That'd mean moving the check to
|
||||
* other individual properties in this switch. */
|
||||
if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST))
|
||||
object_to_jsval(ctx, vp, newjsframe);
|
||||
if (compare_uri(vs->uri, top_view->vs->uri, URI_HOST)) {
|
||||
hvp.setObject(*newjsframe);
|
||||
}
|
||||
/* else */
|
||||
/****X*X*X*** SECURITY VIOLATION! RED ALERT, SHIELDS UP! ***X*X*X****\
|
||||
|* (Pasky was apparently looking at the Links2 JS code . ___ ^.^ *|
|
||||
@ -258,9 +259,9 @@ found_parent:
|
||||
|
||||
void location_goto(struct document_view *doc_view, unsigned char *url);
|
||||
|
||||
static bool window_alert(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool window_open(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
static bool window_open(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
static bool window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
const spidermonkeyFunctionSpec window_funcs[] = {
|
||||
{ "alert", window_alert, 1 },
|
||||
@ -271,24 +272,30 @@ const spidermonkeyFunctionSpec window_funcs[] = {
|
||||
|
||||
/* @window_funcs{"alert"} */
|
||||
static bool
|
||||
window_alert(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
|
||||
JS::RootedObject hobj(ctx, obj);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
|
||||
// jsval *argv = JS_ARGV(ctx, rval);
|
||||
|
||||
// JS::Value *argv = JS_ARGV(ctx, rval);
|
||||
struct view_state *vs;
|
||||
unsigned char *string;
|
||||
|
||||
if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false;
|
||||
if (!JS_InstanceOf(ctx, hobj, &window_class, nullptr)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
vs = JS_GetInstancePrivate(ctx, hobj, &window_class, &args);
|
||||
vs = JS_GetInstancePrivate(ctx, hobj, &window_class, nullptr);
|
||||
|
||||
if (argc != 1)
|
||||
return true;
|
||||
|
||||
string = jsval_to_string(ctx, args[0].address());
|
||||
JSString *str = JS::ToString(ctx, args[0]);
|
||||
|
||||
string = JS_EncodeString(ctx, str);
|
||||
|
||||
if (!*string)
|
||||
return true;
|
||||
|
||||
@ -301,13 +308,13 @@ window_alert(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
|
||||
/* @window_funcs{"open"} */
|
||||
static bool
|
||||
window_open(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
window_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
|
||||
JS::RootedObject hobj(ctx, obj);
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
|
||||
// jsval *argv = JS_ARGV(ctx, rval);
|
||||
// JS::Value *argv = JS_ARGV(ctx, rval);
|
||||
struct view_state *vs;
|
||||
struct document_view *doc_view;
|
||||
struct session *ses;
|
||||
@ -414,10 +421,10 @@ end:
|
||||
|
||||
/* @window_funcs{"setTimeout"} */
|
||||
static bool
|
||||
window_setTimeout(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
|
||||
// jsval *argv = JS_ARGV(ctx, rval);
|
||||
// JS::Value *argv = JS_ARGV(ctx, rval);
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
unsigned char *code;
|
||||
int timeout;
|
||||
@ -460,7 +467,7 @@ window_get_property_closed(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
|
||||
#endif
|
||||
|
||||
static bool
|
||||
window_get_property_closed(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_get_property_closed(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setBoolean(false);
|
||||
@ -469,7 +476,7 @@ window_get_property_closed(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_get_property_parent(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
@ -489,7 +496,7 @@ window_get_property_parent(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_get_property_self(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setObject(args.thisv().toObject());
|
||||
@ -498,7 +505,7 @@ window_get_property_self(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_get_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
args.rval().setUndefined();
|
||||
@ -507,7 +514,7 @@ window_get_property_status(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
if (args.length() != 1) {
|
||||
@ -529,7 +536,7 @@ window_set_property_status(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
window_get_property_top(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
|
||||
|
@ -24,7 +24,7 @@ struct smjs_action_fn_callback_hop {
|
||||
};
|
||||
|
||||
static void smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj);
|
||||
static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
static const JSClass action_fn_class = {
|
||||
"action_fn",
|
||||
@ -58,9 +58,9 @@ smjs_action_fn_finalize(JSFreeOp *op, JSObject *obj)
|
||||
|
||||
/* @action_fn_class.call */
|
||||
static bool
|
||||
smjs_action_fn_callback(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
smjs_action_fn_callback(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
jsval value;
|
||||
JS::Value value;
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
|
||||
struct smjs_action_fn_callback_hop *hop;
|
||||
@ -164,7 +164,7 @@ action_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JS::RootedValue rval(ctx, val);
|
||||
JSObject *action_fn;
|
||||
unsigned char *action_str;
|
||||
@ -206,7 +206,7 @@ smjs_get_action_object(void)
|
||||
void
|
||||
smjs_init_action_interface(void)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
struct JSObject *action_object;
|
||||
|
||||
if (!smjs_ctx || !smjs_elinks_object)
|
||||
|
@ -84,11 +84,11 @@ enum bookmark_prop {
|
||||
BOOKMARK_CHILDREN = -3,
|
||||
};
|
||||
|
||||
static bool bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool bookmark_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool bookmark_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool bookmark_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
static const JSPropertySpec bookmark_props[] = {
|
||||
JS_PSGS("title", bookmark_get_property_title, bookmark_set_property_title, JSPROP_ENUMERATE),
|
||||
@ -104,22 +104,22 @@ static JSObject *smjs_get_bookmark_folder_object(struct bookmark *bookmark);
|
||||
* @return true if successful. On error, report the error and
|
||||
* return false. */
|
||||
static bool
|
||||
bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, jsval *vp)
|
||||
bookmark_string_to_jsval(JSContext *ctx, const unsigned char *str, JS::Value *vp)
|
||||
{
|
||||
JSString *jsstr = utf8_to_jsstring(ctx, str, -1);
|
||||
|
||||
if (jsstr == NULL)
|
||||
return false;
|
||||
*vp = STRING_TO_JSVAL(jsstr);
|
||||
*vp = JS::StringValue(jsstr);
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Convert a jsval to a string and store it in struct bookmark.
|
||||
/** Convert a JS::Value to a string and store it in struct bookmark.
|
||||
*
|
||||
* @param ctx
|
||||
* Context for memory allocations and error reports.
|
||||
* @param val
|
||||
* The @c jsval that should be converted.
|
||||
* The @c JS::Value that should be converted.
|
||||
* @param[in,out] result
|
||||
* A string allocated with mem_alloc().
|
||||
* On success, this function frees the original string, if any.
|
||||
@ -149,7 +149,7 @@ jsval_to_bookmark_string(JSContext *ctx, JS::HandleValue val, unsigned char **re
|
||||
}
|
||||
|
||||
static bool
|
||||
bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
bookmark_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -177,7 +177,7 @@ bookmark_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
bookmark_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -208,7 +208,7 @@ bookmark_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
bookmark_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -236,7 +236,7 @@ bookmark_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
bookmark_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -267,7 +267,7 @@ bookmark_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
bookmark_get_property_children(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
bookmark_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -319,7 +319,7 @@ bookmark_folder_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId
|
||||
|
||||
struct bookmark *bookmark;
|
||||
struct bookmark *folder;
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JS::RootedValue title_jsval(ctx, val);
|
||||
unsigned char *title = NULL;
|
||||
|
||||
@ -360,7 +360,7 @@ smjs_get_bookmark_folder_object(struct bookmark *bookmark)
|
||||
void
|
||||
smjs_init_bookmarks_interface(void)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
struct JSObject *bookmarks_object;
|
||||
|
||||
if (!smjs_ctx || !smjs_elinks_object)
|
||||
|
@ -37,14 +37,14 @@ enum cache_entry_prop {
|
||||
CACHE_ENTRY_URI = -5,
|
||||
};
|
||||
|
||||
static bool cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool cache_entry_get_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
static const JSPropertySpec cache_entry_props[] = {
|
||||
JS_PSGS("content", cache_entry_get_property_content, cache_entry_set_property_content, JSPROP_ENUMERATE),
|
||||
@ -56,7 +56,7 @@ static const JSPropertySpec cache_entry_props[] = {
|
||||
};
|
||||
|
||||
static bool
|
||||
cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_get_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -100,7 +100,7 @@ cache_entry_get_property_content(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_set_property_content(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -140,7 +140,7 @@ cache_entry_set_property_content(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -172,7 +172,7 @@ cache_entry_get_property_type(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_set_property_type(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_set_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -297,7 +297,7 @@ smjs_detach_cache_entry_object(struct cache_entry *cached)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -329,7 +329,7 @@ cache_entry_get_property_length(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -361,7 +361,7 @@ cache_entry_get_property_head(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_set_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -399,7 +399,7 @@ cache_entry_set_property_head(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
cache_entry_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "config/home.h"
|
||||
#include "ecmascript/spidermonkey-shared.h"
|
||||
#include <jsprf.h>
|
||||
#include "intl/charsets.h"
|
||||
#include "main/module.h"
|
||||
#include "osdep/osdep.h"
|
||||
@ -41,6 +42,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
{
|
||||
unsigned char *strict, *exception, *warning, *error;
|
||||
struct string msg;
|
||||
char *prefix = nullptr;
|
||||
|
||||
if (!init_string(&msg)) goto reported;
|
||||
|
||||
@ -55,14 +57,32 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
add_to_string(&msg, ":\n\n");
|
||||
add_to_string(&msg, message);
|
||||
|
||||
if (report->linebuf && report->tokenptr) {
|
||||
int pos = report->tokenptr - report->linebuf;
|
||||
add_format_to_string(&msg, "\n\n%d:%d ", report->lineno, report->column);
|
||||
|
||||
if (report->filename) {
|
||||
prefix = JS_smprintf("%s:", report->filename);
|
||||
}
|
||||
|
||||
if (report->lineno) {
|
||||
char* tmp = prefix;
|
||||
prefix = JS_smprintf("%s%u:%u ", tmp ? tmp : "", report->lineno, report->column);
|
||||
JS_free(ctx, tmp);
|
||||
}
|
||||
|
||||
if (prefix) {
|
||||
add_to_string(&msg, prefix);
|
||||
}
|
||||
|
||||
#if 0
|
||||
if (report->linebuf) {
|
||||
int pos = report->offset;
|
||||
|
||||
add_format_to_string(&msg, "\n\n%s\n.%*s^%*s.",
|
||||
report->linebuf,
|
||||
pos - 2, " ",
|
||||
strlen(report->linebuf) - pos - 1, " ");
|
||||
}
|
||||
#endif
|
||||
|
||||
alert_smjs_error(msg.source);
|
||||
done_string(&msg);
|
||||
@ -79,14 +99,12 @@ smjs_do_file(unsigned char *path)
|
||||
|
||||
if (!init_string(&script)) return 0;
|
||||
|
||||
jsval val;
|
||||
JS::RootedValue rval(smjs_ctx, val);
|
||||
JS::RootedObject cg(smjs_ctx, JS::CurrentGlobalOrNull(smjs_ctx));
|
||||
|
||||
JS::CompileOptions options(smjs_ctx);
|
||||
JS::CompileOptions opts(smjs_ctx);
|
||||
opts.setNoScriptRval(true);
|
||||
JS::RootedValue rval(smjs_ctx);
|
||||
|
||||
if (!add_file_to_string(&script, path)
|
||||
|| false == JS::Evaluate(smjs_ctx, cg, options,
|
||||
|| false == JS::Evaluate(smjs_ctx, opts,
|
||||
script.source, script.length, &rval)) {
|
||||
alert_smjs_error("error loading script file");
|
||||
ret = 0;
|
||||
@ -98,7 +116,7 @@ smjs_do_file(unsigned char *path)
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
smjs_do_file_wrapper(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
/* @elinks_funcs{"alert"} */
|
||||
static bool
|
||||
elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
elinks_alert(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
|
||||
@ -69,7 +69,7 @@ elinks_alert(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
|
||||
/* @elinks_funcs{"execute"} */
|
||||
static bool
|
||||
elinks_execute(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
elinks_execute(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
|
||||
@ -94,10 +94,10 @@ enum elinks_prop {
|
||||
ELINKS_SESSION,
|
||||
};
|
||||
|
||||
static bool elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool elinks_get_property_home(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool elinks_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool elinks_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool elinks_get_property_session(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static const JSPropertySpec elinks_props[] = {
|
||||
JS_PSG("home", elinks_get_property_home, JSPROP_ENUMERATE),
|
||||
JS_PSGS("location", elinks_get_property_location, elinks_set_property_location, JSPROP_ENUMERATE),
|
||||
@ -106,7 +106,7 @@ static const JSPropertySpec elinks_props[] = {
|
||||
};
|
||||
|
||||
static bool elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp);
|
||||
static bool elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
|
||||
static const JSClass elinks_class = {
|
||||
"elinks",
|
||||
@ -176,7 +176,7 @@ elinks_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
}
|
||||
|
||||
static bool
|
||||
elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp)
|
||||
elinks_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
@ -254,7 +254,7 @@ smjs_init_elinks_object(void)
|
||||
/* If elinks.<method> is defined, call it with the given arguments,
|
||||
* store the return value in rval, and return true. Else return false. */
|
||||
bool
|
||||
smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval)
|
||||
smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, argv);
|
||||
|
||||
@ -263,7 +263,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, J
|
||||
assert(argv);
|
||||
|
||||
JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object);
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
JS::RootedValue fun(smjs_ctx, val);
|
||||
|
||||
if (false == JS_GetProperty(smjs_ctx, r_smjs_elinks_object,
|
||||
@ -277,7 +277,7 @@ smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, J
|
||||
}
|
||||
|
||||
static bool
|
||||
elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
elinks_get_property_home(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -294,7 +294,7 @@ elinks_get_property_home(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
elinks_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -316,7 +316,7 @@ elinks_get_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
elinks_set_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -344,7 +344,7 @@ elinks_set_property_location(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
elinks_get_property_session(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
elinks_get_property_session(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
|
@ -12,6 +12,6 @@ void smjs_init_elinks_object(void);
|
||||
|
||||
/* Invoke elinks.<method> with the given arguments and put the return value
|
||||
* into *rval. */
|
||||
bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, jsval *argv, JS::MutableHandleValue rval);
|
||||
bool smjs_invoke_elinks_object_method(unsigned char *method, int argc, JS::Value *argv, JS::MutableHandleValue rval);
|
||||
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "util/memory.h"
|
||||
|
||||
static bool smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp);
|
||||
static bool smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
|
||||
static void smjs_globhist_item_finalize(JSFreeOp *op, JSObject *obj);
|
||||
|
||||
@ -51,12 +51,12 @@ enum smjs_globhist_item_prop {
|
||||
GLOBHIST_LAST_VISIT = -3,
|
||||
};
|
||||
|
||||
static bool smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
static const JSPropertySpec smjs_globhist_item_props[] = {
|
||||
JS_PSGS("title", smjs_globhist_item_get_property_title, smjs_globhist_item_set_property_title, JSPROP_ENUMERATE),
|
||||
@ -133,7 +133,7 @@ smjs_globhist_item_get_property(JSContext *ctx, JS::HandleObject hobj, JS::Handl
|
||||
|
||||
/* @smjs_globhist_item_class.setProperty */
|
||||
static bool
|
||||
smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp)
|
||||
smjs_globhist_item_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
@ -217,7 +217,7 @@ smjs_globhist_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
|
||||
JSObject *jsobj;
|
||||
unsigned char *uri_string;
|
||||
struct global_history_item *history_item;
|
||||
jsval tmp;
|
||||
JS::Value tmp;
|
||||
JS::RootedValue r_tmp(ctx, tmp);
|
||||
|
||||
|
||||
@ -264,7 +264,7 @@ smjs_get_globhist_object(void)
|
||||
void
|
||||
smjs_init_globhist_interface(void)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
struct JSObject *globhist;
|
||||
|
||||
if (!smjs_ctx || !smjs_elinks_object)
|
||||
@ -281,7 +281,7 @@ smjs_init_globhist_interface(void)
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -306,7 +306,7 @@ smjs_globhist_item_get_property_title(JSContext *ctx, unsigned int argc, jsval *
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -335,7 +335,7 @@ smjs_globhist_item_set_property_title(JSContext *ctx, unsigned int argc, jsval *
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -360,7 +360,7 @@ smjs_globhist_item_get_property_url(JSContext *ctx, unsigned int argc, jsval *vp
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -389,7 +389,7 @@ smjs_globhist_item_set_property_url(JSContext *ctx, unsigned int argc, jsval *vp
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -431,7 +431,7 @@ smjs_globhist_item_get_property_last_visit(JSContext *ctx, unsigned int argc, js
|
||||
|
||||
/* @smjs_globhist_item_class.setProperty */
|
||||
static bool
|
||||
smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
smjs_globhist_item_set_property_last_visit(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
|
@ -27,7 +27,7 @@ script_hook_url(va_list ap, void *data)
|
||||
unsigned char **url = va_arg(ap, unsigned char **);
|
||||
struct session *ses = va_arg(ap, struct session *);
|
||||
enum evhook_status ret = EVENT_HOOK_STATUS_NEXT;
|
||||
jsval args[3], rval;
|
||||
JS::Value args[3], rval;
|
||||
JS::RootedValue r_rval(smjs_ctx, rval);
|
||||
|
||||
if (*url == NULL) return EVENT_HOOK_STATUS_NEXT;
|
||||
@ -59,7 +59,7 @@ script_hook_pre_format_html(va_list ap, void *data)
|
||||
struct cache_entry *cached = va_arg(ap, struct cache_entry *);
|
||||
enum evhook_status ret = EVENT_HOOK_STATUS_NEXT;
|
||||
JSObject *cache_entry_object, *view_state_object = NULL;
|
||||
jsval args[4], rval;
|
||||
JS::Value args[4], rval;
|
||||
JS::RootedValue r_rval(smjs_ctx, rval);
|
||||
|
||||
evhook_use_params(ses && cached);
|
||||
|
@ -14,7 +14,7 @@
|
||||
#include "util/memory.h"
|
||||
|
||||
static bool keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp);
|
||||
static bool keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static void keymap_finalize(JSFreeOp *op, JSObject *obj);
|
||||
|
||||
static const JSClass keymap_class = {
|
||||
@ -34,7 +34,7 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
unsigned char *action_str;
|
||||
const unsigned char *keystroke_str;
|
||||
int *data;
|
||||
jsval tmp;
|
||||
JS::Value tmp;
|
||||
JS::RootedValue r_tmp(ctx, tmp);
|
||||
|
||||
/* This can be called if @obj if not itself an instance of the
|
||||
@ -46,6 +46,8 @@ keymap_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
|
||||
data = JS_GetInstancePrivate(ctx, hobj,
|
||||
(JSClass *) &keymap_class, NULL);
|
||||
|
||||
|
||||
|
||||
if (!JS_IdToValue(ctx, id, &r_tmp))
|
||||
goto ret_null;
|
||||
|
||||
@ -71,7 +73,7 @@ smjs_keybinding_action_callback(va_list ap, void *data)
|
||||
{
|
||||
JS::CallArgs args;
|
||||
|
||||
jsval rval;
|
||||
JS::Value rval;
|
||||
JS::RootedValue r_rval(smjs_ctx, rval);
|
||||
struct session *ses = va_arg(ap, struct session *);
|
||||
JSObject *jsobj = data;
|
||||
@ -80,11 +82,11 @@ smjs_keybinding_action_callback(va_list ap, void *data)
|
||||
|
||||
smjs_ses = ses;
|
||||
|
||||
jsval r2;
|
||||
JS::Value r2;
|
||||
JS::RootedValue r_jsobject(smjs_ctx, r2);
|
||||
r_jsobject.setObject(*jsobj);
|
||||
|
||||
JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), r_jsobject,
|
||||
JS_CallFunctionValue(smjs_ctx, nullptr, r_jsobject,
|
||||
args, &r_rval);
|
||||
|
||||
smjs_ses = NULL;
|
||||
@ -94,20 +96,20 @@ smjs_keybinding_action_callback(va_list ap, void *data)
|
||||
|
||||
/* @keymap_class.setProperty */
|
||||
static bool
|
||||
keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp)
|
||||
keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
int *data;
|
||||
unsigned char *keymap_str;
|
||||
jsval val;
|
||||
const unsigned char *keystroke_str;
|
||||
|
||||
/* This can be called if @obj if not itself an instance of the
|
||||
* appropriate class but has one in its prototype chain. Fail
|
||||
* such calls. */
|
||||
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL))
|
||||
if (!JS_InstanceOf(ctx, hobj, (JSClass *) &keymap_class, NULL)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
data = JS_GetInstancePrivate(ctx, hobj,
|
||||
(JSClass *) &keymap_class, NULL);
|
||||
@ -115,11 +117,13 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo
|
||||
/* Ugly fact: we need to get the string from the id to give to bind_do,
|
||||
* which will of course then convert the string back to an id... */
|
||||
keymap_str = get_keymap_name((enum keymap_id) *data);
|
||||
|
||||
if (!keymap_str) return false;
|
||||
|
||||
JS::RootedValue rval(ctx, val);
|
||||
JS::RootedValue rval(ctx);
|
||||
JS_IdToValue(ctx, id, &rval);
|
||||
keystroke_str = JS_EncodeString(ctx, rval.toString());
|
||||
|
||||
if (!keystroke_str) return false;
|
||||
|
||||
if (hvp.isString()) {
|
||||
@ -134,6 +138,7 @@ keymap_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, boo
|
||||
return true;
|
||||
|
||||
} else if (hvp.isNull()) { /* before JSVAL_IS_OBJECT */
|
||||
|
||||
if (bind_do(keymap_str, keystroke_str, "none", 0))
|
||||
return false;
|
||||
|
||||
@ -226,7 +231,6 @@ static const JSClass keymaps_hash_class = {
|
||||
static JSObject *
|
||||
smjs_get_keymap_hash_object(void)
|
||||
{
|
||||
jsval val;
|
||||
int keymap_id;
|
||||
JSObject *keymaps_hash;
|
||||
|
||||
@ -234,7 +238,7 @@ smjs_get_keymap_hash_object(void)
|
||||
if (!keymaps_hash) return NULL;
|
||||
|
||||
JS::RootedObject r_keymaps_hash(smjs_ctx, keymaps_hash);
|
||||
JS::RootedValue r_val(smjs_ctx, val);
|
||||
JS::RootedValue r_val(smjs_ctx);
|
||||
|
||||
for (keymap_id = 0; keymap_id < KEYMAP_MAX; ++keymap_id) {
|
||||
unsigned char *keymap_str = get_keymap_name(keymap_id);
|
||||
@ -245,7 +249,6 @@ smjs_get_keymap_hash_object(void)
|
||||
if (!map) return NULL;
|
||||
|
||||
r_val.setObject(*map);
|
||||
|
||||
JS_SetProperty(smjs_ctx, r_keymaps_hash, keymap_str, r_val);
|
||||
}
|
||||
|
||||
@ -255,7 +258,6 @@ smjs_get_keymap_hash_object(void)
|
||||
void
|
||||
smjs_init_keybinding_interface(void)
|
||||
{
|
||||
jsval val;
|
||||
struct JSObject *keymaps_hash;
|
||||
|
||||
if (!smjs_ctx || !smjs_elinks_object)
|
||||
@ -264,7 +266,7 @@ smjs_init_keybinding_interface(void)
|
||||
keymaps_hash = smjs_get_keymap_hash_object();
|
||||
if (!keymaps_hash) return;
|
||||
|
||||
JS::RootedValue r_val(smjs_ctx, val);
|
||||
JS::RootedValue r_val(smjs_ctx);
|
||||
r_val.setObject(*keymaps_hash);
|
||||
JS::RootedObject r_smjs_elinks_object(smjs_ctx, smjs_elinks_object);
|
||||
|
||||
|
@ -21,7 +21,7 @@ struct smjs_load_uri_hop {
|
||||
|
||||
/* SpiderMonkey versions earlier than 1.8 cannot properly call
|
||||
* a closure if given just a JSFunction pointer. They need a
|
||||
* jsval that points to the corresponding JSObject. Besides,
|
||||
* JS::Value that points to the corresponding JSObject. Besides,
|
||||
* JS_AddNamedRoot is not documented to support JSFunction
|
||||
* pointers. */
|
||||
JS::MutableHandleValue callback;
|
||||
@ -33,7 +33,7 @@ smjs_loading_callback(struct download *download, void *data)
|
||||
struct session *saved_smjs_ses = smjs_ses;
|
||||
struct smjs_load_uri_hop *hop = data;
|
||||
|
||||
jsval args[1], rval;
|
||||
JS::Value args[1], rval;
|
||||
JSObject *cache_entry_object;
|
||||
|
||||
if (is_in_progress_state(download->state)) return;
|
||||
@ -55,10 +55,10 @@ smjs_loading_callback(struct download *download, void *data)
|
||||
cache_entry_object = smjs_get_cache_entry_object(download->cached);
|
||||
if (!cache_entry_object) goto end;
|
||||
|
||||
args[0] = OBJECT_TO_JSVAL(cache_entry_object);
|
||||
args[0] = JS::ObjectValue(*cache_entry_object);
|
||||
argv = CallArgsFromVp(1, args);
|
||||
|
||||
JS_CallFunctionValue(smjs_ctx, JS::NullPtr(), hop->callback, argv, &r_rval);
|
||||
JS_CallFunctionValue(smjs_ctx, nullptr, hop->callback, argv, &r_rval);
|
||||
|
||||
end:
|
||||
if (download->cached)
|
||||
@ -70,7 +70,7 @@ end:
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_load_uri(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
smjs_load_uri(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
||||
static JSObject *smjs_session_object;
|
||||
|
||||
static bool session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp);
|
||||
static bool session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static void session_finalize(JSFreeOp *op, JSObject *obj);
|
||||
static bool session_construct(JSContext *ctx, unsigned int argc, jsval *rval);
|
||||
static bool session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval);
|
||||
|
||||
static const JSClass session_class = {
|
||||
"session",
|
||||
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS, /* struct session *; a weak reference */
|
||||
JSCLASS_HAS_PRIVATE, /* struct session *; a weak reference */
|
||||
JS_PropertyStub, nullptr,
|
||||
session_get_property, session_set_property,
|
||||
nullptr, nullptr, nullptr, session_finalize,
|
||||
@ -164,30 +164,30 @@ smjs_get_session_location_array_object(struct session *ses)
|
||||
* smjs_detach_session_object detaches both session.jsobject and
|
||||
* session.history.js_object. */
|
||||
|
||||
static bool session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_history(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_loading_uri(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
static bool session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp);
|
||||
static bool session_get_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_exit_query(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_get_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
static bool session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp);
|
||||
|
||||
enum session_prop {
|
||||
SESSION_VISITED,
|
||||
@ -229,7 +229,7 @@ static const JSPropertySpec session_props[] = {
|
||||
};
|
||||
|
||||
static bool
|
||||
session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -252,7 +252,7 @@ session_get_property_visited(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_history(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -281,7 +281,7 @@ session_get_property_history(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_loading_uri(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -311,7 +311,7 @@ session_get_property_loading_uri(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -334,7 +334,7 @@ session_get_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -357,7 +357,7 @@ session_get_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -380,7 +380,7 @@ session_get_property_search_direction(JSContext *ctx, unsigned int argc, jsval *
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -403,7 +403,7 @@ session_get_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -430,7 +430,7 @@ session_get_property_mark(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_exit_query(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -453,7 +453,7 @@ session_get_property_exit_query(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -481,7 +481,7 @@ session_get_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -507,7 +507,7 @@ session_get_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -530,7 +530,7 @@ session_get_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_get_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_get_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -580,7 +580,7 @@ session_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_visited(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -604,7 +604,7 @@ session_set_property_visited(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -627,7 +627,7 @@ session_set_property_reloadlevel(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -650,7 +650,7 @@ session_set_property_redirect_cnt(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_search_direction(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -687,7 +687,7 @@ session_set_property_search_direction(JSContext *ctx, unsigned int argc, jsval *
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -710,7 +710,7 @@ session_set_property_kbdprefix(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_mark(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -749,7 +749,7 @@ session_set_property_mark(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_insert_mode(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -788,7 +788,7 @@ session_set_property_insert_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -825,7 +825,7 @@ session_set_property_navigate_mode(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -857,7 +857,7 @@ session_set_property_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
session_set_property_last_search_word(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -891,7 +891,7 @@ session_set_property_last_search_word(JSContext *ctx, unsigned int argc, jsval *
|
||||
|
||||
|
||||
static bool
|
||||
session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp)
|
||||
session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
@ -916,12 +916,12 @@ session_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bo
|
||||
/** Pointed to by session_class.construct. Create a new session (tab)
|
||||
* and return the JSObject wrapper. */
|
||||
static bool
|
||||
session_construct(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
session_construct(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
//JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
int bg = 0; /* open new tab in background */
|
||||
struct session *ses;
|
||||
JSObject *jsobj;
|
||||
@ -1124,7 +1124,7 @@ smjs_detach_session_array_object(struct terminal *term)
|
||||
}
|
||||
|
||||
static bool
|
||||
smjs_session_goto_url(JSContext *ctx, unsigned int argc, jsval *rval)
|
||||
smjs_session_goto_url(JSContext *ctx, unsigned int argc, JS::Value *rval)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, rval);
|
||||
JS::RootedObject this_o(ctx, &args.thisv().toObject());
|
||||
|
@ -209,7 +209,7 @@ smjs_get_terminal_array_object(void)
|
||||
void
|
||||
smjs_init_terminal_interface(void)
|
||||
{
|
||||
jsval val;
|
||||
JS::Value val;
|
||||
struct JSObject *obj;
|
||||
|
||||
if (!smjs_ctx || !smjs_elinks_object)
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "viewer/text/vs.h"
|
||||
|
||||
static bool view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp);
|
||||
static bool view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
|
||||
static void view_state_finalize(JSFreeOp *op, JSObject *obj);
|
||||
|
||||
static const JSClass view_state_class = {
|
||||
@ -42,7 +42,7 @@ enum view_state_prop {
|
||||
};
|
||||
|
||||
static bool
|
||||
view_state_get_property_plain(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
view_state_get_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -65,7 +65,7 @@ view_state_get_property_plain(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
view_state_set_property_plain(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
view_state_set_property_plain(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -91,7 +91,7 @@ view_state_set_property_plain(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
}
|
||||
|
||||
static bool
|
||||
view_state_get_property_uri(JSContext *ctx, unsigned int argc, jsval *vp)
|
||||
view_state_get_property_uri(JSContext *ctx, unsigned int argc, JS::Value *vp)
|
||||
{
|
||||
JS::CallArgs args = CallArgsFromVp(argc, vp);
|
||||
JS::RootedObject hobj(ctx, &args.thisv().toObject());
|
||||
@ -162,7 +162,7 @@ view_state_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid,
|
||||
|
||||
/* @view_state_class.setProperty */
|
||||
static bool
|
||||
view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, bool strict, JS::MutableHandleValue hvp)
|
||||
view_state_set_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
|
||||
{
|
||||
jsid id = hid.get();
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
<script>
|
||||
while (true);
|
||||
var a = 0;
|
||||
while (true) {
|
||||
a += 1;
|
||||
a -= 1;
|
||||
}
|
||||
</script>
|
||||
|
Loading…
Reference in New Issue
Block a user