Skip to content

Commit 93f989c

Browse files
upsupermoz-wptsync-bot
authored andcommitted
Bug 1492746 [wpt PR 13102] - Several fixes to manual fullscreen tests, a=testonly
Automatic update from web-platform-testsSeveral fixes to manual fullscreen tests (#13102) These tests are made to start after onload so that iframe content doesn't change anymore: * fullscreen/api/element-ready-check-containing-iframe-manual.html * fullscreen/api/element-ready-check-not-allowed-manual.html * fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html * fullscreen/model/move-to-fullscreen-iframe-manual.html fullscreen/rendering/ua-style-iframe-manual.html is updated to check each subproperties individually rather than shorthand properties. fullscreen/api/element-request-fullscreen-timing-manual.html is changed so that the second test starts after an animation frame to work around Gecko throttling rAF before the first paint. Related bugs: https://bugzilla.mozilla.org/show_bug.cgi?id=1493878 w3c/csswg-drafts#2529 -- wpt-commits: b3c7bf4261939cd1aba9b3264152a718b634ffa7 wpt-pr: 13102
1 parent 5aa235a commit 93f989c

7 files changed

+122
-98
lines changed

testing/web-platform/tests/fullscreen/api/document-exit-fullscreen-timing-manual.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
const events = [];
2121
const callback = t.step_func(event => {
2222
// fullscreenElement should have changed before either event is fired.
23-
assert_equals(document.fullscreenElement, null, `fullscreenElement in {event.type} event`);
23+
assert_equals(document.fullscreenElement, null, `fullscreenElement in ${event.type} event`);
2424
events.push(event.type);
2525
if (event.type == 'fullscreenchange') {
2626
step_timeout(t.unreached_func('timer callback'));

testing/web-platform/tests/fullscreen/api/element-ready-check-containing-iframe-manual.html

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,19 @@
77
<iframe allowfullscreen>iframe>
88
<iframe allowfullscreen>iframe>
99
<script>
10-
async_test(function(t)
11-
{
12-
var iframes = document.getElementsByTagName("iframe");
13-
trusted_request(t, iframes[0].contentDocument.body, document.body);
14-
iframes[0].contentDocument.onfullscreenchange = t.step_func(function()
15-
{
16-
assert_equals(document.fullscreenElement, iframes[0]);
17-
trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body);
18-
iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() {
19-
assert_equals(document.fullscreenElement, iframes[1]);
20-
});
21-
iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error");
22-
});
23-
});
10+
// wait for load event to avoid https://bugzil.la/1493878
11+
window.onload = function() {
12+
async_test(function(t) {
13+
var iframes = document.getElementsByTagName("iframe");
14+
trusted_request(t, iframes[0].contentDocument.body, document.body);
15+
iframes[0].contentDocument.onfullscreenchange = t.step_func(function() {
16+
assert_equals(document.fullscreenElement, iframes[0]);
17+
trusted_request(t, iframes[1].contentDocument.body, iframes[0].contentDocument.body);
18+
iframes[1].contentDocument.onfullscreenchange = t.step_func_done(function() {
19+
assert_equals(document.fullscreenElement, iframes[1]);
20+
});
21+
iframes[1].contentDocument.onfullscreenerror = t.unreached_func("fullscreenchange error");
22+
});
23+
});
24+
};
2425
script>

testing/web-platform/tests/fullscreen/api/element-ready-check-not-allowed-manual.html

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
<div id="log">div>
77
<iframe>iframe>
88
<script>
9-
async_test(function(t)
10-
{
11-
var iframe = document.querySelector("iframe");
12-
document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
13-
document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
14-
iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
15-
iframe.contentDocument.onfullscreenerror = t.step_func_done();
16-
assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag");
17-
trusted_request(t, iframe.contentDocument.body, document.body);
18-
});
9+
// wait for load event to avoid https://bugzil.la/1493878
10+
window.onload = function() {
11+
async_test(function(t) {
12+
var iframe = document.querySelector("iframe");
13+
document.onfullscreenchange = t.unreached_func("document fullscreenchange event");
14+
document.onfullscreenerror = t.unreached_func("document fullscreenerror event");
15+
iframe.contentDocument.onfullscreenchange = t.unreached_func("iframe fullscreenchange event");
16+
iframe.contentDocument.onfullscreenerror = t.step_func_done();
17+
assert_false(iframe.contentDocument.fullscreenEnabled, "fullscreen enabled flag");
18+
trusted_request(t, iframe.contentDocument.body, document.body);
19+
});
20+
};
1921
script>

testing/web-platform/tests/fullscreen/api/element-request-fullscreen-and-exit-iframe-manual.html

Lines changed: 34 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,40 @@
66
<div id="log">div>
77
<iframe allowfullscreen>iframe>
88
<script>
9-
async_test(t => {
10-
const iframe = document.querySelector('iframe');
11-
const iframeDoc = iframe.contentDocument;
12-
const iframeBody = iframeDoc.body;
9+
// wait for load event to avoid https://bugzil.la/1493878
10+
window.onload = function() {
11+
async_test(t => {
12+
const iframe = document.querySelector('iframe');
13+
const iframeDoc = iframe.contentDocument;
14+
const iframeBody = iframeDoc.body;
1315

14-
let count = 0;
15-
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
16-
count++;
17-
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
18-
// Both when entering and exiting, the fullscreenchange event is fired first
19-
// on the outer document and then on the iframe's document. This is because
20-
// the events are fired in animation frame tasks, which run in "frame tree"
21-
// order.
22-
const expected = {
23-
target: count == 1 || count == 3 ? iframe : iframeBody,
24-
outerFullscreenElement: count <= 2 ? iframe : null,
25-
innerFullscreenElement: count <= 2 ? iframeBody : null,
26-
};
27-
assert_equals(event.target, expected.target, 'event target');
28-
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
29-
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
30-
if (count == 2) {
31-
iframeDoc.exitFullscreen();
32-
} else if (count == 4) {
33-
// Done, but set timeout to fail on extra events.
34-
step_timeout(t.step_func_done());
35-
}
36-
});
37-
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
38-
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
16+
let count = 0;
17+
document.onfullscreenchange = iframeDoc.onfullscreenchange = t.step_func(event => {
18+
count++;
19+
assert_between_inclusive(count, 1, 4, 'number of fullscreenchange events');
20+
// Both when entering and exiting, the fullscreenchange event is fired first
21+
// on the outer document and then on the iframe's document. This is because
22+
// the events are fired in animation frame tasks, which run in "frame tree"
23+
// order.
24+
const expected = {
25+
target: count == 1 || count == 3 ? iframe : iframeBody,
26+
outerFullscreenElement: count <= 2 ? iframe : null,
27+
innerFullscreenElement: count <= 2 ? iframeBody : null,
28+
};
29+
assert_equals(event.target, expected.target, 'event target');
30+
assert_equals(document.fullscreenElement, expected.outerFullscreenElement, 'outer fullscreenElement');
31+
assert_equals(iframeDoc.fullscreenElement, expected.innerFullscreenElement, 'inner fullscreenElement');
32+
if (count == 2) {
33+
iframeDoc.exitFullscreen();
34+
} else if (count == 4) {
35+
// Done, but set timeout to fail on extra events.
36+
step_timeout(t.step_func_done());
37+
}
38+
});
39+
document.onfullscreenerror = t.unreached_func('fullscreenerror event');
40+
iframeDoc.onfullscreenerror = t.unreached_func('iframe fullscreenerror event');
3941

40-
trusted_request(t, iframeBody, iframeBody);
41-
});
42+
trusted_request(t, iframeBody, iframeBody);
43+
});
44+
};
4245
script>

