Skip to content

Truly independent web browser

LibWeb: Remove WebXR

Shannon Booth78934466440e
diff --git a/Libraries/LibWeb/Bindings/Rust/src/web_gl/canvas.rs b/Libraries/LibWeb/Bindings/Rust/src/web_gl/canvas.rs
index 9d8952950ae..483f43a9b98 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/web_gl/canvas.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/web_gl/canvas.rs
@@ -17,7 +17,6 @@ use libjs_rust::api::{Gc, Object, Realm};
use super::host::Frame;
use super::pixel_unpacking::PixelUnpackState;
use crate::bindings::conversions::CppInterface;
-use crate::bindings::promise::{WebIdlPromise, promise_from_abi};
/// The sources of texture images that are implemented in C++, in the order of the C++ enum of the same name.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
@@ -70,7 +69,6 @@ unsafe extern "C" {
r#type: u32,
out_frame: *mut *mut c_void,
) -> u8;
- fn web_webgl_make_xr_compatible(context: *mut c_void) -> *mut c_void;
}
#[derive(Clone, Copy)]
@@ -196,13 +194,3 @@ fn tex_image_source_frame(result: u8, frame: *mut c_void) -> TexImageSourceFrame
unknown_result => unreachable!("LibWeb returned {unknown_result} for the reading of a texture image source"),
}
}
-
-/// LibWeb's C++ code settles the promise.
-///
-/// # Safety
-///
-/// `context` is the cell of a WebGL context.
-pub(crate) unsafe fn make_xr_compatible(context: *mut c_void) -> WebIdlPromise {
- // SAFETY: The caller passes the cell of a context, and LibWeb returns a live promise.
- unsafe { promise_from_abi(web_webgl_make_xr_compatible(context)) }
-}
diff --git a/Libraries/LibWeb/Bindings/Rust/src/web_gl/exports.rs b/Libraries/LibWeb/Bindings/Rust/src/web_gl/exports.rs
index 986d0440069..06f7b91945e 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/web_gl/exports.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/web_gl/exports.rs
@@ -42,7 +42,6 @@ pub struct ContextAttributes {
power_preference: u8,
fail_if_major_performance_caveat: bool,
desynchronized: bool,
- xr_compatible: bool,
}
impl From<ContextAttributes> for WebGLContextAttributes {
@@ -62,7 +61,6 @@ impl From<ContextAttributes> for WebGLContextAttributes {
},
fail_if_major_performance_caveat: attributes.fail_if_major_performance_caveat,
desynchronized: attributes.desynchronized,
- xr_compatible: attributes.xr_compatible,
}
}
}
@@ -83,7 +81,6 @@ impl From<WebGLContextAttributes> for ContextAttributes {
},
fail_if_major_performance_caveat: attributes.fail_if_major_performance_caveat,
desynchronized: attributes.desynchronized,
- xr_compatible: attributes.xr_compatible,
}
}
}
@@ -181,11 +178,6 @@ pub extern "C" fn web_webgl_context_canvas_host(context: &ContextCell) -> *mut c
with_context(context, |context| context.canvas().host.as_ptr())
}
-#[unsafe(no_mangle)]
-pub extern "C" fn web_webgl_context_realm(context: &ContextCell) -> *mut c_void {
- with_context(context, |context| context.realm().as_ptr().cast())
-}
-
#[unsafe(no_mangle)]
pub extern "C" fn web_webgl_context_is_webgl2(context: &ContextCell) -> bool {
with_context(context, ContextState::is_webgl2)
@@ -287,13 +279,3 @@ pub unsafe extern "C" fn web_webgl_context_restore(
context.restore(transport, supported_opengl_extensions);
});
}
-
-#[unsafe(no_mangle)]
-pub extern "C" fn web_webgl_context_xr_compatible(context: &ContextCell) -> bool {
- with_context(context, ContextState::xr_compatible)
-}
-
-#[unsafe(no_mangle)]
-pub extern "C" fn web_webgl_context_set_xr_compatible(context: &ContextCell, xr_compatible: bool) {
- with_context(context, |context| context.set_xr_compatible(xr_compatible));
-}
diff --git a/Libraries/LibWeb/Bindings/Rust/src/web_gl/state.rs b/Libraries/LibWeb/Bindings/Rust/src/web_gl/state.rs
index ac932e9fd31..7563043cca1 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/web_gl/state.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/web_gl/state.rs
@@ -8,7 +8,6 @@
//! what.
use core::cell::{Cell, RefCell};
-use core::ffi::c_void;
use core::marker::PhantomData;
use core::ops::Deref;
@@ -39,7 +38,7 @@ use super::web_gl_transform_feedback::WebGLTransformFeedback;
use super::web_gl_uniform_location::WebGLUniformLocation;
use super::web_gl_vertex_array_object::WebGLVertexArrayObject;
use super::web_gl_vertex_array_object_oes::WebGLVertexArrayObjectOES;
-use crate::bindings::interface::{Inherits, Interface, Ref, Wrappable, cell_into_abi};
+use crate::bindings::interface::{Inherits, Interface, Ref, Wrappable};
use crate::bindings::{Exception, WebIdlResult};
use crate::canvas_2d::canvas::CanvasImageSourceKind;
@@ -109,13 +108,6 @@ impl ContextRef {
Self::WebGL2(context) => &context.state,
}
}
-
- pub(crate) fn cell(&self) -> *mut c_void {
- match *self {
- Self::WebGL1(context) => cell_into_abi(context),
- Self::WebGL2(context) => cell_into_abi(context),
- }
- }
}
#[derive(Clone, Copy, Trace)]
@@ -156,9 +148,6 @@ pub(crate) struct ContextState {
context_lost: Cell<bool>,
#[gc(untraced)]
context_restore_requested: Cell<bool>,
- /// https://immersive-web.github.io/webxr/#xr-compatible
- #[gc(untraced)]
- xr_compatible: Cell<bool>,
#[gc(untraced)]
context_generation: Cell<u64>,
@@ -227,7 +216,6 @@ impl ContextState {
error: Cell::new(GL_NO_ERROR),
context_lost: Cell::new(false),
context_restore_requested: Cell::new(false),
- xr_compatible: Cell::new(false),
context_generation: Cell::new(0),
unpack_state: Cell::new(PixelUnpackState::default()),
unpack_flip_y: Cell::new(false),
@@ -293,14 +281,6 @@ impl ContextState {
self.context_lost.get()
}
- pub(crate) fn xr_compatible(&self) -> bool {
- self.xr_compatible.get()
- }
-
- pub(crate) fn set_xr_compatible(&self, xr_compatible: bool) {
- self.xr_compatible.set(xr_compatible);
- }
-
/// Makes `error` the error of the context, unless it has one already.
// TODO: The specification of glGetError allows for a queue of errors, which this could keep.
pub(crate) fn set_error(&self, error: u32) {
diff --git a/Libraries/LibWeb/Bindings/Rust/src/web_gl/web_gl_rendering_context_base.rs b/Libraries/LibWeb/Bindings/Rust/src/web_gl/web_gl_rendering_context_base.rs
index 3548f590dab..7add76eed73 100644
--- a/Libraries/LibWeb/Bindings/Rust/src/web_gl/web_gl_rendering_context_base.rs
+++ b/Libraries/LibWeb/Bindings/Rust/src/web_gl/web_gl_rendering_context_base.rs
@@ -41,7 +41,6 @@ use super::web_gl_texture::WebGLTexture;
use super::web_gl_uniform_location::WebGLUniformLocation;
use crate::bindings::conversions::CppInterface;
use crate::bindings::interface::Ref;
-use crate::bindings::promise::WebIdlPromise;
use crate::bindings::{CallContext, WebIdlResult};
/// https://www.khronos.org/registry/webgl/specs/latest/1.0/#WEBGLCONTEXTATTRIBUTES
@@ -56,8 +55,6 @@ pub(crate) struct WebGLContextAttributes {
pub(crate) power_preference: WebGLPowerPreference,
pub(crate) fail_if_major_performance_caveat: bool,
pub(crate) desynchronized: bool,
- /// https://immersive-web.github.io/webxr/#dom-webglcontextattributes-xrcompatible
- pub(crate) xr_compatible: bool,
}
const ACTIVE_INFO_NAME_BUFFER_SIZE: usize = 256;
@@ -857,11 +854,6 @@ impl<V: Version> RenderingContext<V> {
Ok(self.proxy.get_attrib_location(program_handle, &utf8_bytes(&name)))
}
- pub(crate) fn make_xr_compatible(&self, _: &mut CallContext) -> WebIdlResult<WebIdlPromise> {
- // SAFETY: The cell is that of this context.
- Ok(unsafe { super::canvas::make_xr_compatible(self.context_ref().cell()) })
- }
-
pub(crate) fn get_error(&self, _: &mut CallContext) -> WebIdlResult<u32> {
Ok(self.take_error())
}
diff --git a/Libraries/LibWeb/CMakeLists.txt b/Libraries/LibWeb/CMakeLists.txt
index d92d26e4a92..2dfb30f73c2 100644
--- a/Libraries/LibWeb/CMakeLists.txt
+++ b/Libraries/LibWeb/CMakeLists.txt
@@ -706,13 +706,11 @@ set(SOURCES
IndexedDB/RustIntegration.cpp
Infra/ByteSequences.cpp
Infra/JSON.cpp
- Internals/FakeXRDevice.cpp
Internals/InternalAnimationTimeline.cpp
Internals/InternalGamepad.cpp
Internals/Internals.cpp
Internals/InternalsBase.cpp
Internals/WebUI.cpp
- Internals/XRTest.cpp
IntersectionObserver/IntersectionObserver.cpp
IntersectionObserver/IntersectionObserverEntry.cpp
LargestContentfulPaint/LargestContentfulPaint.cpp
@@ -1104,12 +1102,6 @@ set(SOURCES
WebVTT/Parser.cpp
WebVTT/VTTCue.cpp
WebVTT/VTTRegion.cpp
- WebXR/XRLayer.cpp
- WebXR/XRRenderState.cpp
- WebXR/XRSession.cpp
- WebXR/XRSessionEvent.cpp
- WebXR/XRSystem.cpp
- WebXR/XRWebGLLayer.cpp
XHR/EventNames.cpp
XHR/FormData.cpp
XHR/ProgressEvent.cpp
diff --git a/Libraries/LibWeb/Forward.h b/Libraries/LibWeb/Forward.h
index b949b669341..7db3c303388 100644
--- a/Libraries/LibWeb/Forward.h
+++ b/Libraries/LibWeb/Forward.h
@@ -912,11 +912,9 @@ class IDBFactory;
namespace Web::Internals {
-class FakeXRDevice;
class Internals;
class InternalGamepad;
class WebUI;
-class XRTest;
}
@@ -1317,17 +1315,6 @@ class VTTRegion;
}
-namespace Web::WebXR {
-
-class XRLayer;
-class XRRenderState;
-class XRSession;
-class XRSessionEvent;
-class XRSystem;
-class XRWebGLLayer;
-
-}
-
namespace Web::XHR {
class FormData;
diff --git a/Libraries/LibWeb/HTML/Navigator.cpp b/Libraries/LibWeb/HTML/Navigator.cpp
index 6cf45cc2b15..2cd0861134e 100644
--- a/Libraries/LibWeb/HTML/Navigator.cpp
+++ b/Libraries/LibWeb/HTML/Navigator.cpp
@@ -21,14 +21,12 @@
#include <LibWeb/HTML/Scripting/Environments.h>
#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
#include <LibWeb/HTML/Window.h>
-#include <LibWeb/Internals/XRTest.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <LibWeb/MediaCapture/MediaDevices.h>
#include <LibWeb/Page/Page.h>
#include <LibWeb/PermissionsAPI/Permissions.h>
#include <LibWeb/Platform/EventLoopPlugin.h>
#include <LibWeb/ServiceWorker/ServiceWorkerContainer.h>
-#include <LibWeb/WebXR/XRSystem.h>
namespace Web::HTML {
@@ -90,7 +88,6 @@ void Navigator::visit_edges(GC::Cell::Visitor& visitor)
visitor.visit(m_media_capabilities);
visitor.visit(m_media_devices);
visitor.visit(m_credentials);
- visitor.visit(m_xr);
visitor.visit(m_permissions);
}
@@ -143,19 +140,6 @@ GC::Ref<CredentialManagement::CredentialsContainer> Navigator::credentials()
return *m_credentials;
}
-GC::Ref<WebXR::XRSystem> Navigator::xr()
-{
- if (!m_xr)
- m_xr = WebXR::XRSystem::create(*m_window);
- auto& realm = HTML::relevant_realm(*m_window);
- auto& wrapper_world = Bindings::host_defined_wrapper_world(realm);
-
- if (Window::is_internals_object_exposed())
- Bindings::wrap(wrapper_world, realm, GC::Ref { *m_xr })->define_direct_property("test"_utf16_fly_string, Bindings::wrap(wrapper_world, realm, Internals::XRTest::create(*m_window)), JS::default_attributes);
-
- return *m_xr;
-}
-
// https://w3c.github.io/pointerevents/#dom-navigator-maxtouchpoints
WebIDL::Long Navigator::max_touch_points()
{
diff --git a/Libraries/LibWeb/HTML/Navigator.h b/Libraries/LibWeb/HTML/Navigator.h
index bf12037006d..1ca3c573d99 100644
--- a/Libraries/LibWeb/HTML/Navigator.h
+++ b/Libraries/LibWeb/HTML/Navigator.h
@@ -71,7 +71,6 @@ public:
[[nodiscard]] GC::Ref<CredentialManagement::CredentialsContainer> credentials();
GC::Ref<WebIDL::Promise> get_battery();
void start_get_battery_steps(GC::Ref<WebIDL::Promise>);
- [[nodiscard]] GC::Ref<WebXR::XRSystem> xr();
[[nodiscard]] GC::Ref<PermissionsAPI::Permissions> permissions();
void request_media_key_system_access(Utf16String key_system, Vector<EncryptedMediaExtensions::MediaKeySystemConfiguration> supported_configurations, GC::Ref<WebIDL::Promise>);
@@ -129,9 +128,6 @@ private:
// https://w3c.github.io/webappsec-credential-management/#framework-credential-management
GC::Ptr<CredentialManagement::CredentialsContainer> m_credentials;
- // https://immersive-web.github.io/webxr/#dom-navigator-xr
- GC::Ptr<WebXR::XRSystem> m_xr;
-
// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension
GC::Ptr<PermissionsAPI::Permissions> m_permissions;
diff --git a/Libraries/LibWeb/HTML/Navigator.idl b/Libraries/LibWeb/HTML/Navigator.idl
index 6de40c7f3b1..e9bbbc1b22f 100644
--- a/Libraries/LibWeb/HTML/Navigator.idl
+++ b/Libraries/LibWeb/HTML/Navigator.idl
@@ -33,9 +33,6 @@ interface Navigator {
// https://w3c.github.io/battery/
[SecureContext, Experimental] Promise<BatteryManager> getBattery();
- // https://immersive-web.github.io/webxr/#navigator-xr-attribute
- [SecureContext, SameObject] readonly attribute XRSystem xr;
-
// https://w3c.github.io/permissions/#navigator-and-workernavigator-extension
[SameObject] readonly attribute Permissions permissions;
};
diff --git a/Libraries/LibWeb/Internals/FakeXRDevice.cpp b/Libraries/LibWeb/Internals/FakeXRDevice.cpp
deleted file mode 100644
index 162ac224e18..00000000000
--- a/Libraries/LibWeb/Internals/FakeXRDevice.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/HTML/Window.h>
-#include <LibWeb/Internals/FakeXRDevice.h>
-#include <LibWeb/WebIDL/Promise.h>
-
-namespace Web::Internals {
-
-GC_DEFINE_ALLOCATOR(FakeXRDevice);
-
-GC::Ref<FakeXRDevice> FakeXRDevice::create(HTML::Window& window)
-{
- return GC::Heap::the().allocate<FakeXRDevice>(window);
-}
-
-FakeXRDevice::FakeXRDevice(HTML::Window& window)
- : InternalsBase(window)
-{
-}
-
-FakeXRDevice::~FakeXRDevice() = default;
-
-GC::Ref<WebIDL::Promise> FakeXRDevice::disconnect() const
-{
- auto promise = WebIDL::create_promise_for(window());
- disconnect(promise);
- return promise;
-}
-
-void FakeXRDevice::disconnect(GC::Ref<WebIDL::Promise> promise) const
-{
- // behaves as if device was disconnected
- // FIXME: Implement this once we have actual devices that can disconnect.
- WebIDL::resolve_promise(promise);
-}
-
-}
diff --git a/Libraries/LibWeb/Internals/FakeXRDevice.h b/Libraries/LibWeb/Internals/FakeXRDevice.h
deleted file mode 100644
index 60f2560aece..00000000000
--- a/Libraries/LibWeb/Internals/FakeXRDevice.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Export.h>
-#include <LibWeb/Internals/InternalsBase.h>
-#include <LibWeb/WebXR/XRSession.h>
-
-namespace Web::Internals {
-
-// https://github.com/immersive-web/webxr-test-api/blob/main/explainer.md
-class WEB_API FakeXRDevice final : public InternalsBase {
- WEB_WRAPPABLE(FakeXRDevice, InternalsBase);
- GC_DECLARE_ALLOCATOR(FakeXRDevice);
-
-public:
- static GC::Ref<FakeXRDevice> create(HTML::Window&);
- virtual ~FakeXRDevice() override;
-
- void simulate_user_activation(GC::Ref<WebIDL::CallbackType>) const;
-
- GC::Ref<WebIDL::Promise> disconnect() const;
- void disconnect(GC::Ref<WebIDL::Promise>) const;
-
-private:
- explicit FakeXRDevice(HTML::Window&);
-};
-
-}
diff --git a/Libraries/LibWeb/Internals/FakeXRDevice.idl b/Libraries/LibWeb/Internals/FakeXRDevice.idl
deleted file mode 100644
index 77cae9a77ff..00000000000
--- a/Libraries/LibWeb/Internals/FakeXRDevice.idl
+++ /dev/null
@@ -1,47 +0,0 @@
-// https://immersive-web.github.io/webxr-test-api/#fakexrdeviceinit-dict
-dictionary FakeXRDeviceInit {
- // required boolean supportsImmersive;
- sequence<XRSessionMode> supportedModes;
- // required sequence<FakeXRViewInit> views;
- // sequence<FakeXRViewInit> secondaryViews;
-
- sequence<any> supportedFeatures;
- // sequence<FakeXRBoundsPoint> boundsCoordinates;
- // FakeXRRigidTransformInit floorOrigin;
- // FakeXRRigidTransformInit viewerOrigin;
-
- // Hit test extensions:
- // FakeXRWorldInit world;
-
- // Depth sensing extensions:
- // FakeXRDepthSensingDataInit depthSensingData;
- // FakeXRDepthConfigurationSupport depthSupport;
-};
-
-// https://immersive-web.github.io/webxr-test-api/#fakexrdevice-interface
-// FIXME: FakeXRDevice should be a subclass of EventTarget.
-[SecureContext, Exposed=Nobody]
-interface FakeXRDevice {
- // FIXME: undefined setViews(sequence<FakeXRViewInit> views, optional sequence<FakeXRViewInit> secondaryViews);
-
- Promise<undefined> disconnect();
-
- // FIXME: undefined setViewerOrigin(FakeXRRigidTransformInit origin, optional boolean emulatedPosition = false);
- // FIXME: undefined clearViewerOrigin();
- // FIXME: undefined setFloorOrigin(FakeXRRigidTransformInit origin);
- // FIXME: undefined clearFloorOrigin();
- // FIXME: undefined setBoundsGeometry(sequence<FakeXRBoundsPoint> boundsCoordinates);
- // FIXME: undefined simulateResetPose();
-
- // FIXME: undefined simulateVisibilityChange(XRVisibilityState state);
-
- // FIXME: FakeXRInputController simulateInputSourceConnection(FakeXRInputSourceInit init);
-
- // Hit test extensions:
- // FIXME: undefined setWorld(FakeXRWorldInit world);
- // FIXME: undefined clearWorld();
-
- // Depth sensing extensions:
- // FIXME: undefined setDepthSensingData(FakeXRDepthSensingDataInit depthSensingData);
- // FIXME: undefined clearDepthSensingData();
-};
diff --git a/Libraries/LibWeb/Internals/XRTest.cpp b/Libraries/LibWeb/Internals/XRTest.cpp
deleted file mode 100644
index f4dfec17d5d..00000000000
--- a/Libraries/LibWeb/Internals/XRTest.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/Bindings/FakeXRDevice.h>
-#include <LibWeb/Bindings/Wrappable.h>
-#include <LibWeb/Bindings/WrapperWorld.h>
-#include <LibWeb/HTML/Window.h>
-#include <LibWeb/Internals/FakeXRDevice.h>
-#include <LibWeb/Internals/XRTest.h>
-#include <LibWeb/WebIDL/AbstractOperations.h>
-#include <LibWeb/WebIDL/Promise.h>
-
-namespace Web::Internals {
-
-GC_DEFINE_ALLOCATOR(XRTest);
-
-GC::Ref<XRTest> XRTest::create(HTML::Window& window)
-{
- return GC::Heap::the().allocate<XRTest>(window);
-}
-
-XRTest::XRTest(HTML::Window& window)
- : InternalsBase(window)
-{
-}
-
-XRTest::~XRTest() = default;
-
-void XRTest::simulate_device_connection(JS::Realm& realm, FakeXRDeviceInit const&, GC::Ref<WebIDL::Promise> promise) const
-{
- // Simulates connecting a device to the system.
- // Used to instantiate a fake device for use in tests.
- // FIXME: Actually perform whatever device connection steps are needed once those are implemented.
- auto fake_device = FakeXRDevice::create(window());
- WebIDL::resolve_promise(promise, Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, fake_device));
-}
-
-WebIDL::ExceptionOr<void> XRTest::simulate_user_activation(WebIDL::CallbackType& function) const
-{
- // FIXME: Actually simulate a user activation here.
- TRY(WebIDL::invoke_callback(function, {}, {}));
- return {};
-}
-
-void XRTest::disconnect_all_devices(GC::Ref<WebIDL::Promise> promise) const
-{
- // Disconnect all fake devices
- // FIXME: Actually disconnect fake devices once we have any.
- WebIDL::resolve_promise(promise);
-}
-
-}
diff --git a/Libraries/LibWeb/Internals/XRTest.h b/Libraries/LibWeb/Internals/XRTest.h
deleted file mode 100644
index 18cb0791be7..00000000000
--- a/Libraries/LibWeb/Internals/XRTest.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Bindings/FakeXRDevice.h>
-#include <LibWeb/Internals/FakeXRDevice.h>
-#include <LibWeb/Internals/InternalsBase.h>
-#include <LibWeb/WebIDL/Promise.h>
-#include <LibWebCommon/WebIDL/Types.h>
-
-namespace Web::Internals {
-
-using FakeXRDeviceInit = Bindings::FakeXRDeviceInit;
-
-// https://github.com/immersive-web/webxr-test-api/blob/main/explainer.md
-class WEB_API XRTest final : public InternalsBase {
- WEB_WRAPPABLE(XRTest, InternalsBase);
- GC_DECLARE_ALLOCATOR(XRTest);
-
-public:
- static GC::Ref<XRTest> create(HTML::Window&);
-
- virtual ~XRTest() override;
-
- void simulate_device_connection(JS::Realm&, FakeXRDeviceInit const&, GC::Ref<WebIDL::Promise>) const;
- WebIDL::ExceptionOr<void> simulate_user_activation(WebIDL::CallbackType&) const;
-
- void disconnect_all_devices(GC::Ref<WebIDL::Promise>) const;
-
-private:
- explicit XRTest(HTML::Window&);
-};
-
-}
diff --git a/Libraries/LibWeb/Internals/XRTest.idl b/Libraries/LibWeb/Internals/XRTest.idl
deleted file mode 100644
index a63b6e7804e..00000000000
--- a/Libraries/LibWeb/Internals/XRTest.idl
+++ /dev/null
@@ -1,20 +0,0 @@
-// https://github.com/immersive-web/webxr-test-api/blob/main/explainer.md
-[Exposed=Nobody]
-partial interface XRSystem {
- [SameObject] readonly attribute XRTest test;
-};
-
-[Exposed=Nobody]
-interface XRTest {
- // Simulates connecting a device to the system.
- // Used to instantiate a fake device for use in tests.
- [CreatesPromise, NeedsCallerRealm] Promise<FakeXRDevice> simulateDeviceConnection(FakeXRDeviceInit init);
-
- // Simulates a user activation (aka user gesture) for the current scope.
- // The activation is only guaranteed to be valid in the provided function and only applies to WebXR
- // Device API methods.
- undefined simulateUserActivation(Function f);
-
- // Disconnect all fake devices
- [CreatesPromise] Promise<undefined> disconnectAllDevices();
-};
diff --git a/Libraries/LibWeb/WebGL/WebGLContextAttributes.h b/Libraries/LibWeb/WebGL/WebGLContextAttributes.h
index d396b2f946a..cef22310561 100644
--- a/Libraries/LibWeb/WebGL/WebGLContextAttributes.h
+++ b/Libraries/LibWeb/WebGL/WebGLContextAttributes.h
@@ -22,9 +22,6 @@ struct WebGLContextAttributes {
Bindings::WebGLPowerPreference power_preference { Bindings::WebGLPowerPreference::Default };
bool fail_if_major_performance_caveat { false };
bool desynchronized { false };
-
- // https://immersive-web.github.io/webxr/#dom-webglcontextattributes-xrcompatible
- bool xr_compatible { false };
};
JS::ThrowCompletionOr<WebGLContextAttributes> convert_value_to_context_attributes_dictionary(JS::VM&, JS::Value value);
diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp
index 5f7decf2d6d..5881981da03 100644
--- a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp
+++ b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp
@@ -25,11 +25,9 @@
#include <LibWeb/HTML/HTMLImageElement.h>
#include <LibWeb/HTML/HTMLVideoElement.h>
#include <LibWeb/HTML/OffscreenCanvas.h>
-#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
#include <LibWeb/HTML/WindowOrWorkerGlobalScope.h>
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
#include <LibWeb/Page/Page.h>
-#include <LibWeb/Platform/EventLoopPlugin.h>
#include <LibWeb/WebGL/EventNames.h>
#include <LibWeb/WebGL/RemoteWebGLTransport.h>
#include <LibWeb/WebGL/WebGL2RenderingContext.h>
@@ -37,7 +35,6 @@
#include <LibWeb/WebGL/WebGLContextEvent.h>
#include <LibWeb/WebGL/WebGLRenderingContext.h>
#include <LibWeb/WebGL/WebGLRenderingContextBase.h>
-#include <LibWeb/WebIDL/Promise.h>
namespace Web::WebGL {
@@ -55,7 +52,6 @@ struct RustContextAttributes {
u8 power_preference { 0 };
bool fail_if_major_performance_caveat { false };
bool desynchronized { false };
- bool xr_compatible { false };
};
// `ContextCreationArguments` of Bindings/Rust/src/web_gl/exports.rs.
@@ -103,7 +99,6 @@ extern "C" {
// Defined in Bindings/Rust/src/web_gl/exports.rs. A context is the cell of a context of either kind.
void* web_webgl_context_create(JSVM*, ContextCreationArguments const*);
void* web_webgl_context_canvas_host(void* context);
-void* web_webgl_context_realm(void* context);
bool web_webgl_context_is_webgl2(void* context);
bool web_webgl_context_is_lost(void* context);
bool web_webgl_context_canvas_id(void* context, u64* out_canvas_id);
@@ -116,8 +111,6 @@ void web_webgl_context_set_restore_requested(void* context, bool requested);
bool web_webgl_context_wants_restoring(void* context);
void web_webgl_context_actual_context_parameters(void* context, RustContextAttributes* out_context_attributes);
void web_webgl_context_restore(void* context, void* transport, ReadonlySpan<ReadonlyBytes> supported_extensions);
-bool web_webgl_context_xr_compatible(void* context);
-void web_webgl_context_set_xr_compatible(void* context, bool xr_compatible);
// What the Rust implementation asks of LibWeb, declared in Bindings/Rust/src/web_gl/canvas.rs.
void web_webgl_canvas_did_change_content(void* canvas_host);
@@ -130,7 +123,6 @@ bool web_webgl_required_2d_texture_data_size(i32 width, i32 height, u32 format,
TexImageSourceResult web_webgl_read_tex_image_source(void* source_wrapper, TexImageSourceKind, u32 format, u32 type, void** out_frame);
TexImageSourceResult web_webgl_read_tex_image_frame(Gfx::DecodedImageFrame const* image_frame, u32 format, u32 type, void** out_frame);
TexImageSourceResult web_webgl_read_tex_image_pixels(u8 const* pixels, u32 width, u32 height, u32 format, u32 type, void** out_frame);
-void* web_webgl_make_xr_compatible(void* context);
}
static void* cell_of(WebGLRenderingContextBase const& context)
@@ -162,7 +154,6 @@ static RustContextAttributes to_rust_context_attributes(WebGLContextAttributes c
.power_preference = power_preference,
.fail_if_major_performance_caveat = context_attributes.fail_if_major_performance_caveat,
.desynchronized = context_attributes.desynchronized,
- .xr_compatible = context_attributes.xr_compatible,
};
}
@@ -351,89 +342,6 @@ void WebGLRenderingContextBase::restore_context_after_compositor_reconnect()
}));
}
-bool WebGLRenderingContextBase::xr_compatible() const
-{
- return web_webgl_context_xr_compatible(cell_of(*this));
-}
-
-void WebGLRenderingContextBase::set_xr_compatible(bool xr_compatible)
-{
- web_webgl_context_set_xr_compatible(this, xr_compatible);
-}
-
-// https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible
-GC::Ref<WebIDL::Promise> WebGLRenderingContextBase::make_xr_compatible()
-{
- // 1. If the requesting document’s origin is not allowed to use the "xr-spatial-tracking" permissions policy,
- // resolve promise and return it.
- // FIXME: Implement this.
-
- // 2. Let promise be a new Promise created in the Realm of this WebGLRenderingContextBase.
- auto& realm = *static_cast<JS::Realm*>(web_webgl_context_realm(this));
- auto promise = WebIDL::create_promise_for(canvas_host().canvas_relevant_global_object());
-
- // 3. Let context be this.
- auto context = this;
-
- // 4. Run the following steps in parallel:
- Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(realm.heap(), [&realm, context, promise]() {
- // 1. Let device be the result of ensuring an immersive XR device is selected.
- // FIXME: Implement https://immersive-web.github.io/webxr/#ensure-an-immersive-xr-device-is-selected
-
- // 2. Set context’s XR compatible boolean as follows:
-
- // -> If context’s WebGL context lost flag is set:
- if (context->is_context_lost()) {
- // Queue a task to set context’s XR compatible boolean to false and reject promise with an InvalidStateError.
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise, context]() {
- context->set_xr_compatible(false);
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::reject_promise(promise, WebIDL::InvalidStateError::create("The WebGL context has been lost."_utf16));
- }));
- }
- // -> If device is null:
- else if (false) {
- // Queue a task to set context’s XR compatible boolean to false and reject promise with an InvalidStateError.
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise, context]() {
- context->set_xr_compatible(false);
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::reject_promise(promise, WebIDL::InvalidStateError::create("Could not select an immersive XR device."_utf16));
- }));
- }
- // -> If context’s XR compatible boolean is true:
- else if (context->xr_compatible()) {
- // Queue a task to resolve promise.
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise]() {
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::resolve_promise(promise);
- }));
- }
- // -> If context was created on a compatible graphics adapter for device:
- // FIXME: For now we just pretend that this happened, so that we can resolve the promise and proceed running basic WPT tests for this.
- else if (true) {
- // Queue a task to set context’s XR compatible boolean to true and resolve promise.
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(realm.heap(), [&realm, promise, context]() {
- context->set_xr_compatible(true);
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::resolve_promise(promise);
- }));
- }
- // -> Otherwise:
- else {
- // Queue a task on the WebGL task source to perform the following steps:
- HTML::queue_a_task(HTML::Task::Source::WebGL, nullptr, nullptr, GC::create_function(realm.heap(), []() {
- // 1. Force context to be lost.
-
- // 2. Handle the context loss as described by the WebGL specification:
- // FIXME: Implement https://registry.khronos.org/webgl/specs/latest/1.0/#CONTEXT_LOST
- }));
- }
- }));
-
- // 5. Return promise.
- return promise;
-}
-
void web_webgl_canvas_did_change_content(void* canvas_host)
{
static_cast<HTML::CanvasHost*>(canvas_host)->did_change_canvas_content();
@@ -547,9 +455,4 @@ TexImageSourceResult web_webgl_read_tex_image_pixels(u8 const* pixels, u32 width
return tex_image_source_frame(Compositing::WebGL::ImageSourceFrame { Gfx::DecodedImageFrame { move(pixels_bitmap) } }, format, type, out_frame);
}
-void* web_webgl_make_xr_compatible(void* context)
-{
- return static_cast<WebGLRenderingContextBase*>(context)->make_xr_compatible().ptr();
-}
-
}
diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h
index 42bfc55f7f0..202be608ef6 100644
--- a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h
+++ b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h
@@ -51,12 +51,6 @@ public:
// page can re-create its now-lost GL resources.
void restore_context_after_compositor_reconnect();
- bool xr_compatible() const;
- void set_xr_compatible(bool);
-
- // https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible
- GC::Ref<WebIDL::Promise> make_xr_compatible();
-
protected:
static JS::ThrowCompletionOr<WebGLRenderingContextBase*> create(JS::Realm&, CanvasOwner, JS::Value options, WebGLVersion);
};
diff --git a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl
index ff34cf7e2c8..a7cf9d62a50 100644
--- a/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl
+++ b/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl
@@ -8,9 +8,6 @@ dictionary WebGLContextAttributes {
WebGLPowerPreference powerPreference = "default";
boolean failIfMajorPerformanceCaveat = false;
boolean desynchronized = false;
-
- // https://immersive-web.github.io/webxr/#dom-webglcontextattributes-xrcompatible
- boolean xrCompatible = false;
};
// https://registry.khronos.org/webgl/specs/latest/1.0/#5.14
@@ -562,7 +559,4 @@ interface mixin WebGLRenderingContextBase {
const GLenum CONTEXT_LOST_WEBGL = 0x9242;
const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
-
- // https://immersive-web.github.io/webxr/#dom-webglrenderingcontextbase-makexrcompatible
- [NewObject] Promise<undefined> makeXRCompatible();
};
diff --git a/Libraries/LibWeb/WebXR/XRLayer.cpp b/Libraries/LibWeb/WebXR/XRLayer.cpp
deleted file mode 100644
index 357f1aef310..00000000000
--- a/Libraries/LibWeb/WebXR/XRLayer.cpp
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/WebXR/XRLayer.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRLayer);
-
-XRLayer::XRLayer()
- : DOM::EventTarget()
-{
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRLayer.h b/Libraries/LibWeb/WebXR/XRLayer.h
deleted file mode 100644
index c022eb92b08..00000000000
--- a/Libraries/LibWeb/WebXR/XRLayer.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/DOM/Event.h>
-
-namespace Web::WebXR {
-
-// https://immersive-web.github.io/webxr/#xrlayer
-class XRLayer : public DOM::EventTarget {
- WEB_WRAPPABLE(XRLayer, DOM::EventTarget);
- GC_DECLARE_ALLOCATOR(XRLayer);
-
- XRLayer();
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRLayer.idl b/Libraries/LibWeb/WebXR/XRLayer.idl
deleted file mode 100644
index a56f8689b63..00000000000
--- a/Libraries/LibWeb/WebXR/XRLayer.idl
+++ /dev/null
@@ -1,3 +0,0 @@
-// https://immersive-web.github.io/webxr/#xrlayer-interface
-[Experimental, SecureContext, Exposed=Window]
-interface XRLayer : EventTarget {};
diff --git a/Libraries/LibWeb/WebXR/XRRenderState.cpp b/Libraries/LibWeb/WebXR/XRRenderState.cpp
deleted file mode 100644
index e32f9cedd56..00000000000
--- a/Libraries/LibWeb/WebXR/XRRenderState.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibWeb/WebXR/XRRenderState.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRRenderState);
-
-XRRenderState::XRRenderState()
-{
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRRenderState.h b/Libraries/LibWeb/WebXR/XRRenderState.h
deleted file mode 100644
index f51bb6e2b74..00000000000
--- a/Libraries/LibWeb/WebXR/XRRenderState.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Bindings/Wrappable.h>
-#include <LibWeb/Export.h>
-
-namespace Web::WebXR {
-
-// https://immersive-web.github.io/webxr/#xrrenderstate
-class XRRenderState : public Bindings::GCAllocatedWrappable {
- WEB_WRAPPABLE(XRRenderState, Bindings::GCAllocatedWrappable);
- GC_DECLARE_ALLOCATOR(XRRenderState);
-
- XRRenderState();
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRRenderState.idl b/Libraries/LibWeb/WebXR/XRRenderState.idl
deleted file mode 100644
index 62268b4d824..00000000000
--- a/Libraries/LibWeb/WebXR/XRRenderState.idl
+++ /dev/null
@@ -1,18 +0,0 @@
-// https://immersive-web.github.io/webxr/#xrrenderstate-interface
-
-[Experimental] dictionary XRRenderStateInit {
- double depthNear;
- double depthFar;
- boolean passthroughFullyObscured;
- double inlineVerticalFieldOfView;
- // FIXME: XRWebGLLayer? baseLayer;
- // FIXME: sequence<XRLayer>? layers;
-};
-
-[Experimental, SecureContext, Exposed=Window] interface XRRenderState {
- [FIXME] readonly attribute double depthNear;
- [FIXME] readonly attribute double depthFar;
- [FIXME] readonly attribute boolean? passthroughFullyObscured;
- [FIXME] readonly attribute double? inlineVerticalFieldOfView;
- [FIXME] readonly attribute XRWebGLLayer? baseLayer;
-};
diff --git a/Libraries/LibWeb/WebXR/XRSession.cpp b/Libraries/LibWeb/WebXR/XRSession.cpp
deleted file mode 100644
index b4dc73e43bd..00000000000
--- a/Libraries/LibWeb/WebXR/XRSession.cpp
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/HTML/EventLoop/Task.h>
-#include <LibWeb/HTML/EventNames.h>
-#include <LibWeb/HTML/Scripting/Environments.h>
-#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
-#include <LibWeb/HighResolutionTime/TimeOrigin.h>
-#include <LibWeb/WebIDL/DOMException.h>
-#include <LibWeb/WebIDL/Promise.h>
-#include <LibWeb/WebXR/XRSession.h>
-#include <LibWeb/WebXR/XRSessionEvent.h>
-#include <LibWeb/WebXR/XRSystem.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRSession);
-
-GC::Ref<XRSession> XRSession::create(GC::Ref<XRSystem> xr_system)
-{
- return GC::Heap::the().allocate<XRSession>(xr_system);
-}
-
-XRSession::XRSession(XRSystem& xr_system)
- : DOM::EventTarget()
- , m_xr_system(xr_system)
-{
-}
-
-void XRSession::visit_edges(Cell::Visitor& visitor)
-{
- Base::visit_edges(visitor);
-
- visitor.visit(m_xr_system);
- visitor.visit(m_outstanding_promises);
-}
-
-// https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
-void XRSession::update_render_state(XRRenderStateInit const&)
-{
- dbgln("FIXME: stubbed out XRSession.updateRenderState()");
-}
-
-// https://immersive-web.github.io/webxr/#shut-down-the-session
-void XRSession::shut_down()
-{
- // 1. Set session’s ended value to true.
- m_ended = true;
-
- // 2. If the active immersive session is equal to session, set the active immersive session to null.
- if (m_xr_system->active_immersive_session() == GC::Ref { *this })
- m_xr_system->set_active_immersive_session({});
-
- // 3. Remove session from the list of inline sessions.
- m_xr_system->remove_inline_session(*this);
-
- // 4. Reject any outstanding promises returned by session with an InvalidStateError, except for any promises returned by end().
- for (auto promise : m_outstanding_promises) {
- WebIDL::reject_promise(promise, WebIDL::InvalidStateError::create("Session ended."_utf16));
- }
- m_outstanding_promises.clear();
-
- // 5. If no other features of the user agent are actively using them, perform the necessary platform-specific steps to shut down the device’s tracking and rendering capabilities. This MUST include:
- // - Releasing exclusive access to the XR device if session is an immersive session.
- // - Deallocating any graphics resources acquired by session for presentation to the XR device.
- // - Putting the XR device in a state such that a different source may be able to initiate a session with the same device if session is an immersive session.
- // FIXME: Implement this once we have any of this.
-
- // 6. Queue a task that fires an XRSessionEvent named end on session.
- auto& relevant_global_object = m_xr_system->relevant_global_object();
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(GC::Heap::the(), [this, relevant_global_object = GC::Ref(relevant_global_object)]() {
- XRSessionEventInit init { {}, GC::Ref { *this } };
- auto event = XRSessionEvent::create(HTML::EventNames::end, init, HighResolutionTime::current_high_resolution_time(relevant_global_object));
- this->dispatch_event(event);
- }));
-}
-
-// https://immersive-web.github.io/webxr/#dom-xrsession-end
-GC::Ref<WebIDL::Promise> XRSession::end()
-{
- // 1. Let promise be a new Promise in the relevant realm of this XRSession.
- auto promise = WebIDL::create_promise_for(m_xr_system->relevant_global_object());
-
- // 2. If the ended value of this is true, reject promise with a "InvalidStateError" DOMException and return promise.
- if (ended())
- WebIDL::reject_promise(promise, WebIDL::InvalidStateError::create("Session already ended."_utf16));
-
- // 3. Shut down this.
- shut_down();
-
- // 4. Queue a task to perform the following steps:
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(GC::Heap::the(), [promise]() {
- // 1. Wait until any platform-specific steps related to shutting down the session have completed.
- // FIXME: Do this once we have any.
-
- // 2. Resolve promise.
- auto& realm = WebIDL::promise_realm(promise);
- HTML::TemporaryExecutionContext context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::resolve_promise(promise);
- }));
-
- // 5. Return promise.
- return promise;
-}
-
-// https://immersive-web.github.io/webxr/#dom-xrsession-onend
-GC::Ptr<WebIDL::CallbackType> XRSession::onend()
-{
- return event_handler_attribute(HTML::EventNames::end);
-}
-
-// https://www.w3.org/TR/web-animations-1/#dom-animation-onfinish
-void XRSession::set_onend(GC::Ptr<WebIDL::CallbackType> event_handler)
-{
- set_event_handler_attribute(HTML::EventNames::end, event_handler);
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSession.h b/Libraries/LibWeb/WebXR/XRSession.h
deleted file mode 100644
index 6fda2037941..00000000000
--- a/Libraries/LibWeb/WebXR/XRSession.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Bindings/XRRenderState.h>
-#include <LibWeb/DOM/EventTarget.h>
-#include <LibWeb/WebXR/XRRenderState.h>
-#include <LibWeb/WebXR/XRSystem.h>
-
-namespace Web::WebXR {
-
-using XRRenderStateInit = Bindings::XRRenderStateInit;
-
-// https://immersive-web.github.io/webxr/#XRSession-interface
-class XRSession final : public DOM::EventTarget {
- WEB_WRAPPABLE(XRSession, DOM::EventTarget);
- GC_DECLARE_ALLOCATOR(XRSession);
-
-public:
- static GC::Ref<XRSession> create(GC::Ref<XRSystem>);
- virtual ~XRSession() override = default;
-
- // https://immersive-web.github.io/webxr/#dom-xrsession-updaterenderstate
- void update_render_state(XRRenderStateInit const&);
-
- // https://immersive-web.github.io/webxr/#shut-down-the-session
- void shut_down();
- GC::Ref<WebIDL::Promise> end();
-
- GC::Ptr<WebIDL::CallbackType> onend();
- void set_onend(GC::Ptr<WebIDL::CallbackType>);
-
- bool promise_resolved() const { return m_promise_resolved; }
- void set_promise_resolved(bool promise_resolved) { m_promise_resolved = promise_resolved; }
-
- bool ended() const { return m_ended; }
-
- // https://immersive-web.github.io/webxr/#immersive-session
- bool is_immersive() const { return m_mode != XRSessionMode::Inline; }
-
-private:
- XRSession(XRSystem&);
-
- virtual void visit_edges(JS::Cell::Visitor&) override;
-
- GC::Ref<XRSystem> m_xr_system;
-
- // NB: These are for step 4 of Shut Down the Session, which requires us to reject all outstanding promises created by this session.
- Vector<GC::Ref<WebIDL::Promise>> m_outstanding_promises {};
-
- // https://immersive-web.github.io/webxr/#xrsession-promise-resolved
- bool m_promise_resolved { false };
-
- // https://immersive-web.github.io/webxr/#xrsession-ended
- bool m_ended { false };
-
- // https://immersive-web.github.io/webxr/#xrsession-mode
- XRSessionMode m_mode {};
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSession.idl b/Libraries/LibWeb/WebXR/XRSession.idl
deleted file mode 100644
index 42be97c775d..00000000000
--- a/Libraries/LibWeb/WebXR/XRSession.idl
+++ /dev/null
@@ -1,39 +0,0 @@
-[Experimental] enum XRVisibilityState {
- "visible",
- "visible-blurred",
- "hidden",
-};
-
-[Experimental, SecureContext, Exposed=Window] interface XRSession : EventTarget {
- // Attributes
- [FIXME] readonly attribute XRVisibilityState visibilityState;
- [FIXME] readonly attribute float? frameRate;
- [FIXME] readonly attribute Float32Array? supportedFrameRates;
- [FIXME, SameObject] readonly attribute XRRenderState renderState;
- [FIXME, SameObject] readonly attribute XRInputSourceArray inputSources;
- [FIXME, SameObject] readonly attribute XRInputSourceArray trackedSources;
- [FIXME] readonly attribute FrozenArray<DOMString> enabledFeatures;
- [FIXME] readonly attribute boolean isSystemKeyboardSupported;
-
- // Methods
- undefined updateRenderState(optional XRRenderStateInit state = {});
- [FIXME] Promise<undefined> updateTargetFrameRate(float rate);
- [FIXME, NewObject] Promise<XRReferenceSpace> requestReferenceSpace(XRReferenceSpaceType type);
-
- [FIXME] unsigned long requestAnimationFrame(XRFrameRequestCallback callback);
- [FIXME] undefined cancelAnimationFrame(unsigned long handle);
-
- Promise<undefined> end();
-
- // Events
- attribute EventHandler onend;
- [FIXME] attribute EventHandler oninputsourceschange;
- [FIXME] attribute EventHandler onselect;
- [FIXME] attribute EventHandler onselectstart;
- [FIXME] attribute EventHandler onselectend;
- [FIXME] attribute EventHandler onsqueeze;
- [FIXME] attribute EventHandler onsqueezestart;
- [FIXME] attribute EventHandler onsqueezeend;
- [FIXME] attribute EventHandler onvisibilitychange;
- [FIXME] attribute EventHandler onframeratechange;
-};
diff --git a/Libraries/LibWeb/WebXR/XRSessionEvent.cpp b/Libraries/LibWeb/WebXR/XRSessionEvent.cpp
deleted file mode 100644
index 9e25df1ce64..00000000000
--- a/Libraries/LibWeb/WebXR/XRSessionEvent.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/WebXR/XRSession.h>
-#include <LibWeb/WebXR/XRSessionEvent.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRSessionEvent);
-
-GC::Ref<XRSessionEvent> XRSessionEvent::create(Utf16FlyString const& type, XRSessionEventInit const& event_init, HighResolutionTime::DOMHighResTimeStamp time_stamp)
-{
- return GC::Heap::the().allocate<XRSessionEvent>(type, event_init, time_stamp);
-}
-
-XRSessionEvent::XRSessionEvent(Utf16FlyString const& type, XRSessionEventInit const& event_init, HighResolutionTime::DOMHighResTimeStamp time_stamp)
- : DOM::Event(type, event_init, time_stamp)
- , m_session(event_init.session)
-{
-}
-
-void XRSessionEvent::visit_edges(GC::Cell::Visitor& visitor)
-{
- Base::visit_edges(visitor);
-
- visitor.visit(m_session);
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSessionEvent.h b/Libraries/LibWeb/WebXR/XRSessionEvent.h
deleted file mode 100644
index 3c822b8871a..00000000000
--- a/Libraries/LibWeb/WebXR/XRSessionEvent.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibJS/Forward.h>
-#include <LibWeb/Bindings/XRSessionEvent.h>
-#include <LibWeb/DOM/Event.h>
-#include <LibWebCommon/HighResolutionTime/DOMHighResTimeStamp.h>
-
-namespace Web::HTML {
-
-class Window;
-
-}
-
-namespace Web::WebXR {
-
-class XRSession;
-
-using XRSessionEventInit = Bindings::XRSessionEventInit;
-
-// https://immersive-web.github.io/webxr/#xrsessionevent
-class XRSessionEvent : public DOM::Event {
- WEB_WRAPPABLE(XRSessionEvent, DOM::Event);
- GC_DECLARE_ALLOCATOR(XRSessionEvent);
-
-public:
- static constexpr size_t session_offset() { return offsetof(XRSessionEvent, m_session); }
- [[nodiscard]] static GC::Ref<XRSessionEvent> create(Utf16FlyString const&, XRSessionEventInit const&, HighResolutionTime::DOMHighResTimeStamp);
-
- virtual ~XRSessionEvent() override = default;
-
- GC::Ptr<XRSession> session() const { return m_session; }
-
-private:
- XRSessionEvent(Utf16FlyString const&, XRSessionEventInit const&, HighResolutionTime::DOMHighResTimeStamp);
-
- virtual void visit_edges(GC::Cell::Visitor&) override;
-
- // https://immersive-web.github.io/webxr/#dom-xrsessionevent-session
- GC::Ptr<XRSession> m_session;
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSessionEvent.idl b/Libraries/LibWeb/WebXR/XRSessionEvent.idl
deleted file mode 100644
index 6420d114c6d..00000000000
--- a/Libraries/LibWeb/WebXR/XRSessionEvent.idl
+++ /dev/null
@@ -1,10 +0,0 @@
-// https://immersive-web.github.io/webxr/#xrsessionevent-interface
-[Experimental, SecureContext, Exposed=Window]
-interface XRSessionEvent : Event {
- constructor(DOMString type, XRSessionEventInit eventInitDict);
- [DirectGetter, SameObject] readonly attribute XRSession session;
-};
-
-[Experimental] dictionary XRSessionEventInit : EventInit {
- required XRSession session;
-};
diff --git a/Libraries/LibWeb/WebXR/XRSystem.cpp b/Libraries/LibWeb/WebXR/XRSystem.cpp
deleted file mode 100644
index a48cbf07311..00000000000
--- a/Libraries/LibWeb/WebXR/XRSystem.cpp
+++ /dev/null
@@ -1,225 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/Bindings/Wrappable.h>
-#include <LibWeb/Bindings/WrapperWorld.h>
-#include <LibWeb/Bindings/XRSession.h>
-#include <LibWeb/HTML/EventLoop/EventLoop.h>
-#include <LibWeb/HTML/EventLoop/Task.h>
-#include <LibWeb/HTML/Scripting/Environments.h>
-#include <LibWeb/HTML/Scripting/TemporaryExecutionContext.h>
-#include <LibWeb/HTML/Window.h>
-#include <LibWeb/Platform/EventLoopPlugin.h>
-#include <LibWeb/WebIDL/Promise.h>
-#include <LibWeb/WebXR/XRSession.h>
-#include <LibWeb/WebXR/XRSystem.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRSystem);
-
-GC::Ref<XRSystem> XRSystem::create(HTML::Window& window)
-{
- return GC::Heap::the().allocate<XRSystem>(window);
-}
-
-XRSystem::XRSystem(HTML::Window& window)
- : DOM::EventTarget()
- , m_window(window)
-{
-}
-
-void XRSystem::visit_edges(Cell::Visitor& visitor)
-{
- Base::visit_edges(visitor);
-
- visitor.visit(m_active_immersive_session);
- visitor.visit(m_list_of_inline_sessions);
- visitor.visit(m_window);
-}
-
-JS::Object& XRSystem::relevant_global_object() const
-{
- return HTML::relevant_global_object(*m_window);
-}
-
-bool XRSystem::is_session_mode_supported(XRSessionMode mode) const
-{
- if (mode == XRSessionMode::Inline)
- return true;
-
- // 3. If the requesting document’s origin is not allowed to use the "xr-spatial-tracking" permissions policy, reject promise with a "SecurityError" DOMException and return it.
- // FIXME: Implement this.
-
- // 4. Check whether the session mode is supported as follows:
-
- // -> If the user agent and system are known to usually support mode sessions
- // promise MAY be resolved with true provided that all instances of this user agent
- // indistinguishable by user agent string produce the same result here.
- // FIXME: Implement this.
-
- // -> Otherwise
- // Run the following steps in parallel:
- // FIXME: We currently never end up here.
- // Add all these steps once WebXR is more supported.
-
- // -> If the user agent and system are known to never support mode sessions
- // Return false.
- return false;
-}
-
-void XRSystem::is_session_supported(XRSessionMode mode, GC::Ref<WebIDL::Promise> promise) const
-{
- WebIDL::resolve_promise(promise, JS::Value(is_session_mode_supported(mode)));
-}
-
-// https://immersive-web.github.io/webxr/#dom-xrsystem-requestsession
-void XRSystem::request_session(XRSessionMode mode, XRSessionInit const& options, GC::Ref<WebIDL::Promise> promise)
-{
- auto resolve = GC::create_function(GC::Heap::the(), [promise = GC::Root(promise)](GC::Ref<WebXR::XRSession> session) {
- auto& realm = WebIDL::promise_realm(*promise);
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::resolve_promise(*promise, Bindings::wrap(Bindings::host_defined_wrapper_world(realm), realm, session));
- });
- auto reject = GC::create_function(GC::Heap::the(), [promise = GC::Root(promise)](WebIDL::Exception exception) {
- auto& realm = WebIDL::promise_realm(*promise);
- HTML::TemporaryExecutionContext execution_context { realm, HTML::TemporaryExecutionContext::CallbacksEnabled::Yes };
- WebIDL::reject_promise_with_exception(*promise, move(exception));
- });
-
- // 1. Let immersive be true if mode is an immersive session mode, and false otherwise.
- auto immersive = mode != XRSessionMode::Inline;
-
- // 2. Let global object be the relevant Global object for the XRSystem on which this method was invoked.
- auto& global_object = relevant_global_object();
-
- // 3. Check whether the session request is allowed as follows:
-
- // -> If immersive is true:
- if (immersive) {
- // 1. Check if an immersive session request is allowed for the global object, and if not
- // reject promise with a "SecurityError" DOMException and return.
- // FIXME: Implement this.
- (void)global_object;
-
- // 2. If pending immersive session is true or active immersive session is not null, reject
- // promise with an "InvalidStateError" DOMException and return.
- if (m_pending_immersive_session || m_active_immersive_session) {
- reject->function()(WebIDL::InvalidStateError::create("An immersive session is already pending or active."_utf16));
- return;
- }
-
- // 3. Set pending immersive session to true.
- m_pending_immersive_session = true;
- }
- // -> Otherwise:
- else {
- // Check if an inline session request is allowed for the global object, and if not reject promise with
- // a "SecurityError" DOMException and return.
- // FIXME: Implement this.
- }
-
- // 4. Run the following steps in parallel:
- Platform::EventLoopPlugin::the().deferred_invoke(GC::create_function(GC::Heap::the(), [this, options, immersive, resolve, reject] {
- // 1. Let requiredFeatures be options’ requiredFeatures.
- auto required_features = options.required_features;
-
- // 2. Let optionalFeatures be options’ optionalFeatures.
- auto optional_features = options.optional_features;
-
- // 3. Set device to the result of obtaining the current device for mode, requiredFeatures, and optionalFeatures.
- // FIXME: Implement https://immersive-web.github.io/webxr/#obtain-the-current-device
- (void)required_features;
- (void)optional_features;
-
- // 4. Queue a task to perform the following steps:
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(GC::Heap::the(), [this, immersive, resolve, reject] {
- // 1. If device is null or device’s list of supported modes does not contain mode, run the following steps:
- // AD-HOC: Just reject immersive sessions here until we have devices.
- if (immersive) {
- // 1. Reject promise with a "NotSupportedError" DOMException.
- reject->function()(WebIDL::NotSupportedError::create("Sessions of this mode are not supported."_utf16));
-
- // 2. If immersive is true, set pending immersive session to false.
- if (immersive)
- set_pending_immersive_session(false);
-
- // 3. Abort these steps.
- return;
- }
-
- // FIXME:
- // 2. Let descriptor be an XRPermissionDescriptor initialized with mode, requiredFeatures, and optionalFeatures
- // 3. Let status be an XRPermissionStatus, initially null
- // 4. Request the xr permission with descriptor and status.
- // 5. If status’ state is "denied" run the following steps:
- if (false) {
- // 1. Reject promise with a "NotSupportedError" DOMException.
- reject->function()(WebIDL::NotSupportedError::create("The XR Permissions are denied."_utf16));
-
- // 2. If immersive is true, set pending immersive session to false.
- if (immersive)
- m_pending_immersive_session = false;
-
- // 3. Abort these steps.
- return;
- }
-
- // 6. Let granted be a set obtained from status’ granted.
-
- // 7. Let session be a new XRSession object in the relevant realm of this XRSystem.
- auto session = XRSession::create(*this);
-
- // 8. Initialize the session with session, mode, granted, and device.
- // FIXME: Implement https://immersive-web.github.io/webxr/#initialize-the-session
-
- // 9. Potentially set the active immersive session as follows:
-
- // -> If immersive is true:
- if (immersive) {
- // Set the active immersive session to session, and set pending immersive session to false.
- m_active_immersive_session = session;
- m_pending_immersive_session = false;
- }
- // -> Otherwise:
- else {
- // Append session to the list of inline sessions.
- m_list_of_inline_sessions.append(session);
- }
-
- // 10. Resolve promise with session.
- resolve->function()(session);
-
- // 11. Queue a task to perform the following steps:
- HTML::queue_a_task(HTML::Task::Source::Unspecified, nullptr, nullptr, GC::create_function(GC::Heap::the(), [session]() {
- // Note: These steps ensure that initial inputsourceschange events occur after the initial session is resolved.
-
- // 1. Set session’s promise resolved flag to true.
- session->set_promise_resolved(true);
-
- // 2. Let sources be any existing input sources attached to session.
- // FIXME: Implement this.
-
- // 3. If sources is non-empty, perform the following steps:
- if (false) {
- // 1. Set session’s list of active XR input sources to sources.
- // FIXME: Implement this.
-
- // 2. Fire an XRInputSourcesChangeEvent named inputsourceschange on session with added set to sources.
- // FIXME: Implement this.
- }
- }));
- }));
- }));
-}
-
-void XRSystem::remove_inline_session(GC::Ref<XRSession> session)
-{
- m_list_of_inline_sessions.remove_first_matching([&](auto& entry) { return entry == session; });
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSystem.h b/Libraries/LibWeb/WebXR/XRSystem.h
deleted file mode 100644
index 083318d1ad2..00000000000
--- a/Libraries/LibWeb/WebXR/XRSystem.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <AK/Vector.h>
-#include <LibJS/Forward.h>
-#include <LibWeb/Bindings/XRSystem.h>
-#include <LibWeb/DOM/EventTarget.h>
-#include <LibWeb/Forward.h>
-#include <LibWeb/WebIDL/Promise.h>
-
-namespace Web::WebXR {
-
-using XRSessionMode = Bindings::XRSessionMode;
-
-using XRSessionInit = Bindings::XRSessionInit;
-
-// https://immersive-web.github.io/webxr/#xrsystem-interface
-class XRSystem final : public DOM::EventTarget {
- WEB_WRAPPABLE(XRSystem, DOM::EventTarget);
- GC_DECLARE_ALLOCATOR(XRSystem);
-
-public:
- static GC::Ref<XRSystem> create(HTML::Window&);
- virtual ~XRSystem() override = default;
-
- // https://immersive-web.github.io/webxr/#dom-xrsystem-issessionsupported
- bool is_session_mode_supported(XRSessionMode) const;
- void is_session_supported(XRSessionMode, GC::Ref<WebIDL::Promise>) const;
-
- // https://immersive-web.github.io/webxr/#dom-xrsystem-requestsession
- void request_session(XRSessionMode, XRSessionInit const&, GC::Ref<WebIDL::Promise>);
-
- JS::Object& relevant_global_object() const;
-
- void set_pending_immersive_session(bool pending_immersive_session) { m_pending_immersive_session = pending_immersive_session; }
-
- GC::Ptr<XRSession> active_immersive_session() const { return m_active_immersive_session; }
- void set_active_immersive_session(GC::Ptr<XRSession> active_immersive_session) { m_active_immersive_session = active_immersive_session; }
-
- void remove_inline_session(GC::Ref<XRSession>);
-
-private:
- XRSystem(HTML::Window&);
-
- virtual void visit_edges(JS::Cell::Visitor&) override;
-
- // https://immersive-web.github.io/webxr/#pending-immersive-session
- bool m_pending_immersive_session { false };
-
- // https://immersive-web.github.io/webxr/#active-immersive-session
- GC::Ptr<XRSession> m_active_immersive_session {};
-
- // https://immersive-web.github.io/webxr/#list-of-inline-sessions
- Vector<GC::Ref<XRSession>> m_list_of_inline_sessions {};
-
- GC::Ref<HTML::Window> m_window;
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRSystem.idl b/Libraries/LibWeb/WebXR/XRSystem.idl
deleted file mode 100644
index d6116bda767..00000000000
--- a/Libraries/LibWeb/WebXR/XRSystem.idl
+++ /dev/null
@@ -1,19 +0,0 @@
-[Experimental, SecureContext, Exposed=Window] interface XRSystem : EventTarget {
- // Methods
- [CreatesPromise] Promise<boolean> isSessionSupported(XRSessionMode mode);
- [CreatesPromise, NewObject] Promise<XRSession> requestSession(XRSessionMode mode, optional XRSessionInit options = {});
-
- // Events
- [FIXME] attribute EventHandler ondevicechange;
-};
-
-[Experimental] enum XRSessionMode {
- "inline",
- "immersive-vr",
- "immersive-ar"
-};
-
-[Experimental] dictionary XRSessionInit {
- sequence<DOMString> requiredFeatures;
- sequence<DOMString> optionalFeatures;
-};
diff --git a/Libraries/LibWeb/WebXR/XRWebGLLayer.cpp b/Libraries/LibWeb/WebXR/XRWebGLLayer.cpp
deleted file mode 100644
index 41bcbd345c2..00000000000
--- a/Libraries/LibWeb/WebXR/XRWebGLLayer.cpp
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#include <LibGC/Heap.h>
-#include <LibWeb/WebGL/WebGL2RenderingContext.h>
-#include <LibWeb/WebGL/WebGLRenderingContext.h>
-#include <LibWeb/WebGL/WebGLRenderingContextBase.h>
-#include <LibWeb/WebXR/XRWebGLLayer.h>
-
-namespace Web::WebXR {
-
-GC_DEFINE_ALLOCATOR(XRWebGLLayer);
-
-XRWebGLLayer::XRWebGLLayer()
- : XRLayer()
-{
-}
-
-GC::Ref<XRWebGLLayer> XRWebGLLayer::create()
-{
- return GC::Heap::the().allocate<XRWebGLLayer>();
-}
-
-// https://immersive-web.github.io/webxr/#dom-xrwebgllayer-xrwebgllayer
-WebIDL::ExceptionOr<GC::Ref<XRWebGLLayer>> XRWebGLLayer::create(XRSession const& session, XRWebGLRenderingContext const& context, XRWebGLLayerInit const& layer_init)
-{
- // 1. Let layer be a new XRWebGLLayer in the relevant realm of session.
- auto layer = create();
-
- // 2. If session’s ended value is true, throw an InvalidStateError and abort these steps.
- if (session.ended())
- return WebIDL::InvalidStateError::create("The XRSession has ended."_utf16);
-
- // 3. If context is lost, throw an InvalidStateError and abort these steps.
- auto* contextBase = context.visit([](auto p) { return static_cast<WebGL::WebGLRenderingContextBase*>(&*p); });
- if (contextBase->is_context_lost())
- return WebIDL::InvalidStateError::create("The context has been lost."_utf16);
-
- // 4. If session is an immersive session and context’s XR compatible boolean is false, throw an InvalidStateError
- // and abort these steps.
- if (session.is_immersive() && !contextBase->xr_compatible())
- return WebIDL::InvalidStateError::create("The XRSession is an immersive one, but the context is not XR-compatible."_utf16);
-
- // FIXME: Implement all of these.
- (void)layer_init;
- // 5. Initialize layer’s context to context.
- // 6. Initialize layer’s session to session.
- // 7. Initialize layer’s ignoreDepthValues as follows:
- // 8. Initialize layer’s composition enabled boolean as follows:
- // -> If session is an inline session:
- // Initialize layer’s composition enabled to false.
- // -> Otherwise:
- // Initialize layer’s composition enabled boolean to true.
- // 9.-> If layer’s composition enabled boolean is true:
- // 1. Initialize layer’s antialias to layerInit’s antialias value.
- // 2. Let scaleFactor be layerInit’s framebufferScaleFactor.
- // 3. The user agent MAY choose to clamp or round scaleFactor as it sees fit here, for example if it wishes to fit
- // the buffer dimensions into a power of two for performance reasons.
- // 4. Let framebufferSize be the recommended WebGL framebuffer resolution with width and height separately
- // multiplied by scaleFactor.
- // 5. Initialize layer’s framebuffer to a new WebGLFramebuffer in the relevant realm of context, which is an opaque
- // framebuffer with the dimensions framebufferSize created with context, session initialized to session, and
- // layerInit’s depth, stencil, and alpha values.
- // 6. Allocate and initialize resources compatible with session’s XR device, including GPU accessible memory
- // buffers, as required to support the compositing of layer.
- // 7. If layer’s resources were unable to be created for any reason, throw an OperationError and abort these steps.
- // Otherwise:
- // 1. Initialize layer’s antialias to layer’s context’s actual context parameters antialias value.
- // 2. Initialize layer’s framebuffer to null.
-
- return layer;
-}
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRWebGLLayer.h b/Libraries/LibWeb/WebXR/XRWebGLLayer.h
deleted file mode 100644
index eacdfdad358..00000000000
--- a/Libraries/LibWeb/WebXR/XRWebGLLayer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 2025, Psychpsyo <[email protected]>
- *
- * SPDX-License-Identifier: BSD-2-Clause
- */
-
-#pragma once
-
-#include <LibWeb/Bindings/XRWebGLLayer.h>
-#include <LibWeb/DOM/Event.h>
-#include <LibWeb/WebXR/XRLayer.h>
-#include <LibWeb/WebXR/XRSession.h>
-
-namespace Web::WebXR {
-
-using XRWebGLLayerInit = Bindings::XRWebGLLayerInit;
-
-// https://www.w3.org/TR/webxr/#xrwebgllayer-interface
-class XRWebGLLayer : public XRLayer {
- WEB_WRAPPABLE(XRWebGLLayer, XRLayer);
- GC_DECLARE_ALLOCATOR(XRWebGLLayer);
-
-public:
- using XRWebGLRenderingContext = Variant<GC::Ref<WebGL::WebGLRenderingContext>, GC::Ref<WebGL::WebGL2RenderingContext>>;
-
- [[nodiscard]] static GC::Ref<XRWebGLLayer> create();
- static WebIDL::ExceptionOr<GC::Ref<XRWebGLLayer>> create(XRSession const& session, XRWebGLRenderingContext const&, XRWebGLLayerInit const&);
-
-private:
- XRWebGLLayer();
-};
-
-}
diff --git a/Libraries/LibWeb/WebXR/XRWebGLLayer.idl b/Libraries/LibWeb/WebXR/XRWebGLLayer.idl
deleted file mode 100644
index a21a66493be..00000000000
--- a/Libraries/LibWeb/WebXR/XRWebGLLayer.idl
+++ /dev/null
@@ -1,34 +0,0 @@
-// https://immersive-web.github.io/webxr/#xrwebgllayer-interface
-
-typedef (WebGLRenderingContext or
- WebGL2RenderingContext) XRWebGLRenderingContext;
-
-[Experimental] dictionary XRWebGLLayerInit {
- boolean antialias = true;
- boolean depth = true;
- boolean stencil = false;
- boolean alpha = true;
- boolean ignoreDepthValues = false;
- double framebufferScaleFactor = 1.0;
-};
-
-[Experimental, SecureContext, Exposed=Window]
-interface XRWebGLLayer: XRLayer {
- constructor(XRSession session,
- XRWebGLRenderingContext context,
- optional XRWebGLLayerInit layerInit = {});
- // Attributes
- [FIXME] readonly attribute boolean antialias;
- [FIXME] readonly attribute boolean ignoreDepthValues;
- [FIXME] attribute float? fixedFoveation;
-
- [FIXME, SameObject] readonly attribute WebGLFramebuffer? framebuffer;
- [FIXME] readonly attribute unsigned long framebufferWidth;
- [FIXME] readonly attribute unsigned long framebufferHeight;
-
- // Methods
- [FIXME] XRViewport? getViewport(XRView view);
-
- // Static Methods
- [FIXME] static double getNativeFramebufferScaleFactor(XRSession session);
-};
diff --git a/Libraries/LibWeb/idl_files.cmake b/Libraries/LibWeb/idl_files.cmake
index eb7bd5abecf..c149f0c0d26 100644
--- a/Libraries/LibWeb/idl_files.cmake
+++ b/Libraries/LibWeb/idl_files.cmake
@@ -407,12 +407,10 @@ libweb_js_bindings(IndexedDB/IDBRecord)
libweb_js_bindings(IndexedDB/IDBRequest)
libweb_js_bindings(IndexedDB/IDBTransaction)
libweb_js_bindings(IndexedDB/IDBVersionChangeEvent)
-libweb_js_bindings(Internals/FakeXRDevice)
libweb_js_bindings(Internals/InternalAnimationTimeline)
libweb_js_bindings(Internals/InternalGamepad)
libweb_js_bindings(Internals/Internals)
libweb_js_bindings(Internals/WebUI)
-libweb_js_bindings(Internals/XRTest)
libweb_js_bindings(IntersectionObserver/IntersectionObserver)
libweb_js_bindings(IntersectionObserver/IntersectionObserverEntry)
libweb_js_bindings(LargestContentfulPaint/LargestContentfulPaint)
@@ -744,12 +742,6 @@ libweb_js_bindings(WebRTC/SFrameTransformErrorEvent)
libweb_js_bindings(WebSockets/WebSocket)
libweb_js_bindings(WebVTT/VTTCue)
libweb_js_bindings(WebVTT/VTTRegion)
-libweb_js_bindings(WebXR/XRLayer)
-libweb_js_bindings(WebXR/XRRenderState)
-libweb_js_bindings(WebXR/XRSession)
-libweb_js_bindings(WebXR/XRSessionEvent)
-libweb_js_bindings(WebXR/XRSystem)
-libweb_js_bindings(WebXR/XRWebGLLayer)
libweb_js_bindings(XHR/FormData)
libweb_js_bindings(XHR/ProgressEvent)
libweb_js_bindings(XHR/XMLHttpRequest)
diff --git a/Meta/Linters/check_libweb_realm_mentions.py b/Meta/Linters/check_libweb_realm_mentions.py
index b7bf776aee9..a52364d8dcf 100755
--- a/Meta/Linters/check_libweb_realm_mentions.py
+++ b/Meta/Linters/check_libweb_realm_mentions.py
@@ -67,7 +67,7 @@ ALLOWED_REALM_MENTIONS = {
"the C++ glue of the Rust IndexedDB creates the factory in a global's realm and wraps values in a given realm",
),
"Infra": (2, 13, "JSON parse/serialization helpers still expose JS values in selected realms"),
- "Internals": (3, 3, "test-only internals still expose JS-facing helper objects and promises"),
+ "Internals": (1, 1, "test-only internals still expose JS-facing helper objects and promises"),
"SVG": (2, 8, "SVG length objects still store/use realms for detached/reflected JS/CSS materialization"),
"ServiceWorker": (
6,
@@ -89,7 +89,7 @@ ALLOWED_REALM_MENTIONS = {
"WebAudio buffers, AudioParamMap, and AudioWorklet APIs still materialize JS buffers and callback/promise values in selected realms",
),
"WebDriver": (2, 7, "WebDriver execute/JSON conversion still materializes JS values for automation"),
- "WebGL": (4, 9, "WebGL contexts are created in the realm of their canvas, and their events and promises in it"),
+ "WebGL": (4, 8, "WebGL contexts are created in the realm of their canvas, and their events in it"),
"WebLocks": (6, 7, "Web Locks queue/callback algorithms still use callback and promise realms"),
"WebRTC": (
13,
diff --git a/Tests/LibWeb/Text/expected/Navigator-xr-receiver-realm.txt b/Tests/LibWeb/Text/expected/Navigator-xr-receiver-realm.txt
deleted file mode 100644
index c5650c1bf6f..00000000000
--- a/Tests/LibWeb/Text/expected/Navigator-xr-receiver-realm.txt
+++ /dev/null
@@ -1,4 +0,0 @@
-navigator.xr is iframe realm: false
-navigator.xr is parent realm: true
-navigator.xr same object: true
-navigator.xr has test helper: object
diff --git a/Tests/LibWeb/Text/expected/all-window-properties.txt b/Tests/LibWeb/Text/expected/all-window-properties.txt
index dfd1dd3d8cc..32852dbd263 100644
--- a/Tests/LibWeb/Text/expected/all-window-properties.txt
+++ b/Tests/LibWeb/Text/expected/all-window-properties.txt
@@ -661,12 +661,6 @@ XMLSerializer
XPathEvaluator
XPathExpression
XPathResult
-XRLayer
-XRRenderState
-XRSession
-XRSessionEvent
-XRSystem
-XRWebGLLayer
__describeNodeOfInputHook
__describeScrollerOfInputHook
__finishTest
diff --git a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.txt b/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.txt
deleted file mode 100644
index 35eba9f7f66..00000000000
--- a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Harness status: OK
-
-Found 1 tests
-
-1 Pass
-Pass isSessionSupported resolves to false when options not supported
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.txt b/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.txt
deleted file mode 100644
index c7daba14202..00000000000
--- a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.txt
+++ /dev/null
@@ -1,6 +0,0 @@
-Harness status: OK
-
-Found 1 tests
-
-1 Pass
-Pass isSessionSupported resolves to true when inline options supported
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrSession_end.https.txt b/Tests/LibWeb/Text/expected/wpt-import/webxr/xrSession_end.https.txt
deleted file mode 100644
index 0b3f065109a..00000000000
--- a/Tests/LibWeb/Text/expected/wpt-import/webxr/xrSession_end.https.txt
+++ /dev/null
@@ -1,10 +0,0 @@
-Harness status: OK
-
-Found 4 tests
-
-2 Pass
-2 Fail
-Fail end event fires when immersive session ends - webgl
-Fail end event fires when immersive session ends - webgl2
-Pass end event fires when non-immersive session ends - webgl
-Pass end event fires when non-immersive session ends - webgl2
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/Navigator-xr-receiver-realm.html b/Tests/LibWeb/Text/input/Navigator-xr-receiver-realm.html
deleted file mode 100644
index e99bb0e4353..00000000000
--- a/Tests/LibWeb/Text/input/Navigator-xr-receiver-realm.html
+++ /dev/null
@@ -1,17 +0,0 @@
-<!DOCTYPE html>
-<script src="include.js"></script>
-<script>
- test(() => {
- const iframe = document.createElement("iframe");
- document.body.append(iframe);
- const other = iframe.contentWindow;
-
- const xrGetter = Object.getOwnPropertyDescriptor(other.Navigator.prototype, "xr").get;
- const xr = xrGetter.call(navigator);
-
- println(`navigator.xr is iframe realm: ${xr instanceof other.XRSystem}`);
- println(`navigator.xr is parent realm: ${xr instanceof XRSystem}`);
- println(`navigator.xr same object: ${xr === navigator.xr}`);
- println(`navigator.xr has test helper: ${typeof xr.test}`);
- });
-</script>
diff --git a/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_test_constants.js b/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_test_constants.js
deleted file mode 100644
index c08cdd9b251..00000000000
--- a/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_test_constants.js
+++ /dev/null
@@ -1,226 +0,0 @@
-// assert_equals can fail when comparing floats due to precision errors, so
-// use assert_approx_equals with this constant instead
-const FLOAT_EPSILON = 0.001;
-
-// Identity matrix
-const IDENTITY_MATRIX = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1];
-
-const IDENTITY_TRANSFORM = {
- position: [0, 0, 0],
- orientation: [0, 0, 0, 1],
-};
-
-// A valid pose matrix/transform for when we don't care about specific values
-// Note that these two should be identical, just different representations
-const VALID_POSE_MATRIX = [0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 0, 0, 0,
- 1, 1, 1, 1];
-
-const VALID_POSE_TRANSFORM = {
- position: [1, 1, 1],
- orientation: [0.5, 0.5, 0.5, 0.5]
-};
-
-const VALID_PROJECTION_MATRIX = [
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 3, 2, -1, -1,
- 0, 0, -0.2, 0
-];
-
-// This is a decomposed version of the above.
-const VALID_FIELD_OF_VIEW = {
- upDegrees: 71.565,
- downDegrees: -45,
- leftDegrees:-63.4349,
- rightDegrees: 75.9637
-};
-
-// This is roughly equivalent to the above, but with a different near plane.
-// The fact that it's the same isn't too concerning, since to be the same
-// ViewGeometry it'd also need the same offset.
-const VALID_DEPTH_PROJECTION_MATRIX = [
- 1, 0, 0, 0,
- 0, 1, 0, 0,
- 3, 2, -1, -1,
- 0, 0, -0.002, 0
-];
-
-// A valid input grip matrix for when we don't care about specific values
-const VALID_GRIP = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 4, 3, 2, 1];
-
-const VALID_GRIP_TRANSFORM = {
- position: [4, 3, 2],
- orientation: [0, 0, 0, 1]
-};
-
-// A valid input pointer offset for when we don't care about specific values
-const VALID_POINTER = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 1, 1];
-
-const VALID_POINTER_TRANSFORM = {
- position: [0, 0, 1],
- orientation: [0, 0, 0, 1]
-};
-
-// A Valid Local to floor matrix/transform for when we don't care about specific
-// values. Note that these should be identical, just different representations.
-const VALID_FLOOR_ORIGIN_MATRIX = [1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 1, 1.65, -1, 1];
-
-const VALID_FLOOR_ORIGIN = {
- position: [-1.0, -1.65, 1.0],
- orientation: [0, 0, 0, 1]
-};
-
-const VALID_BOUNDS = [
- { x: 3.0, z: -2.0 },
- { x: 3.5, z: 0.0 },
- { x: 3.0, z: 2.0 },
- { x: -3.0, z: 2.0 },
- { x: -3.5, z: 0.0 },
- { x: -3.0, z: -2.0 }
-];
-
-const VALID_RESOLUTION = {
- width: 200,
- height: 200
-};
-
-const LEFT_OFFSET = {
- position: [-0.1, 0, 0],
- orientation: [0, 0, 0, 1]
-};
-
-const RIGHT_OFFSET = {
- position: [0.1, 0, 0],
- orientation: [0, 0, 0, 1]
-};
-
-// Most depth tests at present are effectively monocular, so just ensure we
-// substantially overlap the left eye.
-const DEPTH_OFFSET = {
- position: [-0.1, 0.01, 0],
- orientation: [0, 0, 0, 1]
-};
-
-const FIRST_PERSON_OFFSET = {
- position: [0, 0.1, 0],
- orientation: [0, 0, 0, 1]
-};
-
-const VALID_VIEWS = [{
- eye:"left",
- projectionMatrix: VALID_PROJECTION_MATRIX,
- viewOffset: LEFT_OFFSET,
- resolution: VALID_RESOLUTION
- }, {
- eye:"right",
- projectionMatrix: VALID_PROJECTION_MATRIX,
- viewOffset: RIGHT_OFFSET,
- resolution: VALID_RESOLUTION
- },
-];
-
-const VALID_SECONDARY_VIEWS = [{
- eye: "none",
- projectionMatrix: VALID_PROJECTION_MATRIX,
- viewOffset: FIRST_PERSON_OFFSET,
- resolution: VALID_RESOLUTION,
- isFirstPersonObserver: true
- }
-];
-
-const NON_IMMERSIVE_VIEWS = [{
- eye: "none",
- projectionMatrix: VALID_PROJECTION_MATRIX,
- viewOffset: IDENTITY_TRANSFORM,
- resolution: VALID_RESOLUTION,
- }
-];
-
-const ALL_FEATURES = [
- 'viewer',
- 'local',
- 'local-floor',
- 'bounded-floor',
- 'unbounded',
- 'hit-test',
- 'dom-overlay',
- 'light-estimation',
- 'anchors',
- 'depth-sensing',
- 'secondary-views',
- 'camera-access',
- 'layers'
-];
-
-const TRACKED_IMMERSIVE_DEVICE = {
- supportsImmersive: true,
- supportedModes: [ "inline", "immersive-vr"],
- views: VALID_VIEWS,
- secondaryViews: VALID_SECONDARY_VIEWS,
- viewerOrigin: IDENTITY_TRANSFORM,
- supportedFeatures: ALL_FEATURES,
- environmentBlendMode: "opaque",
- interactionMode: "world-space"
-};
-
-const IMMERSIVE_AR_DEVICE = {
- supportsImmersive: true,
- supportedModes: [ "inline", "immersive-ar"],
- views: VALID_VIEWS,
- viewerOrigin: IDENTITY_TRANSFORM,
- supportedFeatures: ALL_FEATURES,
- environmentBlendMode: "additive",
- interactionMode: "screen-space"
-};
-
-const VALID_NON_IMMERSIVE_DEVICE = {
- supportsImmersive: false,
- supportedModes: ["inline"],
- views: NON_IMMERSIVE_VIEWS,
- viewerOrigin: IDENTITY_TRANSFORM,
- supportedFeatures: ALL_FEATURES,
- environmentBlendMode: "opaque",
- interactionMode: "screen-space"
-};
-
-const VALID_CONTROLLER = {
- handedness: "none",
- targetRayMode: "tracked-pointer",
- pointerOrigin: VALID_POINTER_TRANSFORM,
- profiles: []
-};
-
-const RIGHT_CONTROLLER = {
- handedness: "right",
- targetRayMode: "tracked-pointer",
- pointerOrigin: VALID_POINTER_TRANSFORM,
- profiles: []
-};
-
-const SCREEN_CONTROLLER = {
- handedness: "none",
- targetRayMode: "screen",
- pointerOrigin: VALID_POINTER_TRANSFORM,
- profiles: []
-};
-
-// From: https://immersive-web.github.io/webxr/#default-features
-const DEFAULT_FEATURES = {
- "inline": ["viewer"],
- "immersive-vr": ["viewer", "local"],
- "immersive-ar": ["viewer", "local"],
-};
diff --git a/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_util.js b/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_util.js
deleted file mode 100644
index ab8f7c80c31..00000000000
--- a/Tests/LibWeb/Text/input/wpt-import/webxr/resources/webxr_util.js
+++ /dev/null
@@ -1,248 +0,0 @@
-'use strict';
-
-// These tests rely on the User Agent providing an implementation of the
-// WebXR Testing API (https://github.com/immersive-web/webxr-test-api).
-//
-// In Chromium-based browsers, this implementation is provided by a JavaScript
-// shim in order to reduce the amount of test-only code shipped to users. To
-// enable these tests the browser must be run with these options:
-//
-// --enable-blink-features=MojoJS,MojoJSTest
-
-// Debugging message helper, by default does nothing. Implementations can
-// override this.
-var xr_debug = function(name, msg) {};
-
-let loaded = new Promise(resolve => document.addEventListener('DOMContentLoaded', resolve));
-
-function xr_promise_test(name, func, properties, glContextType, glContextProperties) {
- promise_test(async (t) => {
- if (glContextType === 'webgl2') {
- // Fast fail on platforms not supporting WebGL2.
- assert_implements('WebGL2RenderingContext' in window, 'webgl2 not supported.');
- }
- // Perform any required test setup:
- xr_debug(name, 'setup');
-
- assert_implements(navigator.xr, 'missing navigator.xr - ensure test is run in a secure context.');
-
- // Only set up once.
- if (!navigator.xr.test) {
-
- if (typeof isChromiumBased === 'undefined' || typeof isWebKitBased === 'undefined') {
- // Load test-only API helpers.
- const script = document.createElement('script');
- script.src = '/resources/test-only-api.js';
- script.async = false;
- const p = new Promise((resolve, reject) => {
- script.onload = () => { resolve(); };
- script.onerror = e => { reject(e); };
- });
- document.head.appendChild(script);
- await p;
- }
-
- if (isChromiumBased) {
- // Chrome setup
- await loadChromiumResources();
- } else if (isWebKitBased) {
- // WebKit setup
- await setupWebKitWebXRTestAPI();
- }
- }
-
- // Either the test api needs to be polyfilled and it's not set up above, or
- // something happened to one of the known polyfills and it failed to be
- // setup properly. Either way, the fact that xr_promise_test is being used
- // means that the tests expect navigator.xr.test to be set. By rejecting now
- // we can hopefully provide a clearer indication of what went wrong.
- assert_implements(navigator.xr.test, 'missing navigator.xr.test, even after attempted load');
-
- let gl = null;
- let canvas = null;
- if (glContextType) {
- canvas = document.createElement('canvas');
- await loaded;
- document.body.appendChild(canvas);
- gl = canvas.getContext(glContextType, glContextProperties);
- }
-
- // Ensure that any devices are disconnected when done. If this were done in
- // a .then() for the success case, a test that expected failure would
- // already be marked done at the time that runs and the shutdown would
- // interfere with the next test.
- t.add_cleanup(async () => {
- // Ensure system state is cleaned up.
- xr_debug(name, 'cleanup');
- await navigator.xr.test.disconnectAllDevices();
- });
-
- xr_debug(name, 'main');
- return func(t, gl);
- }, name, properties);
-}
-
-// A utility function for waiting one animation frame before running the callback
-//
-// This is only needed after calling FakeXRDevice methods outside of an animation frame
-//
-// This is so that we can paper over the potential race allowed by the "next animation frame"
-// concept https://immersive-web.github.io/webxr-test-api/#xrsession-next-animation-frame
-function requestSkipAnimationFrame(session, callback) {
- session.requestAnimationFrame(() => {
- session.requestAnimationFrame(callback);
- });
-}
-
-// A test function which runs through the common steps of requesting a session.
-// Calls the passed in test function with the session, the controller for the
-// device, and the test object.
-function xr_session_promise_test(
- name, func, fakeDeviceInit, sessionMode, sessionInit, properties,
- glcontextPropertiesParam, gllayerPropertiesParam) {
- const glcontextProperties = (glcontextPropertiesParam) ? glcontextPropertiesParam : {};
- const gllayerProperties = (gllayerPropertiesParam) ? gllayerPropertiesParam : {};
-
- function runTest(t, glContext) {
- let testSession;
- let testDeviceController;
- let sessionObjects = {gl: glContext};
-
- // Ensure that any pending sessions are ended when done. This needs to
- // use a cleanup function to ensure proper sequencing. If this were
- // done in a .then() for the success case, a test that expected
- // failure would already be marked done at the time that runs, and the
- // shutdown would interfere with the next test which may have started.
- t.add_cleanup(async () => {
- // If a session was created, end it.
- if (testSession) {
- await testSession.end().catch(() => {});
- }
- });
-
- return navigator.xr.test.simulateDeviceConnection(fakeDeviceInit)
- .then((controller) => {
- testDeviceController = controller;
- return sessionObjects.gl.makeXRCompatible();
- })
- .then(() => new Promise((resolve, reject) => {
- // Perform the session request in a user gesture.
- xr_debug(name, 'simulateUserActivation');
- navigator.xr.test.simulateUserActivation(() => {
- xr_debug(name, 'document.hasFocus()=' + document.hasFocus());
- navigator.xr.requestSession(sessionMode, sessionInit || {})
- .then((session) => {
- xr_debug(name, 'session start');
- testSession = session;
- session.mode = sessionMode;
- session.sessionInit = sessionInit;
- let glLayer = new XRWebGLLayer(session, sessionObjects.gl, gllayerProperties);
- glLayer.context = sessionObjects.gl;
- // Session must have a baseLayer or frame requests
- // will be ignored.
- session.updateRenderState({
- baseLayer: glLayer
- });
- sessionObjects.glLayer = glLayer;
- xr_debug(name, 'session.visibilityState=' + session.visibilityState);
- try {
- resolve(func(session, testDeviceController, t, sessionObjects));
- } catch(err) {
- reject("Test function failed with: " + err);
- }
- })
- .catch((err) => {
- xr_debug(name, 'error: ' + err);
- reject(
- 'Session with params ' +
- JSON.stringify(sessionMode) +
- ' was rejected on device ' +
- JSON.stringify(fakeDeviceInit) +
- ' with error: ' + err);
- });
- });
- }));
- }
-
- xr_promise_test(
- name + ' - webgl',
- runTest,
- properties,
- 'webgl',
- {alpha: false, antialias: false, ...glcontextProperties}
- );
- xr_promise_test(
- name + ' - webgl2',
- runTest,
- properties,
- 'webgl2',
- {alpha: false, antialias: false, ...glcontextProperties}
- );
-}
-
-
-// This function wraps the provided function in a
-// simulateUserActivation() call, and resolves the promise with the
-// result of func(), or an error if one is thrown
-function promise_simulate_user_activation(func) {
- return new Promise((resolve, reject) => {
- navigator.xr.test.simulateUserActivation(() => {
- try { let a = func(); resolve(a); } catch(e) { reject(e); }
- });
- });
-}
-
-// This functions calls a callback with each API object as specified
-// by https://immersive-web.github.io/webxr/spec/latest/, allowing
-// checks to be made on all ojects.
-// Arguements:
-// callback: A callback function with two arguements, the first
-// being the API object, the second being the name of
-// that API object.
-function forEachWebxrObject(callback) {
- callback(window.navigator.xr, 'navigator.xr');
- callback(window.XRSession, 'XRSession');
- callback(window.XRSessionCreationOptions, 'XRSessionCreationOptions');
- callback(window.XRFrameRequestCallback, 'XRFrameRequestCallback');
- callback(window.XRPresentationContext, 'XRPresentationContext');
- callback(window.XRFrame, 'XRFrame');
- callback(window.XRLayer, 'XRLayer');
- callback(window.XRView, 'XRView');
- callback(window.XRViewport, 'XRViewport');
- callback(window.XRViewerPose, 'XRViewerPose');
- callback(window.XRWebGLLayer, 'XRWebGLLayer');
- callback(window.XRWebGLLayerInit, 'XRWebGLLayerInit');
- callback(window.XRCoordinateSystem, 'XRCoordinateSystem');
- callback(window.XRFrameOfReference, 'XRFrameOfReference');
- callback(window.XRStageBounds, 'XRStageBounds');
- callback(window.XRSessionEvent, 'XRSessionEvent');
- callback(window.XRCoordinateSystemEvent, 'XRCoordinateSystemEvent');
-}
-
-// Code for loading test API in Chromium.
-async function loadChromiumResources() {
- await loadScript('/resources/chromium/webxr-test-math-helper.js');
- await import('/resources/chromium/webxr-test.js');
- await loadScript('/resources/testdriver.js');
- await loadScript('/resources/testdriver-vendor.js');
-
- // This infrastructure is also used by Chromium-specific internal tests that
- // may need additional resources (e.g. internal API extensions), this allows
- // those tests to rely on this infrastructure while ensuring that no tests
- // make it into public WPTs that rely on APIs outside of the webxr test API.
- if (typeof(additionalChromiumResources) !== 'undefined') {
- for (const path of additionalChromiumResources) {
- await loadScript(path);
- }
- }
-
- xr_debug = navigator.xr.test.Debug;
-}
-
-function setupWebKitWebXRTestAPI() {
- // WebKit setup. The internals object is used by the WebKit test runner
- // to provide JS access to internal APIs. In this case it's used to
- // ensure that XRTest is only exposed to wpt tests.
- navigator.xr.test = internals.xrTest;
- return Promise.resolve();
-}
diff --git a/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.html b/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.html
deleted file mode 100644
index 466bd10cd9e..00000000000
--- a/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_immersive_unsupported.https.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!DOCTYPE html>
-<body>
- <script src=../resources/testharness.js></script>
- <script src=../resources/testharnessreport.js></script>
- <script src="resources/webxr_util.js"></script>
- <script src="resources/webxr_test_constants.js"></script>
- <script>
- xr_promise_test(
- "isSessionSupported resolves to false when options not supported",
- (t) => {
- return navigator.xr.test.simulateDeviceConnection(VALID_NON_IMMERSIVE_DEVICE)
- .then( (controller) => {
- return navigator.xr.isSessionSupported('immersive-vr').then((supported) => {
- t.step(() => {
- assert_false(supported);
- });
- });
- });
- });
- </script>
-</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.html b/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.html
deleted file mode 100644
index 0f04ef75be0..00000000000
--- a/Tests/LibWeb/Text/input/wpt-import/webxr/xrDevice_isSessionSupported_inline.https.html
+++ /dev/null
@@ -1,22 +0,0 @@
-<!DOCTYPE html>
-<body>
- <script src=../resources/testharness.js></script>
- <script src=../resources/testharnessreport.js></script>
- <script src="resources/webxr_util.js"></script>
- <script src="resources/webxr_test_constants.js"></script>
- <script>
- xr_promise_test(
- "isSessionSupported resolves to true when inline options supported",
- (t) => {
- return navigator.xr.test.simulateDeviceConnection(TRACKED_IMMERSIVE_DEVICE)
- .then( (controller) => {
- // Inline sessions should be supported.
- return navigator.xr.isSessionSupported('inline').then((supported) => {
- t.step(() => {
- assert_true(supported);
- });
- });
- });
- });
- </script>
-</body>
diff --git a/Tests/LibWeb/Text/input/wpt-import/webxr/xrSession_end.https.html b/Tests/LibWeb/Text/input/wpt-import/webxr/xrSession_end.https.html
deleted file mode 100644
index f4e13b133b7..00000000000
--- a/Tests/LibWeb/Text/input/wpt-import/webxr/xrSession_end.https.html
+++ /dev/null
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<body>
- <script src=../resources/testharness.js></script>
- <script src=../resources/testharnessreport.js></script>
- <script src="resources/webxr_util.js"></script>
- <script src="resources/webxr_test_constants.js"></script>
-
- <script>
- const immersivetestName = "end event fires when immersive session ends";
- const nonimmersiveTestName = "end event fires when non-immersive session ends";
- let watcherDone = new Event("watcherdone");
- const fakeDeviceInitParams = TRACKED_IMMERSIVE_DEVICE;
-
- let testFunction = function(session, testDeviceController, t) {
- let eventWatcher = new EventWatcher(t, session, ["end", "watcherdone"]);
- let eventPromise = eventWatcher.wait_for(["end", "watcherdone"]);
-
- function onSessionEnd(event) {
- t.step( () => {
- assert_equals(event.session, session);
-
- let eventSession = event.session;
- assert_equals(eventSession, event.session,
- "XRSessionEvent.session returns the same object.");
-
- session.dispatchEvent(watcherDone);
- });
- }
- session.addEventListener("end", onSessionEnd, false);
- session.end();
-
- return eventPromise;
- };
-
- xr_session_promise_test(immersivetestName, testFunction,
- fakeDeviceInitParams, 'immersive-vr');
- xr_session_promise_test(nonimmersiveTestName, testFunction,
- fakeDeviceInitParams, 'inline');
- </script>
-</body>