Skip to content

Commit 4809b72

Browse files
alcooper91chromium-wpt-export-bot
authored andcommitted
[WebXR] Detect all frame owners in DOM Overlay
ProcessOverlayHitTest downcasts the hit element to HTMLFrameElementBase to decide whether to walk the content frame subtree for cross-origin content. That base class only covers <iframe> and <frame>; content embedded via <object>, <embed>, or <fencedframe> owns a content frame through HTMLFrameOwnerElement instead, so the cast returned null and the cross-origin check was skipped. Cast to HTMLFrameOwnerElement instead so every frame-owning element is subject to the same origin check. Extend the ar_dom_overlay WPT with an <object> variant of the existing cross-origin iframe test. TAG=agy Fixed: 524418836 Change-Id: I43830c7a669820dbb56c3a1792d9f7c6813d1c1e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8120459 Reviewed-by: Brian Sheedy <bsheedy@chromium.org> Commit-Queue: Alexander Cooper <alcooper@chromium.org> Cr-Commit-Position: refs/heads/main@{#1665189}
1 parent fdd9d8b commit 4809b72

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

webxr/dom-overlay/ar_dom_overlay.https.html

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
min-width: 10px;
1212
min-height: 10px;
1313
}
14-
iframe {
14+
iframe, object {
1515
border: 0;
1616
width: 20px;
1717
height: 20px;
@@ -25,6 +25,9 @@
2525
<!-- This SVG iframe is treated as cross-origin content. -->
2626
<iframe id="iframe" src='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="20" width="20" fill="red" fill-opacity="0.3"/></svg>'>
2727
</iframe>
28+
<!-- This SVG object is treated as cross-origin content. -->
29+
<object id="object" data='data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"><rect height="20" width="20" fill="blue" fill-opacity="0.3"/></svg>' type="image/svg+xml">
30+
</object>
2831
<canvas>
2932
</canvas>
3033
</div>
@@ -175,11 +178,11 @@
175178
return eventPromise;
176179
};
177180

178-
let testCrossOriginContent = function(overlayElement, session, fakeDeviceController, t) {
181+
let testCrossOriginContent = function(elementId, overlayElement, session, fakeDeviceController, t) {
179182
let debug = xr_debug.bind(this, 'testCrossOriginContent');
180183

181-
let iframe = document.getElementById('iframe');
182-
assert_true(iframe != null);
184+
let element = document.getElementById(elementId);
185+
assert_true(element != null);
183186
let inner_b = document.getElementById('inner_b');
184187
assert_true(inner_b != null);
185188

@@ -198,8 +201,8 @@
198201
// Press the primary input button and then release it a short time later.
199202
requestSkipAnimationFrame(session, (time, xrFrame) => {
200203
debug('got rAF 1');
201-
input_source.setOverlayPointerPosition(iframe.offsetLeft + 1,
202-
iframe.offsetTop + 1);
204+
input_source.setOverlayPointerPosition(element.offsetLeft + 1,
205+
element.offsetTop + 1);
203206
input_source.startSelection();
204207

205208
session.requestAnimationFrame((time, xrFrame) => {
@@ -289,7 +292,15 @@
289292

290293
xr_session_promise_test(
291294
"Ensures DOM Overlay interactions on cross origin iframe are ignored",
292-
testCrossOriginContent.bind(this, document.getElementById('div_overlay')),
295+
testCrossOriginContent.bind(this, 'iframe', document.getElementById('div_overlay')),
296+
fakeDeviceInitParams, 'immersive-ar', {
297+
requiredFeatures: ['dom-overlay'],
298+
domOverlay: { root: document.getElementById('div_overlay') }
299+
});
300+
301+
xr_session_promise_test(
302+
"Ensures DOM Overlay interactions on cross origin object are ignored",
303+
testCrossOriginContent.bind(this, 'object', document.getElementById('div_overlay')),
293304
fakeDeviceInitParams, 'immersive-ar', {
294305
requiredFeatures: ['dom-overlay'],
295306
domOverlay: { root: document.getElementById('div_overlay') }

0 commit comments

Comments
 (0)