testing/web-platform/tests/fullscreen/api/element-request-fullscreen-timing-manual.html

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,25 @@
2828
}, 'Timing of fullscreenchange and resize events');
2929

3030
async_test(t => {
31-
var promise = document.createElement('a').requestFullscreen();
32-
var promise_executed = false;
33-
if (promise) {
34-
promise.catch(()=>{promise_executed = true; });
35-
} else {
36-
// if promises aren't supported treat it as executed.
37-
promise_executed = true;
38-
}
31+
// Gecko throttles requestAnimationFrame before the first paint, so
32+
// wrap the test to work around that.
33+
requestAnimationFrame(t.step_func(() => {
34+
var promise = document.createElement('a').requestFullscreen();
35+
var promise_executed = false;
36+
if (promise) {
37+
promise.catch(()=>{promise_executed = true; });
38+
} else {
39+
// if promises aren't supported treat it as executed.
40+
promise_executed = true;
41+
}
3942

40-
// If fullscreenerror is an animation frame event, then animation frame
41-
// callbacks should be run after it is fired, before the timer callback.
42-
document.onfullscreenerror = t.step_func(() => {
43-
assert_true(promise_executed, "promise executed");
44-
step_timeout(t.unreached_func('timer callback'));
45-
requestAnimationFrame(t.step_func_done());
46-
});
43+
// If fullscreenerror is an animation frame event, then animation frame
44+
// callbacks should be run after it is fired, before the timer callback.
45+
document.onfullscreenerror = t.step_func(() => {
46+
assert_true(promise_executed, "promise executed");
47+
step_timeout(t.unreached_func('timer callback'));
48+
requestAnimationFrame(t.step_func_done());
49+
});
50+
}));
4751
}, 'Timing of fullscreenerror event');
4852
script>

testing/web-platform/tests/fullscreen/model/move-to-fullscreen-iframe-manual.html

