mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-03 18:47:53 +00:00
Bug 1212299 part 3 - Add test for requesting fullscreen from doc inside frame/object. rs=smaug
--HG-- extra : source : c931d9c561e66a9a026bfc3c69e4c664f3168055
This commit is contained in:
parent
9162652384
commit
f44406c15c
@ -10,11 +10,11 @@ function doRequestFullscreen() {
|
||||
document.removeEventListener("mozfullscreenchange", handler);
|
||||
document.removeEventListener("mozfullscreenerror", handler);
|
||||
parent.is(evt.type, "mozfullscreenerror", "Request from " +
|
||||
"an iframe without allowfullscreen should be denied");
|
||||
`document inside ${parent.testTargetName} should be denied`);
|
||||
parent.continueTest();
|
||||
}
|
||||
parent.ok(!document.mozFullScreenEnabled, "Fullscreen " +
|
||||
"should not be enabled in an iframe without allowfullscreen");
|
||||
`should not be enabled in ${parent.testTargetName}`);
|
||||
document.addEventListener("mozfullscreenchange", handler);
|
||||
document.addEventListener("mozfullscreenerror", handler);
|
||||
document.documentElement.mozRequestFullScreen();
|
||||
|
@ -31,6 +31,16 @@ function is(a, b, msg) {
|
||||
opener.is(a, b, "[denied] " + msg);
|
||||
}
|
||||
|
||||
const INNER_FILE = "file_fullscreen-denied-inner.html";
|
||||
function setupForInnerTest(targetName, callback) {
|
||||
window.testTargetName = targetName;
|
||||
window.continueTest = () => {
|
||||
delete window.testTargetName;
|
||||
delete window.continueTest;
|
||||
callback();
|
||||
};
|
||||
}
|
||||
|
||||
function begin() {
|
||||
document.addEventListener("mozfullscreenchange", () => {
|
||||
ok(false, "Should never receive " +
|
||||
@ -40,21 +50,42 @@ function begin() {
|
||||
}
|
||||
|
||||
function testIFrameWithoutAllowFullscreen() {
|
||||
window.continueTest = () => {
|
||||
delete window.continueTest;
|
||||
// Create an iframe without an allowfullscreen attribute, whose
|
||||
// contents request fullscreen. The request should be denied, and
|
||||
// we should not receive a fullscreenchange event in this document.
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = INNER_FILE;
|
||||
setupForInnerTest("an iframe without allowfullscreen", () => {
|
||||
document.body.removeChild(iframe);
|
||||
SimpleTest.executeSoon(testFrameElement);
|
||||
});
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
function testFrameElement() {
|
||||
var frameset = document.createElement("frameset");
|
||||
var frame = document.createElement("frame");
|
||||
frame.src = INNER_FILE;
|
||||
frameset.appendChild(frame);
|
||||
setupForInnerTest("a frame element", () => {
|
||||
document.documentElement.removeChild(frameset);
|
||||
SimpleTest.executeSoon(testObjectElement);
|
||||
});
|
||||
document.documentElement.appendChild(frameset);
|
||||
}
|
||||
|
||||
function testObjectElement() {
|
||||
var objectElem = document.createElement("object");
|
||||
objectElem.data = INNER_FILE;
|
||||
setupForInnerTest("an object element", () => {
|
||||
document.body.removeChild(objectElem);
|
||||
// In the following tests we want to test trust context requirement
|
||||
// of fullscreen request, so temporary re-enable this pref.
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set":[["full-screen-api.allow-trusted-requests-only", true]]
|
||||
}, testNonTrustContext);
|
||||
};
|
||||
// Create an iframe without an allowfullscreen attribute, whose
|
||||
// contents request fullscreen. The request should be denied, and
|
||||
// we should not receive a fullscreenchange event in this document.
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "file_fullscreen-denied-inner.html";
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
document.body.appendChild(objectElem);
|
||||
}
|
||||
|
||||
function testNonTrustContext() {
|
||||
|
Loading…
Reference in New Issue
Block a user