Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reenable feature policy control over fullscreen
This CL also changes test expectations to bring the fullscreen tests in line with the new behaviour prescribed by Feature Policy. Specifically: - Same origin iframes by default have the same ability to use fullscreen as their parent frame. Tests which previously only used same-origin frame have been changed to verify the new behaviour, and new tests in LayoutTests/http/tests have been added to test the same situation with cross-origin frames. - Dynamic modification of the allowfullscreen flag has no effect until the iframe contents are navigated/reloaded. - Web platform tests are marked as failing, and should remain so until the fullscreen spec is updated fo include the new behaviour. - A new Browser test class is created which explicitly disables feature policy so that we don't lose coverage for the old behaviour when FP is disabled. BUG=718155,623682 Review-Url: https://codereview.chromium.org/2898503002 Cr-Commit-Position: refs/heads/master@{#495331}
- Loading branch information
1 parent
b4c1979
commit 3cc0d89
Showing
6 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
fullscreen/api/document-fullscreen-enabled-cross-origin.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<!DOCTYPE html> | ||
<title>Document#fullscreenEnabled</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<div id="log"></div> | ||
<iframe src="resources/report-fullscreen-enabled.html" name="same-origin-default"></iframe> | ||
<iframe src="resources/report-fullscreen-enabled.html" allowfullscreen name="same-origin-allow"></iframe> | ||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html" name="cross-origin-default"></iframe> | ||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/report-fullscreen-enabled.html" allowfullscreen name="cross-origin-allow"></iframe> | ||
<script> | ||
var expectations = { | ||
"same-origin-default": false, | ||
"same-origin-allow": true, | ||
"cross-origin-default": false, | ||
"cross-origin-allow": true | ||
}; | ||
|
||
var tests = {}; | ||
for (var name in expectations) { | ||
tests[name] = async_test( 'Fullscreen enabled test: ' + name); | ||
} | ||
|
||
// When a message is received from a child frame, ensure that the report | ||
// matches the expectations. | ||
window.addEventListener('message', e => { | ||
if (e.data.report && e.data.report.api == "fullscreen") { | ||
if (e.data.report.frame in expectations) { | ||
tests[e.data.report.frame].step(() => { | ||
assert_equals(e.data.report.enabled, expectations[e.data.report.frame], | ||
e.data.report.frame + " frame fullscreenEnabled"); | ||
}); | ||
delete expectations[e.data.report.frame]; | ||
tests[e.data.report.frame].done(); | ||
} | ||
} | ||
}); | ||
</script> |
30 changes: 30 additions & 0 deletions
30
fullscreen/api/element-ready-check-allowed-cross-origin-manual.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<!DOCTYPE html> | ||
<title>Element ready check with allowfullscreen attribute</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../trusted-click.js"></script> | ||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html" name="cross-origin-allowed" allowfullscreen></iframe> | ||
<script> | ||
|
||
async_test((t) => { | ||
t.add_cleanup(() => document.exitFullscreen()); | ||
|
||
// When a message is received from a child frame, ensure that the report | ||
// matches the expectations. | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.data.report && e.data.report.api == "fullscreen") { | ||
assert_equals(e.data.report.result, true, | ||
e.data.report.frame + " frame did enter fullscreen"); | ||
t.done(); | ||
} | ||
})); | ||
|
||
// Trigger the child frame to report as soon as its content is loaded. | ||
var elem = document.querySelector('iframe'); | ||
elem.addEventListener('load', () => { | ||
trusted_click(t, () => { | ||
elem.contentWindow.postMessage({"action": "report"}, "*"); | ||
}, document.body); | ||
}); | ||
}); | ||
</script> |
31 changes: 31 additions & 0 deletions
31
fullscreen/api/element-ready-check-not-allowed-cross-origin-manual.sub.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<!DOCTYPE html> | ||
<title>Element ready check with no allowfullscreen attribute</title> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="../trusted-click.js"></script> | ||
<iframe src="http://{{domains[www1]}}:{{ports[http][0]}}/fullscreen/api/resources/attempt-fullscreen.html" name="cross-origin-default"></iframe> | ||
<script> | ||
|
||
async_test((t) => { | ||
document.onfullscreenchange = t.unreached_func("document fullscreenchange event"); | ||
document.onfullscreenerror = t.unreached_func("document fullscreenerror event"); | ||
|
||
// When a message is received from a child frame, ensure that the report | ||
// matches the expectations. | ||
window.addEventListener('message', t.step_func(e => { | ||
if (e.data.report && e.data.report.api == "fullscreen") { | ||
assert_equals(e.data.report.result, false, | ||
e.data.report.frame + " frame did enter fullscreen"); | ||
t.done(); | ||
} | ||
})); | ||
|
||
// Trigger the child frame to report as soon as its content is loaded. | ||
var elem = document.querySelector('iframe'); | ||
elem.addEventListener('load', () => { | ||
trusted_click(t, () => { | ||
elem.contentWindow.postMessage({"action": "report"}, "*"); | ||
}, document.body); | ||
}); | ||
}); | ||
</script> |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>IFrame Fullscreen API success reporter</title> | ||
<body> | ||
<script> | ||
reportFullscreenSuccessful = (success) => { | ||
return () => { | ||
parent.postMessage({"report": { | ||
"api": "fullscreen", | ||
"result": success, | ||
"frame": window.name | ||
}}, "*"); | ||
}; | ||
}; | ||
|
||
window.addEventListener('message', e => { | ||
if (e.data.action == "report") { | ||
document.onfullscreenchange = reportFullscreenSuccessful(true); | ||
document.onfullscreenerror = reportFullscreenSuccessful(false); | ||
document.body.requestFullscreen(); | ||
} | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>IFrame fullscreenEnabled attribute reporter</title> | ||
<body> | ||
<script> | ||
parent.postMessage({"report": { | ||
"api": "fullscreen", | ||
"enabled": document.fullscreenEnabled, | ||
"frame": window.name | ||
}}, "*"); | ||
</script> |