Lines changed: 26 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,36 @@
55
<script src="../trusted-click.js">script>
66
<iframe allowfullscreen>iframe>
77
<script>
8-
async_test(t => {
9-
const iframe = document.querySelector('iframe');
10-
const iframeDoc = iframe.contentDocument;
8+
// wait for load event to avoid https://bugzil.la/1493878
9+
window.onload = function() {
10+
async_test(t => {
11+
const iframe = document.querySelector('iframe');
12+
const iframeDoc = iframe.contentDocument;
1113

12-
// Enter fullscreen for the iframe's body element.
13-
trusted_request(t, iframeDoc.body, iframeDoc.body);
14-
document.onfullscreenchange = t.step_func(() => {
15-
assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element");
16-
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element");
14+
// Enter fullscreen for the iframe's body element.
15+
trusted_request(t, iframeDoc.body, iframeDoc.body);
16+
document.onfullscreenchange = t.step_func(() => {
17+
assert_equals(document.fullscreenElement, iframe, "document's initial fullscreen element");
18+
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's initial fullscreen element");
1719

18-
// Then, move the outer document's body into the iframe. This is an unusual
19-
// thing to do, but means that the iframe is removed from its document and
20-
// should trigger fullscreen exit.
21-
iframeDoc.documentElement.appendChild(document.body);
20+
// Then, move the outer document's body into the iframe. This is an unusual
21+
// thing to do, but means that the iframe is removed from its document and
22+
// should trigger fullscreen exit.
23+
iframeDoc.documentElement.appendChild(document.body);
2224

23-
// If we exit in an orderly fashion, that's all one can ask for.
24-
document.onfullscreenchange = t.step_func_done(() => {
25-
assert_equals(document.fullscreenElement, null, "document's final fullscreen element");
25+
// If we exit in an orderly fashion, that's all one can ask for.
26+
document.onfullscreenchange = t.step_func_done(() => {
27+
assert_equals(document.fullscreenElement, null, "document's final fullscreen element");
2628

27-
// Because the iframe was removed, its browsing context was discarded and
28-
// its contentDocument has become null. Because that browsing context was
29-
// neither a descendant browsing context nor had an active document,
30-
// nothing at all was done with it in the exit fullscreen algorithm, so
31-
// its fullscreenElement is unchanged.
32-
assert_equals(iframe.contentDocument, null, "iframe's content document");
33-
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element");
29+
// Because the iframe was removed, its browsing context was discarded and
30+
// its contentDocument has become null. Because that browsing context was
31+
// neither a descendant browsing context nor had an active document,
32+
// nothing at all was done with it in the exit fullscreen algorithm, so
33+
// its fullscreenElement is unchanged.
34+
assert_equals(iframe.contentDocument, null, "iframe's content document");
35+
assert_equals(iframeDoc.fullscreenElement, iframeDoc.body, "iframe's final fullscreen element");
36+
});
3437
});
3538
});
36-
});
39+
};
3740
script>

testing/web-platform/tests/fullscreen/rendering/ua-style-iframe-manual.html

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,32 @@
1414
<div id="log">div>
1515
<div id="ancestor"><iframe>iframe>div>
1616
<script>
17+
function assert_dir_properties(style, propBase, value, state) {
18+
for (let dir of ["Top", "Right", "Bottom", "Left"]) {
19+
let prop = propBase.replace('{}', dir);
20+
assert_equals(style[prop], value, `${state} ${prop} style`);
21+
}
22+
}
23+
1724
async_test(t => {
1825
const ancestor = document.getElementById('ancestor');
1926
const iframe = ancestor.firstChild;
2027

2128
const initialStyle = getComputedStyle(iframe);
22-
assert_equals(initialStyle.border, '1px solid rgb(0, 0, 255)', 'initial border style');
23-
assert_equals(initialStyle.padding, '1px', 'initial padding style');
29+
assert_dir_properties(initialStyle, 'border{}Width', '1px', 'initial');
30+
assert_dir_properties(initialStyle, 'border{}Style', 'solid', 'initial');
31+
assert_dir_properties(initialStyle, 'border{}Color', 'rgb(0, 0, 255)', 'initial');
32+
assert_dir_properties(initialStyle, 'padding{}', '1px', 'initial');
2433
assert_equals(initialStyle.transform, 'matrix(0.5, 0, 0, 0.5, 0, 0)', 'initial transform style');
2534

2635
trusted_request(t, iframe);
2736

2837
document.addEventListener('fullscreenchange', t.step_func_done(() => {
2938
const fullscreenStyle = getComputedStyle(iframe);
30-
assert_equals(fullscreenStyle.border, '0px none rgb(0, 0, 0)', 'fullscreen border style');
31-
assert_equals(fullscreenStyle.padding, '0px', 'fullscreen padding style');
39+
assert_dir_properties(fullscreenStyle, 'border{}Width', '0px', 'fullscreen');
40+
assert_dir_properties(fullscreenStyle, 'border{}Style', 'none', 'fullscreen');
41+
assert_dir_properties(fullscreenStyle, 'border{}Color', 'rgb(0, 0, 0)', 'fullscreen');
42+
assert_dir_properties(fullscreenStyle, 'padding{}', '0px', 'fullscreen');
3243
assert_equals(fullscreenStyle.transform, 'none', 'fullscreen transform style');
3344
}));
3445
});

0 commit comments

Comments
 (0)