1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-12-04 14:46:47 -05:00

[ecmascript] bump mozjs version to 68

Memory allocated in jsval_to_string is not freed anywhere.
This commit is contained in:
Witold Filipczyk 2021-08-30 20:48:11 +02:00
parent d659fca9fc
commit 7f572e7e4a
15 changed files with 447 additions and 453 deletions

View File

@ -252,7 +252,7 @@ if conf_data.get('CONFIG_BZIP2')
endif
if conf_data.get('CONFIG_ECMASCRIPT')
mozjsdeps = dependency('mozjs-60')
mozjsdeps = dependency('mozjs-68')
deps += mozjsdeps
sqlite3deps = dependency('sqlite3')
deps += sqlite3deps

View File

@ -68,7 +68,6 @@ struct ecmascript_interpreter {
unsigned int onload_snippets_cache_id;
void *ac;
void *ac2;
void *ar;
void *document_obj;
void *location_obj;
JS::RootedValue fun;

View File

@ -2,6 +2,7 @@
#define EL__ECMASCRIPT_SPIDERMONKEY_SHARED_H
#include <jsapi.h>
#include <jsfriendapi.h>
#include "util/string.h"
@ -45,11 +46,13 @@ static char *jsid_to_string(JSContext *ctx, JS::HandleId hid);
static inline char *
jsval_to_string(JSContext *ctx, JS::HandleValue hvp)
{
// JS::RootedValue r_vp(ctx, *vp);
JSString *str = hvp.toString();
//JS::RootedString r_str(ctx, str);
/* Memory must be freed in caller */
return empty_string_or_(JS_EncodeString(ctx, str));
JSString *st = hvp.toString();
JS::RootedString rst(ctx, st);
JS::UniqueChars utf8chars = JS_EncodeStringToUTF8(ctx, rst);
return null_or_stracpy(utf8chars.get());
}
static inline char *

View File

@ -57,7 +57,9 @@
#include "viewer/text/view.h"
#include "viewer/text/vs.h"
#include <js/CompilationAndEvaluation.h>
#include <js/Printf.h>
#include <js/SourceText.h>
#include <libxml++/libxml++.h>
@ -152,13 +154,13 @@ PrintError(JSContext* cx, FILE* file, JS::ConstUTF8CharsZ toStringResult,
static void
error_reporter(JSContext *ctx, JSErrorReport *report)
{
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct session *ses = interpreter->vs->doc_view->session;
struct terminal *term;
char *strict, *exception, *warning, *error;
@ -238,8 +240,6 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
}
interpreter->backend_data = ctx;
interpreter->ar = new JSAutoRequest(ctx);
// JSAutoRequest ar(ctx);
// JS_SetContextPrivate(ctx, interpreter);
@ -248,18 +248,18 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
//JS::SetWarningReporter(ctx, error_reporter);
JS_AddInterruptCallback(ctx, heartbeat_callback);
JS::CompartmentOptions options;
JS::RealmOptions options;
JS::RootedObject window_obj(ctx, JS_NewGlobalObject(ctx, &window_class, NULL, JS::FireOnNewGlobalHook, options));
if (window_obj) {
interpreter->ac = window_obj;
interpreter->ac2 = new JSAutoCompartment(ctx, window_obj);
interpreter->ac2 = new JSAutoRealm(ctx, window_obj);
} else {
goto release_and_fail;
}
if (!JS_InitStandardClasses(ctx, window_obj)) {
if (!JS::InitRealmStandardClasses(ctx)) {
goto release_and_fail;
}
@ -352,7 +352,7 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
console_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
&console_class, NULL, 0,
console_props,
nullptr,
console_funcs,
NULL, NULL);
if (!console_obj) {
@ -361,14 +361,14 @@ spidermonkey_get_interpreter(struct ecmascript_interpreter *interpreter)
localstorage_obj = spidermonkey_InitClass(ctx, window_obj, NULL,
&localstorage_class, NULL, 0,
localstorage_props,
nullptr,
localstorage_funcs,
NULL, NULL);
if (!localstorage_obj) {
goto release_and_fail;
}
JS_SetCompartmentPrivate(js::GetContextCompartment(ctx), interpreter);
JS::SetRealmPrivate(js::GetContextRealm(ctx), interpreter);
return ctx;
@ -387,16 +387,12 @@ spidermonkey_put_interpreter(struct ecmascript_interpreter *interpreter)
ctx = interpreter->backend_data;
if (interpreter->ac2) {
delete (JSAutoCompartment *)interpreter->ac2;
}
if (interpreter->ar) {
delete (JSAutoRequest *)interpreter->ar;
delete (JSAutoRealm *)interpreter->ac2;
}
// JS_DestroyContext(ctx);
interpreter->backend_data = NULL;
interpreter->ac = nullptr;
interpreter->ac2 = nullptr;
interpreter->ar = nullptr;
}
void
@ -455,8 +451,7 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
return;
}
ctx = interpreter->backend_data;
JS_BeginRequest(ctx);
JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac);
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac);
interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = ret;
@ -465,13 +460,16 @@ spidermonkey_eval(struct ecmascript_interpreter *interpreter,
JS::RootedValue r_val(ctx, rval);
JS::CompileOptions options(ctx);
JS::Evaluate(ctx, options, code->source, code->length, &r_val);
JS::SourceText<mozilla::Utf8Unit> srcBuf;
if (!srcBuf.init(ctx, code->source, code->length, JS::SourceOwnership::Borrowed)) {
return;
}
JS::Evaluate(ctx, options, srcBuf, &r_val);
spidermonkey_check_for_exception(ctx);
done_heartbeat(interpreter->heartbeat);
JS_LeaveCompartment(ctx, comp);
JS_EndRequest(ctx);
JS::LeaveRealm(ctx, comp);
}
void
@ -486,8 +484,7 @@ spidermonkey_call_function(struct ecmascript_interpreter *interpreter,
return;
}
ctx = interpreter->backend_data;
JS_BeginRequest(ctx);
JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac);
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac);
interpreter->heartbeat = add_heartbeat(interpreter);
interpreter->ret = ret;
@ -496,8 +493,7 @@ spidermonkey_call_function(struct ecmascript_interpreter *interpreter,
JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx));
JS_CallFunctionValue(ctx, cg, fun, JS::HandleValueArray::empty(), &r_val);
done_heartbeat(interpreter->heartbeat);
JS_LeaveCompartment(ctx, comp);
JS_EndRequest(ctx);
JS::LeaveRealm(ctx, comp);
}
@ -516,8 +512,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
interpreter->ret = NULL;
interpreter->heartbeat = add_heartbeat(interpreter);
JS_BeginRequest(ctx);
JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac);
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac);
JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx));
JS::RootedValue r_rval(ctx, rval);
@ -528,7 +523,11 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
// .setCompileAndGo(true)
// .setNoScriptRval(true);
ret = JS::Evaluate(ctx, options, code->source, code->length, &r_rval);
JS::SourceText<mozilla::Utf8Unit> srcBuf;
if (!srcBuf.init(ctx, code->source, code->length, JS::SourceOwnership::Borrowed)) {
return NULL;
}
ret = JS::Evaluate(ctx, options, srcBuf, &r_rval);
done_heartbeat(interpreter->heartbeat);
if (ret == false) {
@ -540,8 +539,7 @@ spidermonkey_eval_stringback(struct ecmascript_interpreter *interpreter,
} else {
result = stracpy(jsval_to_string(ctx, r_rval));
}
JS_LeaveCompartment(ctx, comp);
JS_EndRequest(ctx);
JS::LeaveRealm(ctx, comp);
return result;
}
@ -560,21 +558,25 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
ctx = interpreter->backend_data;
interpreter->ret = NULL;
JSCompartment *comp = JS_EnterCompartment(ctx, interpreter->ac);
JS_BeginRequest(ctx);
JS::RootedFunction fun(ctx);
JS::Realm *comp = JS::EnterRealm(ctx, interpreter->ac);
JS::CompileOptions options(ctx);
JS::AutoObjectVector ag(ctx);
if (!JS::CompileFunction(ctx, ag, options, "aaa", 0, nullptr, code->source,
code->length, &fun)) {
JS::RootedObjectVector ag(ctx);
JS::SourceText<mozilla::Utf8Unit> srcBuf;
if (!srcBuf.init(ctx, code->source, code->length, JS::SourceOwnership::Borrowed)) {
return -1;
}
JSFunction *funs = JS::CompileFunction(ctx, ag, options, "aaa", 0, nullptr, srcBuf);
if (!funs) {
return -1;
};
interpreter->heartbeat = add_heartbeat(interpreter);
JS::RootedValue r_val(ctx, rval);
JS::RootedObject cg(ctx, JS::CurrentGlobalOrNull(ctx));
JS::RootedFunction fun(ctx, funs);
ret = JS_CallFunction(ctx, cg, fun, JS::HandleValueArray::empty(), &r_val);
done_heartbeat(interpreter->heartbeat);
@ -591,8 +593,7 @@ spidermonkey_eval_boolback(struct ecmascript_interpreter *interpreter,
result = r_val.toBoolean();
}
JS_LeaveCompartment(ctx, comp);
JS_EndRequest(ctx);
JS::LeaveRealm(ctx, comp);
return result;
}

