From 9ecf9965fae4c5df953794671a2ec2e328eed877 Mon Sep 17 00:00:00 2001 From: Oriol Brufau Date: Fri, 18 Mar 2022 10:26:59 +0000 Subject: [PATCH] Bug 1756255 [wpt PR 32911] - [inert] Stop propagating inertness into nested browsing contexts, a=testonly Automatic update from web-platform-tests [inert] Stop propagating inertness into nested browsing contexts Doing so was a cross-site leak. This change is against the HTML spec, but it aligns Blink with Gecko. WebKit is also not propagating inertness for the selection API, but it does for focusability. I already changed the spec https://github.com/whatwg/html/issues/7605 and updated WPT in https://github.com/web-platform-tests/wpt/pull/32817. Note this only affects the webexposed behavior. The accessibility tree still considers the contents of an inert frame to be inert, as tested by All/DumpAccessibilityTreeTestWithIgnoredNodes.AccessibilityModalDialogAndIframes/* Therefore Frame::is_inert_ and related flags are kept for accessibility, but they will no longer effect ComputedStyle::IsInert(). Also note that even if the contents in the nested browsing contexts are not marked as inert, if the browsing context container is inert, they won't respond to mouse interactions, and they won't be reached by sequential navigation. Bug: 1293191 TEST=All/DumpAccessibilityTreeTestWithIgnoredNodes.InertAttribute/* TEST=All/SitePerProcessBrowserTest.CrossProcessInertSubframe/* TEST=All/SitePerProcessBrowserTest.CrossProcessIsInertPropagation/* TEST=third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html TEST=third_party/blink/web_tests/external/wpt/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html TEST=third_party/blink/web_tests/fast/dom/inert/inert-focus-in-frames.html AX-Relnotes: n/a. Change-Id: I70820d2aeca98e1c4036bd3f8c41ef0129a97a63 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3302103 Reviewed-by: Aaron Leventhal Reviewed-by: Mason Freed Reviewed-by: Arthur Sonzogni Commit-Queue: Oriol Brufau Cr-Commit-Position: refs/heads/main@{#973015} -- wpt-commits: 9c81c01ec17341400c56462171bcec4ae17f0bb2 wpt-pr: 32911 --- .../inert-focus-in-frames.html | 8 +++++-- ...rtness-with-modal-dialogs-and-iframes.html | 21 +++++++++---------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html index 12fa96abc2d03..2ccc13328572c 100644 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inert-focus-in-frames.html @@ -37,7 +37,11 @@ let focusedElement = null; element.addEventListener('focus', function() { focusedElement = element; }, false); element.focus(); - assert_equals(focusedElement === element, expectFocus, element.id); + if (expectFocus) { + assert_equals(focusedElement, element, element.id); + } else { + assert_not_equals(focusedElement, element, element.id); + } } // Opening a modal dialog in frame1. It blocks other nodes in its document. @@ -46,7 +50,7 @@ testFocus(frame1.querySelector('.target'), false); const iframe = frame1.querySelector('#iframe1').contentDocument; - testFocus(iframe.querySelector('.target'), false); + testFocus(iframe.querySelector('.target'), true); // Even a modal dialog in the iframe is blocked by the modal dialog in the parent frame1. iframe.querySelector('dialog').showModal(); diff --git a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html index ea7d46f98db86..1a509f7f36579 100644 --- a/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html +++ b/testing/web-platform/tests/html/semantics/interactive-elements/the-dialog-element/inertness-with-modal-dialogs-and-iframes.html @@ -4,9 +4,8 @@ + but only in its document, not in the parent browsing context, + nor in nested browsing contexts.">
(main document: outer text) @@ -103,30 +102,30 @@ checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: outer text)(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialog in the main document marks outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: outer text)(outer iframe: dialog)"); +}, "Modal dialog in the main document marks outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [innerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and inner iframe mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: outer text)(outer iframe: dialog)"); +}, "Modal dialogs in the main document and inner iframe mark outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [outerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: outer text)(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and outer iframe mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: dialog)"); +}, "Modal dialogs in the main document and outer iframe mark outer nodes as inert. Contents of the outer iframe aren't marked as inert."); promise_test(async function() { showModals(this, [innerIframeWindow, outerIframeWindow, window]); checkSelection(window, "(main document: dialog)"); checkSelection(innerIframeWindow, "(inner iframe: dialog)"); - checkSelection(outerIframeWindow, ""); -}, "Modal dialogs in the main document and both iframes mark outer nodes as inert. All contents of the outer iframe are also marked as inert."); + checkSelection(outerIframeWindow, "(outer iframe: dialog)"); +}, "Modal dialogs in the main document and both iframes mark outer nodes as inert. Contents of the outer iframe aren't marked as inert.");