Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust
Rust ai-agentsai-toolsbrowserbrowser-automationcloud-browserheadlessheadless-browserkitesurfplaywrightpuppeteerrustservoweb-crawlerweb-crawlingweb-scraperweb-scraping
feat(webgl): expose resource and value interfaces
ldm07a93a3b6147b
diff --git a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rsindex 769f2e0a3..9f70246b8 100644--- a/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs+++ b/moli-renderer-v8/src/context_bootstrap/assets/constructor_templates.rs@@ -108,6 +108,9 @@ pub(in crate::context_bootstrap) fn build_constructor_template<'s>(build_value_event_template(scope, ValueEventKind::Transition)}ConstructorKind::BlobEvent => build_value_event_template(scope, ValueEventKind::Blob),+ ConstructorKind::WebGLContextEvent => {+ build_value_event_template(scope, ValueEventKind::WebGlContext)+ }ConstructorKind::UiEvent => {build_event_subclass_template(scope, EventSubclassKind::UiEvent)}diff --git a/moli-renderer-v8/src/context_bootstrap/canvas.rs b/moli-renderer-v8/src/context_bootstrap/canvas.rsindex 49185bd56..2105e5520 100644--- a/moli-renderer-v8/src/context_bootstrap/canvas.rs+++ b/moli-renderer-v8/src/context_bootstrap/canvas.rs@@ -271,6 +271,7 @@ pub(super) fn install_canvas_template_bindings<'s>(template: v8::Local<'s, v8::FunctionTemplate>,interface_name: &str,) {+ webgl::install_value_template_bindings(scope, template, interface_name);match interface_name {"HTMLCanvasElement" => {let prototype = template.prototype_template(scope);diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs b/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rsindex ae5afed9b..10a70d222 100644--- a/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs+++ b/moli-renderer-v8/src/context_bootstrap/canvas/webgl.rs@@ -1,3 +1,4 @@+mod interfaces;use super::objects::{build_webgl_debug_renderer_info_object, build_webgl_lose_context_object};use super::*;use crate::web_api_interfaces;@@ -5,6 +6,7 @@ use crate::{util::{callback_data_item, get_private_value, set_private_value, v8_string, v8str},webidl,};+pub(super) use interfaces::install_value_template_bindings;use moli_webapi_declare::{WebApiObject, WebApiValue};const WEBGL_VIEWPORT_SLOT: &str = "__moliWebGlViewport";@@ -776,37 +778,30 @@ pub(crate) fn webgl_get_shader_precision_format_callback(_args: v8::FunctionCallbackArguments<'_>,mut rv: v8::ReturnValue<'_, v8::Value>,) {- let value = WebGlShaderPrecisionFormat::default()+ let prototype = crate::context_bootstrap::ensure_intrinsic_interface_prototype(+ scope,+ "WebGLShaderPrecisionFormat",+ )+ .expect("WebGLShaderPrecisionFormat intrinsic prototype should be available");+ let value = WebGlShaderPrecisionFormat::new(prototype, 23, 127, 127).bind(scope).expect("WebGL shader precision format declaration should bind");rv.set(value.into());}#[derive(WebApiObject)]-#[webapi(- interface = web_api_interfaces::WebGLShaderPrecisionFormat,- prototype = "Object",- data_properties,- enumerable-)]-struct WebGlShaderPrecisionFormat {+#[webapi(interface = web_api_interfaces::WebGLShaderPrecisionFormat)]+struct WebGlShaderPrecisionFormat<'s> {+ #[webapi(prototype)]+ prototype: v8::Local<'s, v8::Object>,+ #[webapi(slot = interfaces::PRECISION)]precision: i32,- #[webapi(data_property = "rangeMin")]+ #[webapi(slot = interfaces::RANGE_MIN)]range_min: i32,- #[webapi(data_property = "rangeMax")]+ #[webapi(slot = interfaces::RANGE_MAX)]range_max: i32,}-impl Default for WebGlShaderPrecisionFormat {- fn default() -> Self {- Self {- precision: 23,- range_min: 127,- range_max: 127,- }- }-}-pub(crate) fn webgl_lose_context_noop_callback(_scope: &mut v8::PinScope<'_, '_>,_args: v8::FunctionCallbackArguments<'_>,diff --git a/moli-renderer-v8/src/context_bootstrap/canvas/webgl/interfaces.rs b/moli-renderer-v8/src/context_bootstrap/canvas/webgl/interfaces.rsnew file mode 100644index 000000000..e091f2a94--- /dev/null+++ b/moli-renderer-v8/src/context_bootstrap/canvas/webgl/interfaces.rs@@ -0,0 +1,60 @@+//! Shared value interfaces. Resource allocation and shader reflection remain+//! owned by the WebGL backend; exposing their types does not create GPU objects.++use super::*;+use moli_webapi_declare::WebApiFunctionTemplate;++pub(super) const PRECISION: &str = "__moliWebGlPrecision";+pub(super) const RANGE_MIN: &str = "__moliWebGlRangeMin";+pub(super) const RANGE_MAX: &str = "__moliWebGlRangeMax";+const ACTIVE_SIZE: &str = "__moliWebGlActiveSize";+const ACTIVE_TYPE: &str = "__moliWebGlActiveType";+const ACTIVE_NAME: &str = "__moliWebGlActiveName";++#[derive(WebApiFunctionTemplate)]+#[webapi(interface = web_api_interfaces::WebGLShaderPrecisionFormat, enumerable, receiver)]+struct PrecisionAttributes {+ #[webapi(accessor_property, getter = slot_getter, data = v8str(scope, PRECISION))]+ precision: (),+ #[webapi(accessor_property, getter = slot_getter, data = v8str(scope, RANGE_MIN))]+ range_min: (),+ #[webapi(accessor_property, getter = slot_getter, data = v8str(scope, RANGE_MAX))]+ range_max: (),+}++#[derive(WebApiFunctionTemplate)]+#[webapi(interface = web_api_interfaces::WebGLActiveInfo, enumerable, receiver)]+struct ActiveInfoAttributes {+ #[webapi(accessor_property, getter = slot_getter, data = v8str(scope, ACTIVE_SIZE))]+ size: (),+ #[webapi(accessor_property = "type", getter = slot_getter, data = v8str(scope, ACTIVE_TYPE))]+ type_: (),+ #[webapi(accessor_property, getter = slot_getter, data = v8str(scope, ACTIVE_NAME))]+ name: (),+}++pub(in crate::context_bootstrap::canvas) fn install_value_template_bindings<'s>(+ scope: &mut v8::PinScope<'s, '_, ()>,+ template: v8::Local<'s, v8::FunctionTemplate>,+ name: &str,+) {+ let prototype = template.prototype_template(scope);+ match name {+ "WebGLShaderPrecisionFormat" => {+ PrecisionAttributes::initialize_prototype_template(scope, prototype)+ }+ "WebGLActiveInfo" => ActiveInfoAttributes::initialize_prototype_template(scope, prototype),+ _ => {}+ }+}++fn slot_getter<'s>(+ scope: &mut v8::PinScope<'s, '_>,+ args: v8::FunctionCallbackArguments<'s>,+ mut rv: v8::ReturnValue<'s, v8::Value>,+) {+ let slot = args.data().to_rust_string_lossy(scope);+ if let Some(value) = get_private_value(scope, args.this(), &slot) {+ rv.set(value);+ }+}diff --git a/moli-renderer-v8/src/context_bootstrap/events/value.rs b/moli-renderer-v8/src/context_bootstrap/events/value.rsindex 3651681dd..9ed9ad7cb 100644--- a/moli-renderer-v8/src/context_bootstrap/events/value.rs+++ b/moli-renderer-v8/src/context_bootstrap/events/value.rs@@ -14,6 +14,7 @@ const NAME_SLOT: &str = "__moliValueEventName";const ELAPSED_TIME_SLOT: &str = "__moliValueEventElapsedTime";const PSEUDO_ELEMENT_SLOT: &str = "__moliValueEventPseudoElement";const BLOB_SLOT: &str = "__moliValueEventBlob";+const STATUS_MESSAGE_SLOT: &str = "__moliWebGlContextEventStatusMessage";const TIMECODE_SLOT: &str = "__moliValueEventTimecode";#[derive(Clone, Copy)]@@ -21,6 +22,7 @@ pub(in crate::context_bootstrap) enum ValueEventKind {Animation,Transition,Blob,+ WebGlContext,}impl ValueEventKind {@@ -29,6 +31,7 @@ impl ValueEventKind {Self::Animation => "AnimationEvent",Self::Transition => "TransitionEvent",Self::Blob => "BlobEvent",+ Self::WebGlContext => "WebGLContextEvent",}}@@ -71,6 +74,26 @@ struct BlobEventPrototypeDeclaration {timecode: (),}+#[derive(WebApiFunctionTemplate)]+#[webapi(interface = web_api_interfaces::WebGLContextEvent, enumerable, receiver)]+struct WebGlContextEventPrototypeDeclaration {+ #[webapi(accessor_property, getter = payload_getter, data = v8str(scope, STATUS_MESSAGE_SLOT))]+ status_message: (),+}++#[derive(webidl::WebIdlDictionary)]+#[webidl(prefix = "WebGLContextEventInit")]+struct WebGlContextEventInit<'s> {+ #[webidl(default = false)]+ bubbles: bool,+ #[webidl(default = false)]+ cancelable: bool,+ #[webidl(default = false)]+ composed: bool,+ #[webidl(with = string_member)]+ status_message: v8::Local<'s, v8::String>,+}+// Inherited dictionary members precede derived members, whose declaration order// follows Web IDL's lexicographic conversion order. Preserve DOMString code units.#[derive(webidl::WebIdlDictionary)]@@ -167,6 +190,9 @@ pub(in crate::context_bootstrap) fn install_value_event_template_bindings<'s>("TransitionEvent" => {TransitionEventPrototypeDeclaration::initialize_prototype_template(scope, prototype)}+ "WebGLContextEvent" => {+ WebGlContextEventPrototypeDeclaration::initialize_prototype_template(scope, prototype)+ }"BlobEvent" => {BlobEventPrototypeDeclaration::initialize_prototype_template(scope, prototype)}@@ -204,6 +230,7 @@ fn value_event_constructor<'s>(Some(0) => ValueEventKind::Animation,Some(1) => ValueEventKind::Transition,Some(2) => ValueEventKind::Blob,+ Some(3) => ValueEventKind::WebGlContext,_ => return,};if !args.is_construct_call() {@@ -262,6 +289,17 @@ fn value_event_constructor<'s>();(parsed.bubbles, parsed.cancelable, parsed.composed)}+ ValueEventKind::WebGlContext => {+ let parsed =+ webidl::parse_dictionary_object::<WebGlContextEventInit>(scope, dictionary)?;+ set_event_private_value(+ scope,+ state,+ STATUS_MESSAGE_SLOT,+ parsed.status_message.into(),+ );+ (parsed.bubbles, parsed.cancelable, parsed.composed)+ }ValueEventKind::Blob => {let parsed = webidl::parse_dictionary_object::<BlobEventInit>(scope, dictionary)?;set_event_private_value(scope, state, BLOB_SLOT, parsed.data.into());diff --git a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rsindex ab7550454..04d03862c 100644--- a/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs+++ b/moli-renderer-v8/src/context_bootstrap/exposed_interfaces/metadata.rs@@ -67,6 +67,15 @@ pub(in crate::context_bootstrap) const WORKER_SHARED_INTERFACE_NAMES: &[&str] ="WebGLRenderbuffer","WebGLShader","WebGLUniformLocation",+ "WebGLTexture",+ "WebGLQuery",+ "WebGLSampler",+ "WebGLSync",+ "WebGLTransformFeedback",+ "WebGLVertexArrayObject",+ "WebGLActiveInfo",+ "WebGLShaderPrecisionFormat",+ "WebGLContextEvent","Path2D","Blob","File",diff --git a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs b/moli-renderer-v8/src/context_bootstrap/specs/registry.rsindex dc6b4c773..8071682df 100644--- a/moli-renderer-v8/src/context_bootstrap/specs/registry.rs+++ b/moli-renderer-v8/src/context_bootstrap/specs/registry.rs@@ -959,6 +959,42 @@ const CONSTRUCTOR_SPECS_AFTER_STREAMS: &[ConstructorSpec] = &[interface: web_api_interfaces::WebGLShader::DESCRIPTOR,kind: ConstructorKind::Illegal,},+ ConstructorSpec {+ interface: web_api_interfaces::WebGLTexture::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLQuery::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLSampler::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLSync::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLTransformFeedback::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLVertexArrayObject::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLActiveInfo::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLShaderPrecisionFormat::DESCRIPTOR,+ kind: ConstructorKind::Illegal,+ },+ ConstructorSpec {+ interface: web_api_interfaces::WebGLContextEvent::DESCRIPTOR,+ kind: ConstructorKind::WebGLContextEvent,+ },ConstructorSpec {interface: web_api_interfaces::WebGLUniformLocation::DESCRIPTOR,kind: ConstructorKind::Illegal,diff --git a/moli-renderer-v8/src/context_bootstrap/specs/types.rs b/moli-renderer-v8/src/context_bootstrap/specs/types.rsindex 93a222a1e..b9500696d 100644--- a/moli-renderer-v8/src/context_bootstrap/specs/types.rs+++ b/moli-renderer-v8/src/context_bootstrap/specs/types.rs@@ -6,6 +6,7 @@ pub(in crate::context_bootstrap) enum ConstructorKind {AnimationEvent,TransitionEvent,BlobEvent,+ WebGLContextEvent,UiEvent,FocusEvent,CompositionEvent,diff --git a/moli-renderer-v8/src/script_vm/tests/mod.rs b/moli-renderer-v8/src/script_vm/tests/mod.rsindex b42ff5072..f6bf3664b 100644--- a/moli-renderer-v8/src/script_vm/tests/mod.rs+++ b/moli-renderer-v8/src/script_vm/tests/mod.rs@@ -2148,6 +2148,7 @@ mod rendering_update;mod script_terminal_completion;mod streams;mod url_components;+mod webgl_interfaces;mod webidl_collections;mod webidl_fetch;mod webidl_receivers;diff --git a/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.js b/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.jsnew file mode 100644index 000000000..53e81ff6c--- /dev/null+++ b/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.js@@ -0,0 +1,91 @@+(async () => {+ const rows = [], assert = (ok, message) => { if (!ok) throw Error(message); };+ const check = async (name, run) => { try { await run(); rows.push({ name, pass: true }); } catch (error) { rows.push({ name, pass: false, message: String(error) }); } };+ const inWindow = typeof window !== 'undefined';+ const realms = inWindow ? [['main', window], ['child', document.getElementById('child').contentWindow]] : [['worker', self]];+ const resources = ['WebGLTexture', 'WebGLQuery', 'WebGLSampler', 'WebGLSync', 'WebGLTransformFeedback', 'WebGLVertexArrayObject'];+ const attributes = { WebGLActiveInfo: ['size', 'type', 'name'], WebGLShaderPrecisionFormat: ['rangeMin', 'rangeMax', 'precision'], WebGLContextEvent: ['statusMessage'] };+ const names = [...resources, ...Object.keys(attributes)];+ for (const [label, w] of realms) {+ for (const name of names) {+ await check(label + '/' + name + '/constructor', () => {+ const C = w[name], parent = resources.includes(name) ? w.WebGLObject : name === 'WebGLContextEvent' ? w.Event : w.Object;+ const d = Object.getOwnPropertyDescriptor(w, name);+ assert(typeof C === 'function' && C.name === name && C.length === (name === 'WebGLContextEvent' ? 1 : 0), 'constructor metadata');+ assert(d.writable && d.configurable && !d.enumerable, 'global descriptor');+ assert(Object.getPrototypeOf(C.prototype) === parent.prototype && Object.getPrototypeOf(C) === (parent === w.Object ? w.Function.prototype : parent), 'native inheritance');+ assert(C.prototype.constructor === C, 'prototype constructor');+ const tag = Object.getOwnPropertyDescriptor(C.prototype, Symbol.toStringTag);+ assert(tag.value === name && tag.configurable && !tag.writable && !tag.enumerable, 'prototype tag');+ for (const call of [() => C(), () => new C()]) {+ let error; try { call(); } catch (e) { error = e; }+ assert(error instanceof w.TypeError, 'constructor restrictions and error realm');+ }+ });+ for (const attribute of attributes[name] || []) {+ await check(label + '/' + name + '/' + attribute, () => {+ const C = w[name], d = Object.getOwnPropertyDescriptor(C.prototype, attribute);+ assert(d.get.length === 0 && d.set === undefined && d.enumerable && d.configurable, 'readonly shared getter');+ let traps = 0; const trap = () => { traps++; throw Error('author trap'); };+ const revoked = Proxy.revocable({}, {}); revoked.revoke();+ for (const receiver of [{}, C.prototype, Object.create(C.prototype), new Proxy({}, { get: trap, getPrototypeOf: trap }), revoked.proxy]) {+ let error; try { d.get.call(receiver); } catch (e) { error = e; }+ assert(error instanceof w.TypeError, 'native brand required');+ }+ assert(traps === 0, 'brand check does not invoke Proxy traps');+ });+ }+ }+ await check(label + '/event-payload', () => {+ const C = w.WebGLContextEvent, d = Object.getOwnPropertyDescriptor(C.prototype, 'statusMessage');+ const defaultEvent = new C('webglcontextlost');+ assert(defaultEvent instanceof w.Event && defaultEvent.statusMessage === '' && !defaultEvent.isTrusted, 'default event state');+ const order = [], value = '\ud800\0state\udfff';+ const event = new C({ toString() { order.push('type'); return 'loss'; } }, {+ get bubbles() { order.push('bubbles'); return true; },+ get cancelable() { order.push('cancelable'); return true; },+ get composed() { order.push('composed'); return true; },+ get statusMessage() { order.push('statusMessage'); return { toString() { order.push('string'); return value; } }; }+ });+ assert(order.join() === 'type,bubbles,cancelable,composed,statusMessage,string', 'EventInit conversion order');+ assert(event.statusMessage === value && event.bubbles && event.cancelable && event.composed, 'payload preserves DOMString code units');+ assert(!Object.hasOwn(event, 'statusMessage'), 'prototype payload');+ const target = new w.EventTarget(); let calls = 0;+ target.addEventListener('loss', e => { assert(e === event && e.target === target && e.statusMessage === value, 'native dispatch state'); calls++; e.preventDefault(); });+ assert(target.dispatchEvent(event) === false && calls === 1, 'Event cancellation');+ Object.setPrototypeOf(event, null);+ assert(d.get.call(event) === value, 'brand independent of author prototype');+ const sentinel = {}; let error;+ try { new C('loss', { get statusMessage() { throw sentinel; } }); } catch (e) { error = e; }+ assert(error === sentinel, 'getter exception preserved');+ assert(new C('loss', { statusMessage: null }).statusMessage === 'null', 'DOMString null conversion');+ class Derived extends C {}+ const derived = new Derived('loss', { statusMessage: 'subclass' });+ assert(derived instanceof Derived && derived instanceof C && derived.statusMessage === 'subclass', 'subclass identity');+ });+ await check(label + '/precision-native-factory', () => {+ const gl = new w.OffscreenCanvas(1, 1).getContext('webgl');+ assert(gl, 'WebGL context available');+ const C = w.WebGLShaderPrecisionFormat, globalDescriptor = Object.getOwnPropertyDescriptor(w, 'WebGLShaderPrecisionFormat');+ let reads = 0, value;+ Object.defineProperty(w, 'WebGLShaderPrecisionFormat', { configurable: true, get() { reads++; throw Error('author constructor'); } });+ try { value = gl.getShaderPrecisionFormat(gl.VERTEX_SHADER, gl.HIGH_FLOAT); }+ finally { if (globalDescriptor) Object.defineProperty(w, 'WebGLShaderPrecisionFormat', globalDescriptor); else delete w.WebGLShaderPrecisionFormat; }+ assert(reads === 0 && Object.getPrototypeOf(value) === C.prototype, 'intrinsic value prototype');+ for (const key of ['precision', 'rangeMin', 'rangeMax']) {+ const d = Object.getOwnPropertyDescriptor(C.prototype, key), number = value[key];+ assert(!Object.hasOwn(value, key) && Number.isInteger(number) && number >= 0, 'readonly numeric value');+ assert(d.get.call(value) === number, 'genuine receiver');+ for (const receiver of [Object.create(value), new Proxy(value, {})]) {+ let error; try { d.get.call(receiver); } catch (e) { error = e; }+ assert(error instanceof w.TypeError, 'forged receiver rejected');+ }+ }+ const getter = Object.getOwnPropertyDescriptor(C.prototype, 'precision').get, precision = value.precision;+ Object.setPrototypeOf(value, null);+ assert(getter.call(value) === precision, 'native state survives author prototype change');+ });+ }+ globalThis.__nodeReplacementResults = { rows, failures: rows.filter(row => !row.pass), passed: rows.filter(row => row.pass).length, total: rows.length };+ return rows.every(row => row.pass);+})()diff --git a/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.rs b/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.rsnew file mode 100644index 000000000..f11bedec1--- /dev/null+++ b/moli-renderer-v8/src/script_vm/tests/webgl_interfaces.rs@@ -0,0 +1,24 @@+use super::*;++#[test]+fn webgl_interfaces_preserve_native_inheritance_values_and_event_state() {+ for url in [+ "https://webgl-interfaces.test/",+ "http://webgl-interfaces.test/",+ ] {+ let mut vm = new_storage_page_task_executor_test_vm(url);+ vm.eval("document.body.innerHTML = '<iframe id=child></iframe>'")+ .unwrap();+ vm.eval(&format!(+ "({}).then(value => globalThis.__webGlInterfacesDone = value, error => globalThis.__webGlInterfacesDone = String(error));",+ include_str!("webgl_interfaces.js")+ )).unwrap();+ assert_eq!(+ vm.eval_after_selected_page_tasks("JSON.stringify(__nodeReplacementResults.failures)")+ .unwrap(),+ "[]",+ "{url}"+ );+ assert_eq!(vm.eval("__webGlInterfacesDone").unwrap(), "true", "{url}");+ }+}diff --git a/moli-renderer-v8/src/web_api_interfaces.rs b/moli-renderer-v8/src/web_api_interfaces.rsindex 6b2aab071..525577f6a 100644--- a/moli-renderer-v8/src/web_api_interfaces.rs+++ b/moli-renderer-v8/src/web_api_interfaces.rs@@ -496,6 +496,14 @@ interfaces! {WebGLRenderingContext;WebGLShader: WebGLObject;WebGLShaderPrecisionFormat;+ WebGLActiveInfo;+ WebGLContextEvent: Event;+ WebGLTexture: WebGLObject;+ WebGLQuery: WebGLObject;+ WebGLSampler: WebGLObject;+ WebGLSync: WebGLObject;+ WebGLTransformFeedback: WebGLObject;+ WebGLVertexArrayObject: WebGLObject;WebGLUniformLocation;WebSocket: EventTarget;WebSocketError: DOMException;diff --git a/moli-renderer-v8/src/worker/thread/tests/postmessage.rs b/moli-renderer-v8/src/worker/thread/tests/postmessage.rsindex a1f387949..6220e689e 100644--- a/moli-renderer-v8/src/worker/thread/tests/postmessage.rs+++ b/moli-renderer-v8/src/worker/thread/tests/postmessage.rs@@ -2060,6 +2060,24 @@ async fn worker_performance_now_uses_readonly_monotonic_time_origin() {);}+#[tokio::test]+async fn worker_webgl_interfaces_share_native_value_and_event_bindings() {+ ensure_v8();+ let source = format!(+ "({}).then(passed => {{ postMessage({{ passed, failures: __nodeReplacementResults.failures }}); close(); }}, error => {{ postMessage({{ passed: false, failures: [String(error)] }}); close(); }});",+ include_str!("../../../script_vm/tests/webgl_interfaces.js")+ );+ let mut handle = spawn_worker(source, "test://worker-webgl-interfaces".into());+ let message = timeout(TIMEOUT, handle.recv())+ .await+ .expect("timed out")+ .expect("channel closed");+ assert_eq!(+ expect_post_json(message),+ r#"{"passed":true,"failures":[]}"#+ );+}+#[tokio::test]async fn worker_offscreen_canvas_exposes_webgl_identity_consistently() {ensure_v8();