View File

@ -46,7 +46,7 @@ JSClassOps console_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @console_class object must have a @window_class parent. */
@ -56,10 +56,6 @@ const JSClass console_class = {
&console_ops
};
const JSPropertySpec console_props[] = {
{ NULL }
};
/* @console_class.getProperty */
static bool
console_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)

View File

@ -28,6 +28,7 @@
#include "ecmascript/spidermonkey/location.h"
#include "ecmascript/spidermonkey/document.h"
#include "ecmascript/spidermonkey/element.h"
#include "ecmascript/spidermonkey/util.h"
#include "ecmascript/spidermonkey/window.h"
#include "intl/libintl.h"
#include "main/select.h"
@ -72,7 +73,7 @@ JSClassOps document_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
@ -92,8 +93,8 @@ document_get_property_anchors(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -140,13 +141,13 @@ document_get_property_baseURI(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -179,8 +180,8 @@ document_get_property_body(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -236,13 +237,13 @@ 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());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct string *cookies;
@ -276,13 +277,13 @@ 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());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct string *cookies;
@ -306,8 +307,8 @@ document_get_property_charset(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -340,8 +341,8 @@ document_get_property_doctype(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -380,8 +381,8 @@ document_get_property_documentElement(JSContext *ctx, unsigned int argc, JS::Val
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -428,13 +429,13 @@ document_get_property_documentURI(JSContext *ctx, unsigned int argc, JS::Value *
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -469,13 +470,13 @@ document_get_property_domain(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -508,8 +509,8 @@ document_get_property_forms(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -553,8 +554,8 @@ document_get_property_head(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -598,8 +599,8 @@ document_get_property_images(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -643,8 +644,8 @@ document_get_property_links(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -688,17 +689,17 @@ document_get_property_location(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
JS::RootedObject parent_win(ctx, JS::GetNonCCWObjectGlobal(hobj));
assert(JS_InstanceOf(ctx, parent_win, &window_class, NULL));
if_assert_failed return false;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
args.rval().setObject(*(JSObject *)(interpreter->location_obj));
return true;
@ -713,7 +714,7 @@ document_get_property_nodeType(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
@ -733,13 +734,13 @@ 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());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct document_view *doc_view;
@ -765,13 +766,13 @@ 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());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct document_view *doc_view;
@ -834,8 +835,8 @@ document_get_property_scripts(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -882,13 +883,13 @@ 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());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
@ -914,16 +915,16 @@ document_set_property_title(JSContext *ctx, int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::RootedObject parent_win(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
JS::RootedObject parent_win(ctx, JS::GetNonCCWObjectGlobal(hobj));
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
@ -949,13 +950,13 @@ document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct document_view *doc_view;
@ -981,7 +982,7 @@ document_get_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
}
static bool
document_set_property_url(JSContext *ctx, int argc, JS::Value *vp)
document_set_property_url(JSContext *ctx, unsigned int argc, JS::Value *vp)
{
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
@ -989,13 +990,13 @@ document_set_property_url(JSContext *ctx, int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
@ -1079,13 +1080,13 @@ document_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
struct document *document;
struct form *form;
char *string;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JSClass* classPtr = JS_GetClass(hobj);
@ -1130,13 +1131,13 @@ document_write_do(JSContext *ctx, unsigned int argc, JS::Value *rval, int newlin
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::Value val;
struct string *ret = interpreter->ret;
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
@ -1223,8 +1224,8 @@ document_replace(JSContext *ctx, unsigned int argc, JS::Value *vp)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct session *ses = doc_view->session;
struct terminal *term = ses->tab->term;
@ -1325,8 +1326,8 @@ document_createComment(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
xmlpp::Element* emptyRoot = (xmlpp::Element *)emptyDoc.get_root_node();
@ -1374,8 +1375,8 @@ document_createElement(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
xmlpp::Element* emptyRoot = (xmlpp::Element *)emptyDoc.get_root_node();
@ -1423,8 +1424,8 @@ document_createTextNode(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
xmlpp::Element* emptyRoot = (xmlpp::Element *)emptyDoc.get_root_node();
@ -1472,8 +1473,8 @@ document_getElementById(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -1534,8 +1535,8 @@ document_getElementsByClassName(JSContext *ctx, unsigned int argc, JS::Value *vp
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -1596,8 +1597,8 @@ document_getElementsByName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -1660,8 +1661,8 @@ document_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
return true;
}
JSCompartment *comp = js::GetContextCompartment(ctx);
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
JS::Realm *comp = js::GetContextRealm(ctx);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct document *document = doc_view->document;
@ -1719,7 +1720,7 @@ JSClassOps doctype_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook};
JS_GlobalObjectTraceHook
};
JSClass doctype_class = {
@ -1736,13 +1737,13 @@ doctype_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1771,13 +1772,13 @@ doctype_get_property_publicId(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1806,13 +1807,13 @@ doctype_get_property_systemId(JSContext *ctx, unsigned int argc, JS::Value *vp)
#endif
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail

View File

@ -103,7 +103,7 @@ JSClassOps element_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass element_class = {
@ -155,13 +155,13 @@ element_get_property_attributes(JSContext *ctx, unsigned int argc, JS::Value *vp
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -205,13 +205,13 @@ element_get_property_children(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -271,13 +271,13 @@ element_get_property_childElementCount(JSContext *ctx, unsigned int argc, JS::Va
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -312,13 +312,13 @@ element_get_property_childNodes(JSContext *ctx, unsigned int argc, JS::Value *vp
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -363,13 +363,13 @@ element_get_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -406,13 +406,13 @@ element_get_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -452,13 +452,13 @@ element_get_property_firstChild(JSContext *ctx, unsigned int argc, JS::Value *vp
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -501,13 +501,13 @@ element_get_property_firstElementChild(JSContext *ctx, unsigned int argc, JS::Va
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -559,13 +559,13 @@ element_get_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -601,13 +601,13 @@ element_get_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -643,13 +643,13 @@ element_get_property_lastChild(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -691,13 +691,13 @@ element_get_property_lastElementChild(JSContext *ctx, unsigned int argc, JS::Val
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -749,13 +749,13 @@ element_get_property_nextElementSibling(JSContext *ctx, unsigned int argc, JS::V
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -807,13 +807,13 @@ element_get_property_nodeName(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -865,13 +865,13 @@ element_get_property_nodeType(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -917,13 +917,13 @@ element_get_property_nodeValue(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -986,13 +986,13 @@ element_get_property_nextSibling(JSContext *ctx, unsigned int argc, JS::Value *v
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1035,13 +1035,13 @@ element_get_property_ownerDocument(JSContext *ctx, unsigned int argc, JS::Value
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1068,13 +1068,13 @@ element_get_property_parentElement(JSContext *ctx, unsigned int argc, JS::Value
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1117,13 +1117,13 @@ element_get_property_parentNode(JSContext *ctx, unsigned int argc, JS::Value *vp
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1166,13 +1166,13 @@ element_get_property_previousElementSibling(JSContext *ctx, unsigned int argc, J
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1224,13 +1224,13 @@ element_get_property_previousSibling(JSContext *ctx, unsigned int argc, JS::Valu
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1273,13 +1273,13 @@ element_get_property_tagName(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1316,13 +1316,13 @@ element_get_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1443,13 +1443,13 @@ element_get_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1488,13 +1488,13 @@ element_get_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1533,13 +1533,13 @@ element_get_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1578,13 +1578,13 @@ element_set_property_className(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1618,13 +1618,13 @@ element_set_property_dir(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1662,13 +1662,13 @@ element_set_property_id(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1702,13 +1702,13 @@ element_set_property_innerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1764,13 +1764,13 @@ element_set_property_innerText(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1811,13 +1811,13 @@ element_set_property_lang(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1851,13 +1851,13 @@ element_set_property_outerHtml(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1882,13 +1882,13 @@ element_set_property_textContent(JSContext *ctx, unsigned int argc, JS::Value *v
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1914,13 +1914,13 @@ element_set_property_title(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2011,7 +2011,7 @@ element_appendChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2020,7 +2020,7 @@ element_appendChild(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL)) {
return false;
@ -2048,7 +2048,7 @@ element_contains(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2057,7 +2057,7 @@ element_contains(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2093,7 +2093,7 @@ element_getAttributeNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2102,7 +2102,7 @@ element_getAttributeNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2128,7 +2128,7 @@ element_hasAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2137,7 +2137,7 @@ element_hasAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2161,7 +2161,7 @@ element_hasAttributes(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 0) {
return false;
@ -2192,7 +2192,7 @@ element_hasChildNodes(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 0) {
return false;
@ -2223,13 +2223,13 @@ element_insertBefore(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 2) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
@ -2270,7 +2270,7 @@ element_isEqualNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2279,7 +2279,7 @@ element_isEqualNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2318,7 +2318,7 @@ element_isSameNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 1) {
return false;
@ -2327,7 +2327,7 @@ element_isSameNode(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2353,7 +2353,7 @@ element_remove(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 0) {
return false;
@ -2362,7 +2362,7 @@ element_remove(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2385,7 +2385,7 @@ element_setAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp || argc != 2) {
return false;
@ -2394,7 +2394,7 @@ element_setAttribute(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::CallArgs args = CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &element_class, NULL))
return false;
@ -2451,7 +2451,7 @@ JSClassOps htmlCollection_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass htmlCollection_class = {
@ -2483,13 +2483,13 @@ htmlCollection_get_property_length(JSContext *ctx, unsigned int argc, JS::Value
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2557,13 +2557,13 @@ htmlCollection_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutab
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &htmlCollection_class, NULL)) return false;
@ -2597,13 +2597,13 @@ htmlCollection_namedItem2(JSContext *ctx, JS::HandleObject hobj, char *str, JS::
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &htmlCollection_class, NULL))
return false;
@ -2647,13 +2647,13 @@ htmlCollection_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId
struct view_state *vs;
JS::Value idval;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2722,7 +2722,7 @@ JSClassOps nodeList_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass nodeList_class = {
@ -2753,13 +2753,13 @@ nodeList_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2807,13 +2807,13 @@ nodeList_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHand
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &nodeList_class, NULL)) return false;
@ -2856,13 +2856,13 @@ nodeList_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, J
struct view_state *vs;
JS::Value idval;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2920,7 +2920,7 @@ JSClassOps attributes_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass attributes_class = {
@ -2952,13 +2952,13 @@ attributes_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -3025,13 +3025,13 @@ attributes_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHa
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &attributes_class, NULL)) return false;
@ -3066,13 +3066,13 @@ attributes_namedItem2(JSContext *ctx, JS::HandleObject hobj, char *str, JS::Muta
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &attributes_class, NULL))
return false;
@ -3117,13 +3117,13 @@ attributes_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid,
struct view_state *vs;
JS::Value idval;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -3185,7 +3185,7 @@ JSClassOps attr_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass attr_class = {
@ -3210,13 +3210,13 @@ attr_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -3252,13 +3252,13 @@ attr_get_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail

View File

@ -78,7 +78,7 @@ static JSClassOps form_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @form_class object must have a @document_class parent. */
@ -108,7 +108,7 @@ static JSClassOps input_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @input_class object must have a @form_class parent. */
@ -164,13 +164,13 @@ input_get_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct link *link = NULL;
JSString *keystr;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
@ -225,13 +225,13 @@ input_set_property_accessKey(JSContext *ctx, unsigned int argc, JS::Value *vp)
int linknum;
struct link *link = NULL;
unicode_val_T accesskey;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -305,13 +305,13 @@ input_get_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
@ -345,13 +345,13 @@ input_set_property_alt(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -404,13 +404,13 @@ input_set_property_checked(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
@ -447,13 +447,13 @@ input_get_property_defaultChecked(JSContext *ctx, unsigned int argc, JS::Value *
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -487,13 +487,13 @@ input_get_property_defaultValue(JSContext *ctx, unsigned int argc, JS::Value *vp
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -528,13 +528,13 @@ input_get_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -569,13 +569,13 @@ input_set_property_disabled(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -607,7 +607,7 @@ input_get_property_form(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::CallArgs args = CallArgsFromVp(argc, vp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::RootedObject parent_form(ctx, js::GetGlobalForObjectCrossCompartment(hobj));
JS::RootedObject parent_form(ctx, JS::GetNonCCWObjectGlobal(hobj));
assert(JS_InstanceOf(ctx, parent_form, &form_class, NULL));
if_assert_failed return false;
@ -630,13 +630,13 @@ input_get_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -670,13 +670,13 @@ input_set_property_maxLength(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -710,13 +710,13 @@ input_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
if (!vs) {
@ -751,13 +751,13 @@ input_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
@ -799,13 +799,13 @@ input_get_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -847,13 +847,13 @@ input_set_property_readonly(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -896,13 +896,13 @@ input_get_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *v
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -948,13 +948,13 @@ input_set_property_selectedIndex(JSContext *ctx, unsigned int argc, JS::Value *v
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1001,13 +1001,13 @@ input_get_property_size(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1049,13 +1049,13 @@ input_get_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct el_form_control *fc;
int linknum;
struct link *link = NULL;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1104,13 +1104,13 @@ input_set_property_src(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct el_form_control *fc;
int linknum;
struct link *link = NULL;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1158,13 +1158,13 @@ input_get_property_tabIndex(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct el_form_control *fc;
int linknum;
struct link *link = NULL;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1214,13 +1214,13 @@ input_get_property_type(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct form_state *fs;
struct el_form_control *fc;
char *s = NULL;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1298,13 +1298,13 @@ input_set_property_value(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document *document;
struct form_state *fs;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1471,8 +1471,8 @@ input_click(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::Value val;
JS::RootedObject parent_form(ctx); /* instance of @form_class */
JS::RootedObject parent_doc(ctx); /* instance of @document_class */
JS::RootedObject hobj(ctx, JS_THIS_OBJECT(ctx, rval));
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
@ -1480,13 +1480,13 @@ input_click(JSContext *ctx, unsigned int argc, JS::Value *rval)
struct form_state *fs;
struct el_form_control *fc;
int linknum;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false;
@ -1528,8 +1528,9 @@ input_focus(JSContext *ctx, unsigned int argc, JS::Value *rval)
JS::Value val;
JS::RootedObject parent_form(ctx); /* instance of @form_class */
JS::RootedObject parent_doc(ctx); /* instance of @document_class */
JS::RootedObject hobj(ctx, JS_THIS_OBJECT(ctx, rval));
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
@ -1537,13 +1538,13 @@ input_focus(JSContext *ctx, unsigned int argc, JS::Value *rval)
struct form_state *fs;
struct el_form_control *fc;
int linknum;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &input_class, &args)) return false;
@ -1718,7 +1719,7 @@ get_form_control_object(JSContext *ctx,
}
static struct form_view *form_get_form_view(JSContext *ctx, JSObject *jsform, JS::Value *argv);
static struct form_view *form_get_form_view(JSContext *ctx, JS::HandleObject jsform, JS::Value *argv);
static bool form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp);
static JSClassOps form_elements_ops = {
@ -1732,7 +1733,7 @@ static JSClassOps form_elements_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @form_elements_class object must have a @form_class parent. */
@ -1783,13 +1784,13 @@ form_elements_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId h
struct form_view *form_view;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -1857,13 +1858,13 @@ form_elements_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *
struct document *document;
struct form_view *form_view;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
@ -1919,13 +1920,13 @@ form_elements_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::Mutabl
struct form *form;
struct el_form_control *fc;
int counter = -1;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &form_elements_class, NULL)) return false;
@ -1996,13 +1997,13 @@ form_elements_namedItem2(JSContext *ctx, JS::HandleObject hobj, char *string, JS
struct form_view *form_view;
struct form *form;
struct el_form_control *fc;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!*string) {
return true;
@ -2077,20 +2078,19 @@ static const spidermonkeyFunctionSpec form_funcs[] = {
};
static struct form_view *
form_get_form_view(JSContext *ctx, JSObject *jsform, JS::Value *argv)
form_get_form_view(JSContext *ctx, JS::HandleObject r_jsform, JS::Value *argv)
{
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JS::RootedObject r_jsform(ctx, jsform);
struct form_view *fv = JS_GetInstancePrivate(ctx, r_jsform,
&form_class,
NULL);
if (!fv) return NULL; /* detached */
assert(fv->ecmascript_obj == jsform);
if_assert_failed return NULL;
// assert(fv->ecmascript_obj == jsform);
// if_assert_failed return NULL;
return fv;
}
@ -2110,13 +2110,13 @@ form_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::M
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2179,13 +2179,13 @@ form_get_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2222,13 +2222,13 @@ form_set_property_action(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct form_view *fv;
struct form *form;
char *string;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2304,13 +2304,13 @@ form_get_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2360,13 +2360,13 @@ form_set_property_encoding(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct form_view *fv;
struct form *form;
char *string;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2411,13 +2411,13 @@ form_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2454,13 +2454,13 @@ form_get_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2509,13 +2509,13 @@ form_set_property_method(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct form_view *fv;
struct form *form;
char *string;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2557,13 +2557,13 @@ form_get_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2601,13 +2601,13 @@ form_set_property_name(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2643,13 +2643,13 @@ form_get_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2685,13 +2685,13 @@ form_set_property_target(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -2724,28 +2724,28 @@ form_reset(JSContext *ctx, unsigned int argc, JS::Value *rval)
#endif
JS::Value val;
JS::RootedObject parent_doc(ctx); /* instance of @document_class */
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
JS::RootedObject hobj(ctx, obj);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
// JS::Value *argv = JS_ARGV(ctx, rval);
struct view_state *vs;
struct document_view *doc_view;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false;
vs = interpreter->vs;
doc_view = vs->doc_view;
/// fv = form_get_form_view(ctx, obj, argv);
fv = form_get_form_view(ctx, obj, rval);
fv = form_get_form_view(ctx, hobj, rval);
if (!fv) return false; /* detached */
form = find_form_by_form_view(doc_view->document, fv);
@ -2768,22 +2768,22 @@ form_submit(JSContext *ctx, unsigned int argc, JS::Value *rval)
#endif
JS::Value val;
JS::RootedObject parent_doc(ctx); /* instance of @document_class */
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
JS::RootedObject hobj(ctx, obj);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
// JS::Value *argv = JS_ARGV(ctx, rval);
struct view_state *vs;
struct document_view *doc_view;
struct session *ses;
struct form_view *fv;
struct form *form;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &form_class, &args)) return false;
@ -2791,7 +2791,7 @@ form_submit(JSContext *ctx, unsigned int argc, JS::Value *rval)
doc_view = vs->doc_view;
ses = doc_view->session;
// fv = form_get_form_view(ctx, obj, argv);
fv = form_get_form_view(ctx, obj, rval);
fv = form_get_form_view(ctx, hobj, rval);
if (!fv) return false; /* detached */
form = find_form_by_form_view(doc_view->document, fv);
@ -2903,7 +2903,7 @@ JSClassOps forms_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @forms_class object must have a @document_class parent. */
@ -2973,13 +2973,13 @@ forms_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::
// JS::RootedObject parent_doc(ctx); /* instance of @document_class */
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -3022,13 +3022,13 @@ forms_get_property_length(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
struct document *document;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -3082,13 +3082,13 @@ forms_item2(JSContext *ctx, JS::HandleObject hobj, int index, JS::MutableHandleV
if (!JS_InstanceOf(ctx, hobj, &forms_class, NULL))
return false;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
vs = interpreter->vs;
@ -3120,13 +3120,13 @@ forms_namedItem(JSContext *ctx, unsigned int argc, JS::Value *vp)
// JS::Value *argv = JS_ARGV(ctx, rval);
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &forms_class, &args)) return false;

View File

@ -36,13 +36,13 @@ static struct itimerval heartbeat_timer = { { 1, 0 }, { 1, 0 } };
bool
heartbeat_callback(JSContext *ctx)
{
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return true;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!interpreter || !interpreter->heartbeat || interpreter->heartbeat->ttl > 0) {
return true;

View File

@ -109,7 +109,7 @@ JSClassOps localstorage_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @localstorage_class object must have a @window_class parent. */
@ -119,10 +119,6 @@ const JSClass localstorage_class = {
&localstorage_ops
};
const JSPropertySpec localstorage_props[] = {
{ NULL }
};
///* @localstorage_class.getProperty */
static bool
localstorage_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS::MutableHandleValue hvp)
@ -151,14 +147,14 @@ localstorage_getitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
//jsval val;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp)
{
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::CallArgs args = CallArgsFromVp(argc, vp);
unsigned char *key = jsval_to_string(ctx, args[0]);
//DBG("localstorage get by key: %s\n", args);
@ -196,13 +192,13 @@ localstorage_setitem(JSContext *ctx, unsigned int argc, JS::Value *vp)
init_string(&key);
init_string(&val);
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp)
{
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::CallArgs args = CallArgsFromVp(argc, vp);
if (argc != 2)

View File

@ -61,7 +61,7 @@ JSClassOps history_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass history_class = {
@ -84,13 +84,13 @@ history_back(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct document_view *doc_view = interpreter->vs->doc_view;
struct session *ses = doc_view->session;
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
@ -112,13 +112,13 @@ history_forward(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
struct document_view *doc_view = interpreter->vs->doc_view;
struct session *ses = doc_view->session;
@ -137,13 +137,13 @@ history_go(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
struct document_view *doc_view = interpreter->vs->doc_view;
struct session *ses = doc_view->session;
@ -200,7 +200,7 @@ JSClassOps location_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @location_class object must have a @window_class parent. */
JSClass location_class = {
@ -239,13 +239,13 @@ location_get_property_hash(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -281,13 +281,13 @@ location_get_property_host(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -322,13 +322,13 @@ location_get_property_hostname(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -363,13 +363,13 @@ location_get_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -404,13 +404,13 @@ location_get_property_origin(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -445,13 +445,13 @@ location_get_property_pathname(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -487,13 +487,13 @@ location_get_property_port(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -527,13 +527,13 @@ location_get_property_protocol(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -573,13 +573,13 @@ location_get_property_search(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -618,13 +618,13 @@ location_set_property_hash(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -654,13 +654,13 @@ location_set_property_host(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -689,13 +689,13 @@ location_set_property_hostname(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -724,13 +724,13 @@ location_set_property_href(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -759,13 +759,13 @@ location_set_property_pathname(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -794,13 +794,13 @@ location_set_property_port(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -829,13 +829,13 @@ location_set_property_protocol(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -864,13 +864,13 @@ location_set_property_search(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -909,13 +909,13 @@ location_reload(JSContext *ctx, unsigned int argc, JS::Value *rval)
struct view_state *vs;
struct document_view *doc_view;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -941,9 +941,8 @@ location_toString(JSContext *ctx, unsigned int argc, JS::Value *rval)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JS::Value val;
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, obj);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::RootedValue r_val(ctx, val);
bool ret = JS_GetProperty(ctx, hobj, "href", &r_val);

View File

@ -62,7 +62,7 @@ JSClassOps navigator_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass navigator_class = {

View File

@ -56,7 +56,7 @@ JSClassOps screen_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass screen_class = {
@ -88,13 +88,13 @@ screen_get_property_availHeight(JSContext *ctx, unsigned int argc, JS::Value *vp
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -128,13 +128,13 @@ screen_get_property_availWidth(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -168,13 +168,13 @@ screen_get_property_height(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail
@ -214,13 +214,13 @@ screen_get_property_width(JSContext *ctx, unsigned int argc, JS::Value *vp)
JS::RootedObject hobj(ctx, &args.thisv().toObject());
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of the
* appropriate class but has one in its prototype chain. Fail

View File

@ -59,7 +59,7 @@ JSClassOps menubar_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @menubar_class object must have a @window_class parent. */
@ -80,7 +80,7 @@ JSClassOps statusbar_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
/* Each @statusbar_class object must have a @window_class parent. */
JSClass statusbar_class = {
@ -116,13 +116,13 @@ unibar_get_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct session_status *status;
char *bar;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of either
* appropriate class but has one in its prototype chain. Fail
@ -172,13 +172,13 @@ unibar_set_property_visible(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct session_status *status;
char *bar;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* This can be called if @obj if not itself an instance of either
* appropriate class but has one in its prototype chain. Fail

View File

@ -64,7 +64,7 @@ JSClassOps window_ops = {
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace JS_GlobalObjectTraceHook
JS_GlobalObjectTraceHook
};
JSClass window_class = {
@ -152,13 +152,13 @@ window_get_property(JSContext *ctx, JS::HandleObject hobj, JS::HandleId hid, JS:
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
struct view_state *vs;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
/* 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. */
@ -218,24 +218,24 @@ window_alert(JSContext *ctx, unsigned int argc, JS::Value *rval)
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JS::Value val;
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
JS::RootedObject hobj(ctx, obj);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JSCompartment *comp = js::GetContextCompartment(ctx);
// JS::RootedObject hobj(ctx, &args.thisv().toObject());
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
// JS::Value *argv = JS_ARGV(ctx, rval);
struct view_state *vs;
char *string;
if (!JS_InstanceOf(ctx, hobj, &window_class, nullptr)) {
return false;
}
// if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) {
// return false;
// }
vs = interpreter->vs;
@ -261,9 +261,8 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSObject *obj = JS_THIS_OBJECT(ctx, rval);
JS::RootedObject hobj(ctx, obj);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
JS::RootedObject hobj(ctx, &args.thisv().toObject());
// JS::Value *argv = JS_ARGV(ctx, rval);
struct view_state *vs;
struct document_view *doc_view;
@ -273,13 +272,13 @@ window_open(JSContext *ctx, unsigned int argc, JS::Value *rval)
struct uri *uri;
static time_t ratelimit_start;
static int ratelimit_count;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
if (!JS_InstanceOf(ctx, hobj, &window_class, &args)) return false;
@ -382,13 +381,13 @@ window_setTimeout(JSContext *ctx, unsigned int argc, JS::Value *rval)
#ifdef ECMASCRIPT_DEBUG
fprintf(stderr, "%s:%s\n", __FILE__, __FUNCTION__);
#endif
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::CallArgs args = JS::CallArgsFromVp(argc, rval);
// struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
@ -518,13 +517,13 @@ window_set_property_status(JSContext *ctx, unsigned int argc, JS::Value *vp)
}
JS::RootedObject hobj(ctx, &args.thisv().toObject());
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
struct view_state *vs = interpreter->vs;
if (!vs) {
@ -549,13 +548,13 @@ window_get_property_top(JSContext *ctx, unsigned int argc, JS::Value *vp)
struct document_view *doc_view;
struct document_view *top_view;
JSObject *newjsframe;
JSCompartment *comp = js::GetContextCompartment(ctx);
JS::Realm *comp = js::GetContextRealm(ctx);
if (!comp) {
return false;
}
struct ecmascript_interpreter *interpreter = JS_GetCompartmentPrivate(comp);
struct ecmascript_interpreter *interpreter = JS::GetRealmPrivate(comp);
JS::RootedObject hobj(ctx, &args.thisv().toObject());