Commit 5a985dce authored by Mustaq Ahmed's avatar Mustaq Ahmed Committed by Commit Bot

Fix the clicked iframe in two wpt fullscreen tests.

With User Activation v2, activating a parent frame doesn't activate
its subframes.  We fixed these two tests by sending the click to
subframes.  This needed a workaround in auto-click.js because
the mutation observer there in doesn't seem to work when a button
element is added to a subframe.

Bug: 802371
Change-Id: I786668c87b802565e99ad16223cafc8ac1fd6296
Reviewed-on: https://chromium-review.googlesource.com/868323Reviewed-by: default avatarNavid Zolghadr <nzolghadr@chromium.org>
Commit-Queue: Mustaq Ahmed <mustaq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#570778}
parent 4eaca7ca
...@@ -37,6 +37,6 @@ async_test(t => { ...@@ -37,6 +37,6 @@ async_test(t => {
document.onfullscreenerror = t.unreached_func('fullscreenerror event'); document.onfullscreenerror = t.unreached_func('fullscreenerror event');
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event'); iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
trusted_request(t, iframeBody, document.body); trusted_request(t, iframeBody, iframeBody);
}); });
</script> </script>
...@@ -10,7 +10,7 @@ async_test(t => { ...@@ -10,7 +10,7 @@ async_test(t => {
const iframeDoc = iframe.contentDocument; const iframeDoc = iframe.contentDocument;
// Enter fullscreen for the iframe's body element. // Enter fullscreen for the iframe's body element.
trusted_request(t, iframeDoc.body, document.body); trusted_request(t, iframeDoc.body, iframeDoc.body);
document.onfullscreenchange = t.step_func(() => { document.onfullscreenchange = t.step_func(() => {
assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element"); assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element");
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element"); assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element");
......
...@@ -40,10 +40,19 @@ function observe(target) { ...@@ -40,10 +40,19 @@ function observe(target) {
observer.observe(target, { childList: true, subtree: true }); observer.observe(target, { childList: true, subtree: true });
} }
// Handle what's already in the document. // Handle what's already in the document and subframes.
for (const button of document.getElementsByTagName('button')) { for (const button of document.getElementsByTagName('button')) {
click(button); click(button);
} }
for (const iframe of document.getElementsByTagName('iframe')) {
if (!iframe.contentDocument)
continue;
for (const button of iframe.contentDocument.getElementsByTagName('button'))
click(button);
}
// Observe future changes in the document and subframes.
observe(document);
for (const iframe of document.getElementsByTagName('iframe')) { for (const iframe of document.getElementsByTagName('iframe')) {
if (iframe.contentDocument) if (iframe.contentDocument)
observe(iframe.contentDocument); observe(iframe.contentDocument);
...@@ -53,7 +62,4 @@ for (const iframe of document.getElementsByTagName('iframe')) { ...@@ -53,7 +62,4 @@ for (const iframe of document.getElementsByTagName('iframe')) {
}); });
} }
// Observe future changes.
observe(document);
})(); })();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment