Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
vendor(v8): add Web IDL object bridges
ldm0e4e497e225e1
diff --git a/vendor/v8-152.2.0/Cargo.toml b/vendor/v8-152.2.0/Cargo.tomlindex f5b163126..562912cc7 100644--- a/vendor/v8-152.2.0/Cargo.toml+++ b/vendor/v8-152.2.0/Cargo.toml@@ -265,6 +265,9 @@ version = "6"[build-dependencies.bindgen]version = "0.72"+[build-dependencies.cc]+version = "1"+[build-dependencies.fslock]version = "0.2"diff --git a/vendor/v8-152.2.0/Cargo.toml.orig b/vendor/v8-152.2.0/Cargo.toml.origindex 2a30e3096..b6869fa85 100644--- a/vendor/v8-152.2.0/Cargo.toml.orig+++ b/vendor/v8-152.2.0/Cargo.toml.orig@@ -123,6 +123,7 @@ fslock = "0.2"which = "6"home = "0"bindgen = "0.72"+cc = "1"[dev-dependencies]miniz_oxide = "0.8.8"diff --git a/vendor/v8-152.2.0/build.rs b/vendor/v8-152.2.0/build.rsindex bae40abdc..1a31ea9e7 100644--- a/vendor/v8-152.2.0/build.rs+++ b/vendor/v8-152.2.0/build.rs@@ -1,3 +1,5 @@+#![allow(dead_code, unused_variables)]+// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.use fslock::LockFile;use miniz_oxide::MZFlush;@@ -46,9 +48,12 @@ fn clang_resource_dir(clang_bin: &Path) -> Result<String, String> {}fn main() {- println!("cargo:rerun-if-changed=.gn");- println!("cargo:rerun-if-changed=BUILD.gn");- println!("cargo:rerun-if-changed=src/binding.cc");+ println!("cargo:rerun-if-changed=build.rs");+ // The upstream binding and every Moli-owned bridge live under `src`. Watch+ // the directory so adding or removing an `_ext.cc` file cannot drift from+ // the compiler inputs discovered below.+ println!("cargo:rerun-if-changed=src");+ let moli_v8_ext_sources = moli_v8_ext_sources();// These are all the environment variables that we check. This is// probably more than what is needed, but missing an important@@ -127,8 +132,9 @@ fn main() {// because we store everything in a parent directory of OUT_DIR.let _lockfile = acquire_lock();- // Build from sourceif env_bool("V8_FROM_SOURCE") {+ ensure_full_source_build_layout();+if is_asan && env::var_os("OPT_LEVEL").unwrap_or_default() == "0" {panic!("v8 crate cannot be compiled with OPT_LEVEL=0 and ASAN.\nTry `[profile.dev.package.v8] opt-level = 1`.\nAborting before miscompilations cause issues."@@ -142,6 +148,7 @@ fn main() {build_v8(is_asan);build_binding();+ build_moli_v8_ext(&moli_v8_ext_sources);return;}@@ -149,6 +156,56 @@ fn main() {print_prebuilt_src_binding_path();download_static_lib_binaries();+ build_moli_v8_ext(&moli_v8_ext_sources);+}++fn moli_v8_ext_sources() -> Vec<PathBuf> {+ let mut sources = fs::read_dir("src")+ .expect("vendored V8 src directory must exist")+ .map(|entry| entry.expect("vendored V8 src entry must be readable").path())+ .filter(|path| {+ path+ .file_name()+ .and_then(|name| name.to_str())+ .is_some_and(|name| name.ends_with("_ext.cc"))+ })+ .collect::<Vec<_>>();+ sources.sort();+ assert!(+ !sources.is_empty(),+ "vendored V8 must contain local *_ext.cc bridge sources"+ );+ sources+}++fn ensure_full_source_build_layout() {+ let required_paths = [+ "BUILD.gn",+ "build/config/BUILDCONFIG.gn",+ "buildtools",+ "third_party",+ "tools/get_bindgen_args.py",+ "tools/clang/scripts/update.py",+ "v8/BUILD.gn",+ "v8/src/objects/module.cc",+ "v8/src/interpreter/interpreter-generator.cc",+ "v8/src/compiler/bytecode-graph-builder.cc",+ "v8/src/wasm/wasm-objects.h",+ ];+ let missing = required_paths+ .iter()+ .filter(|path| !Path::new(path).exists())+ .copied()+ .collect::<Vec<_>>();+ if !missing.is_empty() {+ panic!(+ "V8_FROM_SOURCE=1 requires a full upstream rusty_v8 source-build layout. \+This Moli checkout contains the slim prebuilt-only vendor tree. Missing \+required path(s): {}. Restore the full rusty_v8/V8 source tree before using \+V8_FROM_SOURCE=1, or provide a matching custom RUSTY_V8_ARCHIVE.",+ missing.join(", ")+ );+ }}fn acquire_lock() -> LockFile {@@ -340,6 +397,25 @@ fn build_binding() {.expect("Couldn't write bindings!");}+fn build_moli_v8_ext(sources: &[PathBuf]) {+ let mut build = cc::Build::new();+ build+ .cpp(true)+ .warnings(false)+ .include(".")+ .include("v8/include")+ .std("c++20")+ .flag_if_supported("-w");+ let compiler = build.get_compiler();+ if compiler.is_like_msvc() && !compiler.is_like_clang_cl() {+ build.flag("/Zc:__cplusplus");+ }+ for source in sources {+ build.file(source);+ }+ build.compile("rusty_v8_moli_ext");+}+/// Builds the explicit Linux header-search arguments for bindgen.////// An explicit Clang resource directory uses `-resource-dir` so Clang resolvesdiff --git a/vendor/v8-152.2.0/src/function_template_ext.cc b/vendor/v8-152.2.0/src/function_template_ext.ccnew file mode 100644index 000000000..797d87815--- /dev/null+++ b/vendor/v8-152.2.0/src/function_template_ext.cc@@ -0,0 +1,15 @@+// Copyright 2026 the Moli authors. MIT license.++#include "support.h"+#include "v8-template.h"++using namespace support;++extern "C" {++bool v8__FunctionTemplate__HasInstance(const v8::FunctionTemplate& self,+ const v8::Value& value) {+ return ptr_to_local(&self)->HasInstance(ptr_to_local(&value));+}++} // extern "C"diff --git a/vendor/v8-152.2.0/src/object.rs b/vendor/v8-152.2.0/src/object.rsindex b4d4ede28..aca4e73ca 100644--- a/vendor/v8-152.2.0/src/object.rs+++ b/vendor/v8-152.2.0/src/object.rs@@ -1,4 +1,6 @@use crate::AccessorConfiguration;+use crate::LazyDataPropertyConfiguration;+use crate::NativeDataPropertyConfiguration;use crate::AccessorNameGetterCallback;use crate::AccessorNameSetterCallback;use crate::Array;@@ -55,6 +57,15 @@ unsafe extern "C" {data_or_null: *const Value,attr: PropertyAttribute,) -> MaybeBool;+ fn v8__Object__SetNativeDataProperty(+ this: *const Object,+ context: *const Context,+ key: *const Name,+ getter: AccessorNameGetterCallback,+ setter: Option<AccessorNameSetterCallback>,+ data_or_null: *const Value,+ attr: PropertyAttribute,+ ) -> MaybeBool;#[allow(clippy::too_many_arguments)]fn v8__Object__SetLazyDataProperty(this: *const Object,@@ -611,6 +622,57 @@ impl Object {.into()}+ /// Defines a callback-backed native data property.+ #[inline(always)]+ pub fn set_native_data_property(+ &self,+ scope: &PinScope<'_, '_>,+ name: Local<Name>,+ getter: impl MapFnTo<AccessorNameGetterCallback>,+ ) -> Option<bool> {+ self.set_native_data_property_with_configuration(+ scope,+ name,+ NativeDataPropertyConfiguration::new(getter),+ )+ }++ #[inline(always)]+ pub fn set_native_data_property_with_setter(+ &self,+ scope: &PinScope<'_, '_>,+ name: Local<Name>,+ getter: impl MapFnTo<AccessorNameGetterCallback>,+ setter: impl MapFnTo<AccessorNameSetterCallback>,+ ) -> Option<bool> {+ self.set_native_data_property_with_configuration(+ scope,+ name,+ NativeDataPropertyConfiguration::new(getter).setter(setter),+ )+ }++ #[inline(always)]+ pub fn set_native_data_property_with_configuration(+ &self,+ scope: &PinScope<'_, '_>,+ name: Local<Name>,+ configuration: NativeDataPropertyConfiguration,+ ) -> Option<bool> {+ unsafe {+ v8__Object__SetNativeDataProperty(+ self,+ &*scope.get_current_context(),+ &*name,+ configuration.getter,+ configuration.setter,+ configuration.data.map_or_else(null, |p| &*p),+ configuration.property_attribute,+ )+ }+ .into()+ }+/// Sets a lazy data property on this object. The getter is invoked the first/// time the property is read, and then the property is replaced with an/// ordinary data property containing the value returned by the getter.@@ -665,6 +727,28 @@ impl Object {.into()}+ #[inline(always)]+ pub fn set_lazy_data_property_with_configuration(+ &self,+ scope: &PinScope<'_, '_>,+ name: Local<Name>,+ configuration: LazyDataPropertyConfiguration,+ ) -> Option<bool> {+ unsafe {+ v8__Object__SetLazyDataProperty(+ self,+ &*scope.get_current_context(),+ &*name,+ configuration.getter,+ configuration.data.map_or_else(null, |p| &*p),+ configuration.property_attribute,+ configuration.getter_side_effect_type,+ configuration.setter_side_effect_type,+ )+ }+ .into()+ }+/// Returns the V8 hash value for this value. The current implementation/// uses a hidden property to store the identity hash.///diff --git a/vendor/v8-152.2.0/src/object_ext.cc b/vendor/v8-152.2.0/src/object_ext.ccnew file mode 100644index 000000000..2c80087aa--- /dev/null+++ b/vendor/v8-152.2.0/src/object_ext.cc@@ -0,0 +1,20 @@+// Copyright 2026 the Moli authors. MIT license.++#include "support.h"+#include "v8-object.h"++using namespace support;++extern "C" {++MaybeBool v8__Object__SetNativeDataProperty(+ const v8::Object& self, const v8::Context& context,+ const v8::Name& key, v8::AccessorNameGetterCallback getter,+ v8::AccessorNameSetterCallback setter, const v8::Value* data_or_null,+ v8::PropertyAttribute attr) {+ return maybe_to_maybe_bool(ptr_to_local(&self)->SetNativeDataProperty(+ ptr_to_local(&context), ptr_to_local(&key), getter, setter,+ ptr_to_local(data_or_null), attr));+}++} // extern "C"diff --git a/vendor/v8-152.2.0/src/object_template_ext.cc b/vendor/v8-152.2.0/src/object_template_ext.ccnew file mode 100644index 000000000..70d44417a--- /dev/null+++ b/vendor/v8-152.2.0/src/object_template_ext.cc@@ -0,0 +1,61 @@+// Copyright 2026 the Moli authors. MIT license.++#include "support.h"+#include "v8-template.h"++using namespace support;++extern "C" {++void v8__ObjectTemplate__MarkAsUndetectable(const v8::ObjectTemplate& self) {+ ptr_to_local(&self)->MarkAsUndetectable();+}++void v8__ObjectTemplate__SetCodeLike(const v8::ObjectTemplate& self) {+ ptr_to_local(&self)->SetCodeLike();+}++void v8__Template__SetLazyDataProperty(+ const v8::Template& self, const v8::Name& key,+ v8::AccessorNameGetterCallback getter, const v8::Value* data_or_null,+ v8::PropertyAttribute attr, v8::SideEffectType getter_side_effect_type,+ v8::SideEffectType setter_side_effect_type) {+ ptr_to_local(&self)->SetLazyDataProperty(+ ptr_to_local(&key), getter, ptr_to_local(data_or_null), attr,+ getter_side_effect_type, setter_side_effect_type);+}++void v8__ObjectTemplate__SetSecurityTokenAccessCheckAndHandlers(+ const v8::ObjectTemplate& self,+ v8::AccessCheckCallback access_check,+ v8::NamedPropertyGetterCallback named_getter,+ v8::NamedPropertySetterCallback named_setter,+ v8::NamedPropertyQueryCallback named_query,+ v8::NamedPropertyDeleterCallback named_deleter,+ v8::NamedPropertyEnumeratorCallback named_enumerator,+ v8::NamedPropertyDefinerCallback named_definer,+ v8::NamedPropertyDescriptorCallback named_descriptor,+ const v8::Value* named_data_or_null,+ v8::PropertyHandlerFlags named_flags,+ v8::IndexedPropertyGetterCallbackV2 indexed_getter,+ v8::IndexedPropertySetterCallbackV2 indexed_setter,+ v8::IndexedPropertyQueryCallbackV2 indexed_query,+ v8::IndexedPropertyDeleterCallbackV2 indexed_deleter,+ v8::IndexedPropertyEnumeratorCallback indexed_enumerator,+ v8::IndexedPropertyDefinerCallbackV2 indexed_definer,+ v8::IndexedPropertyDescriptorCallbackV2 indexed_descriptor,+ const v8::Value* indexed_data_or_null,+ v8::PropertyHandlerFlags indexed_flags) {+ ptr_to_local(&self)->SetAccessCheckCallbackAndHandler(+ access_check,+ v8::NamedPropertyHandlerConfiguration(+ named_getter, named_setter, named_query, named_deleter,+ named_enumerator, named_definer, named_descriptor,+ ptr_to_local(named_data_or_null), named_flags),+ v8::IndexedPropertyHandlerConfiguration(+ indexed_getter, indexed_setter, indexed_query, indexed_deleter,+ indexed_enumerator, indexed_definer, indexed_descriptor,+ ptr_to_local(indexed_data_or_null), indexed_flags));+}++} // extern "C"diff --git a/vendor/v8-152.2.0/src/template.rs b/vendor/v8-152.2.0/src/template.rsindex d35bbdde8..bb1c94f63 100644--- a/vendor/v8-152.2.0/src/template.rs+++ b/vendor/v8-152.2.0/src/template.rs@@ -51,6 +51,15 @@ unsafe extern "C" {intrinsic: Intrinsic,attr: PropertyAttribute,);+ fn v8__Template__SetLazyDataProperty(+ this: *const Template,+ key: *const Name,+ getter: AccessorNameGetterCallback,+ data_or_null: *const Value,+ attr: PropertyAttribute,+ getter_side_effect_type: SideEffectType,+ setter_side_effect_type: SideEffectType,+ );fn v8__Signature__New(isolate: *mut RealIsolate,@@ -94,6 +103,10 @@ unsafe extern "C" {);fn v8__FunctionTemplate__ReadOnlyPrototype(this: *const FunctionTemplate);fn v8__FunctionTemplate__RemovePrototype(this: *const FunctionTemplate);+ fn v8__FunctionTemplate__HasInstance(+ this: *const FunctionTemplate,+ value: *const Value,+ ) -> bool;fn v8__ObjectTemplate__New(isolate: *mut RealIsolate,@@ -159,6 +172,31 @@ unsafe extern "C" {callback: FunctionCallback,data_or_null: *const Value,);+ fn v8__ObjectTemplate__MarkAsUndetectable(this: *const ObjectTemplate);+ fn v8__ObjectTemplate__SetCodeLike(this: *const ObjectTemplate);+ #[allow(clippy::too_many_arguments)]+ fn v8__ObjectTemplate__SetSecurityTokenAccessCheckAndHandlers(+ this: *const ObjectTemplate,+ access_check: AccessCheckCallback,+ named_getter: Option<NamedPropertyGetterCallback>,+ named_setter: Option<NamedPropertySetterCallback>,+ named_query: Option<NamedPropertyQueryCallback>,+ named_deleter: Option<NamedPropertyDeleterCallback>,+ named_enumerator: Option<NamedPropertyEnumeratorCallback>,+ named_definer: Option<NamedPropertyDefinerCallback>,+ named_descriptor: Option<NamedPropertyDescriptorCallback>,+ named_data_or_null: *const Value,+ named_flags: PropertyHandlerFlags,+ indexed_getter: Option<IndexedPropertyGetterCallback>,+ indexed_setter: Option<IndexedPropertySetterCallback>,+ indexed_query: Option<IndexedPropertyQueryCallback>,+ indexed_deleter: Option<IndexedPropertyDeleterCallback>,+ indexed_enumerator: Option<IndexedPropertyEnumeratorCallback>,+ indexed_definer: Option<IndexedPropertyDefinerCallback>,+ indexed_descriptor: Option<IndexedPropertyDescriptorCallback>,+ indexed_data_or_null: *const Value,+ indexed_flags: PropertyHandlerFlags,+ );}pub type AccessorNameGetterCallback = NamedGetterCallbackForAccessor;@@ -166,6 +204,9 @@ pub type AccessorNameGetterCallback = NamedGetterCallbackForAccessor;/// Note: [ReturnValue] is ignored for accessors.pub type AccessorNameSetterCallback = NamedSetterCallbackForAccessor;+pub type AccessCheckCallback =+ unsafe extern "C" fn(Local<Context>, Local<Object>, Local<Value>) -> bool;+/// Interceptor for get requests on an object.////// Use [ReturnValue] to set the return value of the intercepted get request. If@@ -278,6 +319,58 @@ pub struct AccessorConfiguration<'s> {pub(crate) property_attribute: PropertyAttribute,}+/// Configuration for a callback-backed V8 native data property.+pub type NativeDataPropertyConfiguration<'s> = AccessorConfiguration<'s>;++pub struct LazyDataPropertyConfiguration<'s> {+ pub(crate) getter: AccessorNameGetterCallback,+ pub(crate) data: Option<Local<'s, Value>>,+ pub(crate) property_attribute: PropertyAttribute,+ pub(crate) getter_side_effect_type: SideEffectType,+ pub(crate) setter_side_effect_type: SideEffectType,+}++impl<'s> LazyDataPropertyConfiguration<'s> {+ pub fn new(getter: impl MapFnTo<AccessorNameGetterCallback>) -> Self {+ Self {+ getter: getter.map_fn_to(),+ data: None,+ property_attribute: PropertyAttribute::NONE,+ getter_side_effect_type: SideEffectType::HasSideEffect,+ setter_side_effect_type: SideEffectType::HasSideEffect,+ }+ }++ pub fn property_attribute(+ mut self,+ property_attribute: PropertyAttribute,+ ) -> Self {+ self.property_attribute = property_attribute;+ self+ }++ pub fn data(mut self, data: Local<'s, Value>) -> Self {+ self.data = Some(data);+ self+ }++ pub fn getter_side_effect_type(+ mut self,+ side_effect_type: SideEffectType,+ ) -> Self {+ self.getter_side_effect_type = side_effect_type;+ self+ }++ pub fn setter_side_effect_type(+ mut self,+ side_effect_type: SideEffectType,+ ) -> Self {+ self.setter_side_effect_type = side_effect_type;+ self+ }+}+impl<'s> AccessorConfiguration<'s> {pub fn new(getter: impl MapFnTo<AccessorNameGetterCallback>) -> Self {Self {@@ -650,6 +743,38 @@ impl Template {unsafe { v8__Template__Set(self, &*key, &*value, attr) }}+ /// Adds a data-like property whose value is produced on first read.+ #[inline(always)]+ pub fn set_lazy_data_property(+ &self,+ key: Local<Name>,+ getter: impl MapFnTo<AccessorNameGetterCallback>,+ ) {+ self.set_lazy_data_property_with_configuration(+ key,+ LazyDataPropertyConfiguration::new(getter),+ );+ }++ #[inline(always)]+ pub fn set_lazy_data_property_with_configuration(+ &self,+ key: Local<Name>,+ configuration: LazyDataPropertyConfiguration,+ ) {+ unsafe {+ v8__Template__SetLazyDataProperty(+ self,+ &*key,+ configuration.getter,+ configuration.data.map_or_else(null, |p| &*p),+ configuration.property_attribute,+ configuration.getter_side_effect_type,+ configuration.setter_side_effect_type,+ );+ }+ }+/// During template instantiation, sets the value with the/// intrinsic property from the correct context.#[inline(always)]@@ -767,6 +892,13 @@ impl Signature {}impl FunctionTemplate {+ /// Returns true if `value` was created from this function template or from+ /// a function template that inherits from it.+ #[inline(always)]+ pub fn has_instance(&self, value: Local<Value>) -> bool {+ unsafe { v8__FunctionTemplate__HasInstance(self, &*value) }+ }+/// Create a FunctionBuilder to configure a FunctionTemplate./// This is the same as FunctionBuilder::<FunctionTemplate>::new().#[inline(always)]@@ -995,6 +1127,34 @@ impl ObjectTemplate {}}+ #[inline(always)]+ pub fn set_native_data_property(+ &self,+ key: Local<Name>,+ getter: impl MapFnTo<AccessorNameGetterCallback>,+ ) {+ self.set_accessor(key, getter);+ }++ #[inline(always)]+ pub fn set_native_data_property_with_setter(+ &self,+ key: Local<Name>,+ getter: impl MapFnTo<AccessorNameGetterCallback>,+ setter: impl MapFnTo<AccessorNameSetterCallback>,+ ) {+ self.set_accessor_with_setter(key, getter, setter);+ }++ #[inline(always)]+ pub fn set_native_data_property_with_configuration(+ &self,+ key: Local<Name>,+ configuration: NativeDataPropertyConfiguration,+ ) {+ self.set_accessor_with_configuration(key, configuration);+ }+//Re uses the AccessorNameGetterCallback to avoid implementation conflicts since the declaration for//GenericNamedPropertyGetterCallback and AccessorNameGetterCallback are the samepub fn set_named_property_handler(@@ -1071,6 +1231,18 @@ impl ObjectTemplate {unsafe { v8__ObjectTemplate__SetImmutableProto(self) };}+ /// Marks object instances created from this template as undetectable.+ #[inline(always)]+ pub fn mark_as_undetectable(&self) {+ unsafe { v8__ObjectTemplate__MarkAsUndetectable(self) };+ }++ /// Marks instances as code-like for string-code-generation policy checks.+ #[inline(always)]+ pub fn set_code_like(&self) {+ unsafe { v8__ObjectTemplate__SetCodeLike(self) };+ }+/// Sets the callback to be used when calling instances created from this/// template as a function.///@@ -1090,4 +1262,49 @@ impl ObjectTemplate {);}}++ /// Sets the callback and optional associated data used when instances are+ /// called as functions.+ #[inline(always)]+ pub fn set_call_as_function_handler_with_data(+ &self,+ callback: impl MapFnTo<FunctionCallback>,+ data: Option<Local<'_, Value>>,+ ) {+ self.set_call_as_function_handler(callback, data);+ }++ /// Enables embedder-defined access checks and denied-access handlers.+ pub fn set_security_token_access_check_and_handlers(+ &self,+ access_check: AccessCheckCallback,+ named: NamedPropertyHandlerConfiguration,+ indexed: IndexedPropertyHandlerConfiguration,+ ) {+ assert!(named.is_some() || indexed.is_some());+ unsafe {+ v8__ObjectTemplate__SetSecurityTokenAccessCheckAndHandlers(+ self,+ access_check,+ named.getter,+ named.setter,+ named.query,+ named.deleter,+ named.enumerator,+ named.definer,+ named.descriptor,+ named.data.map_or_else(null, |p| &*p),+ named.flags,+ indexed.getter,+ indexed.setter,+ indexed.query,+ indexed.deleter,+ indexed.enumerator,+ indexed.definer,+ indexed.descriptor,+ indexed.data.map_or_else(null, |p| &*p),+ indexed.flags,+ );+ }+ }}