зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 2 changesets (bug 1598470, bug 1595720) for causing browser_fullscreen_cross_origin.js to permafail CLOSED TREE
Backed out changeset 02fbe3085e54 (bug 1598470) Backed out changeset 40f6133b6b61 (bug 1595720)
This commit is contained in:
Родитель
9975a34e69
Коммит
1b5b6af7bd
|
@ -4,6 +4,4 @@ support-files =
|
|||
[browser_bug1557041.js]
|
||||
skip-if = os == 'linux' # Bug 1561973
|
||||
[browser_fullscreen_permissions_prompt.js]
|
||||
skip-if = debug && os == 'mac' # Bug 1568570
|
||||
[browser_fullscreen_cross_origin.js]
|
||||
support-files = fullscreen.html fullscreen_frame.html
|
||||
skip-if = debug && os == 'mac' # Bug 1568570
|
|
@ -1,74 +0,0 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
"use strict";
|
||||
|
||||
const ORIGIN =
|
||||
"https://example.com/browser/browser/base/content/test/fullscreen/fullscreen_frame.html";
|
||||
|
||||
add_task(async function test_fullscreen_cross_origin() {
|
||||
async function requestFullscreen(aAllow, aExpect) {
|
||||
await BrowserTestUtils.withNewTab(ORIGIN, async function(browser) {
|
||||
const iframeId = aExpect == "allowed" ? "frameAllowed" : "frameDenied";
|
||||
|
||||
info("Start fullscreen on iframe " + iframeId);
|
||||
await SpecialPowers.spawn(
|
||||
browser,
|
||||
[{ aExpect, iframeId }],
|
||||
async function(args) {
|
||||
let frame = content.document.getElementById(args.iframeId);
|
||||
await content.SpecialPowers.spawn(
|
||||
frame,
|
||||
[args.aExpect],
|
||||
async expect => {
|
||||
let frameDoc = content.document;
|
||||
const waitForFullscreen = new Promise(resolve => {
|
||||
const message =
|
||||
expect == "allowed" ? "fullscreenchange" : "fullscreenerror";
|
||||
frameDoc.notifyUserGestureActivation();
|
||||
function handler(evt) {
|
||||
frameDoc.removeEventListener(message, handler);
|
||||
Assert.equal(
|
||||
evt.type,
|
||||
message,
|
||||
`Request should be ${expect}`
|
||||
);
|
||||
frameDoc.exitFullscreen();
|
||||
resolve();
|
||||
}
|
||||
frameDoc.addEventListener(message, handler);
|
||||
});
|
||||
|
||||
frameDoc.getElementById("request").click();
|
||||
await waitForFullscreen;
|
||||
}
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
if (aExpect == "allowed") {
|
||||
waitForFullScreenState(browser, false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
await new Promise(r => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
set: [
|
||||
["full-screen-api.enabled", true],
|
||||
["full-screen-api.allow-trusted-requests-only", false],
|
||||
["full-screen-api.transition-duration.enter", "0 0"],
|
||||
["full-screen-api.transition-duration.leave", "0 0"],
|
||||
["dom.security.featurePolicy.enabled", true],
|
||||
["dom.security.featurePolicy.header.enabled", true],
|
||||
["dom.security.featurePolicy.webidl.enabled", true],
|
||||
],
|
||||
},
|
||||
r
|
||||
);
|
||||
});
|
||||
|
||||
await requestFullscreen(undefined, "denied");
|
||||
await requestFullscreen("fullscreen", "allowed");
|
||||
});
|
|
@ -1,12 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<script>
|
||||
function requestFScreen() {
|
||||
document.body.requestFullscreen();
|
||||
}
|
||||
</script>
|
||||
<body>
|
||||
<button id="request" onclick="requestFScreen()"> Fullscreen </button>
|
||||
<button id="focus"> Fullscreen </button>
|
||||
</body>
|
||||
</html>
|
|
@ -1,9 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<body>
|
||||
<iframe id="frameAllowed"
|
||||
src="https://example.org/browser/browser/base/content/test/fullscreen/fullscreen.html"
|
||||
allowfullscreen></iframe>
|
||||
<iframe id="frameDenied" src="https://example.org/browser/browser/base/content/test/fullscreen/fullscreen.html"></iframe>
|
||||
</body>
|
||||
</html>
|
|
@ -306,6 +306,8 @@ void HTMLIFrameElement::RefreshFeaturePolicy(bool aParseAllowAttribute) {
|
|||
mFeaturePolicy->SetDeclaredPolicy(OwnerDoc(), allow, NodePrincipal(),
|
||||
origin);
|
||||
}
|
||||
|
||||
mFeaturePolicy->InheritPolicy(OwnerDoc()->FeaturePolicy());
|
||||
}
|
||||
|
||||
if (AllowPaymentRequest()) {
|
||||
|
@ -316,7 +318,6 @@ void HTMLIFrameElement::RefreshFeaturePolicy(bool aParseAllowAttribute) {
|
|||
mFeaturePolicy->MaybeSetAllowedPolicy(NS_LITERAL_STRING("fullscreen"));
|
||||
}
|
||||
|
||||
mFeaturePolicy->InheritPolicy(OwnerDoc()->FeaturePolicy());
|
||||
MaybeStoreCrossOriginFeaturePolicy();
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<script src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="file_fullscreen-utils.js"></script>
|
||||
<iframe src="empty.html" allowfullscreen></iframe>
|
||||
<iframe src="about:blank" allowfullscreen></iframe>
|
||||
<script>
|
||||
function ok(condition, msg) {
|
||||
opener.ok(condition, "[event-order] " + msg);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<script type="application/javascript" src="file_fullscreen-utils.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<iframe src="empty.html" allowfullscreen></iframe>
|
||||
<iframe src="about:blank" allowfullscreen></iframe>
|
||||
<script type="text/javascript">
|
||||
|
||||
/** Test for Bug 1187801 **/
|
||||
|
|
|
@ -234,13 +234,7 @@ void FeaturePolicy::GetAllowlistForFeature(const nsAString& aFeatureName,
|
|||
}
|
||||
|
||||
void FeaturePolicy::MaybeSetAllowedPolicy(const nsAString& aFeatureName) {
|
||||
MOZ_ASSERT(FeaturePolicyUtils::IsSupportedFeature(aFeatureName) ||
|
||||
FeaturePolicyUtils::IsExperimentalFeature(aFeatureName));
|
||||
// Skip if feature is in experimental pharse
|
||||
if (!StaticPrefs::dom_security_featurePolicy_experimental_enabled() &&
|
||||
FeaturePolicyUtils::IsExperimentalFeature(aFeatureName)) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(FeaturePolicyUtils::IsSupportedFeature(aFeatureName));
|
||||
|
||||
if (HasDeclaredFeature(aFeatureName)) {
|
||||
return;
|
||||
|
|
|
@ -27,46 +27,25 @@ struct FeatureMap {
|
|||
* DOM Security peer!
|
||||
*/
|
||||
static FeatureMap sSupportedFeatures[] = {
|
||||
{"camera", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"geolocation", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"microphone", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"display-capture", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"fullscreen", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
};
|
||||
|
||||
/*
|
||||
* This is experimental features list, which is disabled by default by pref
|
||||
* dom.security.featurePolicy.experimental.enabled.
|
||||
*/
|
||||
static FeatureMap sExperimentalFeatures[] = {
|
||||
// We don't support 'autoplay' for now, because it would be overwrote by
|
||||
// 'user-gesture-activation' policy. However, we can still keep it in the
|
||||
// list as we might start supporting it after we use different autoplay
|
||||
// policy.
|
||||
{"autoplay", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
{"camera", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"encrypted-media", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
{"fullscreen", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
{"geolocation", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"microphone", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"midi", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"payment", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
{"document-domain", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
{"display-capture", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
// TODO: not supported yet!!!
|
||||
{"speaker", FeaturePolicyUtils::FeaturePolicyValue::eSelf},
|
||||
{"vr", FeaturePolicyUtils::FeaturePolicyValue::eAll},
|
||||
};
|
||||
|
||||
/* static */
|
||||
bool FeaturePolicyUtils::IsExperimentalFeature(const nsAString& aFeatureName) {
|
||||
uint32_t numFeatures =
|
||||
(sizeof(sExperimentalFeatures) / sizeof(sExperimentalFeatures[0]));
|
||||
for (uint32_t i = 0; i < numFeatures; ++i) {
|
||||
if (aFeatureName.LowerCaseEqualsASCII(
|
||||
sExperimentalFeatures[i].mFeatureName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool FeaturePolicyUtils::IsSupportedFeature(const nsAString& aFeatureName) {
|
||||
uint32_t numFeatures =
|
||||
|
@ -76,12 +55,6 @@ bool FeaturePolicyUtils::IsSupportedFeature(const nsAString& aFeatureName) {
|
|||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (StaticPrefs::dom_security_featurePolicy_experimental_enabled() &&
|
||||
IsExperimentalFeature(aFeatureName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -93,14 +66,6 @@ void FeaturePolicyUtils::ForEachFeature(
|
|||
for (uint32_t i = 0; i < numFeatures; ++i) {
|
||||
aCallback(sSupportedFeatures[i].mFeatureName);
|
||||
}
|
||||
|
||||
if (StaticPrefs::dom_security_featurePolicy_experimental_enabled()) {
|
||||
numFeatures =
|
||||
(sizeof(sExperimentalFeatures) / sizeof(sExperimentalFeatures[0]));
|
||||
for (uint32_t i = 0; i < numFeatures; ++i) {
|
||||
aCallback(sExperimentalFeatures[i].mFeatureName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* static */ FeaturePolicyUtils::FeaturePolicyValue
|
||||
|
@ -113,17 +78,6 @@ FeaturePolicyUtils::DefaultAllowListFeature(const nsAString& aFeatureName) {
|
|||
}
|
||||
}
|
||||
|
||||
if (StaticPrefs::dom_security_featurePolicy_experimental_enabled()) {
|
||||
numFeatures =
|
||||
(sizeof(sExperimentalFeatures) / sizeof(sExperimentalFeatures[0]));
|
||||
for (uint32_t i = 0; i < numFeatures; ++i) {
|
||||
if (aFeatureName.LowerCaseEqualsASCII(
|
||||
sExperimentalFeatures[i].mFeatureName)) {
|
||||
return sExperimentalFeatures[i].mDefaultAllowList;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FeaturePolicyValue::eNone;
|
||||
}
|
||||
|
||||
|
@ -136,12 +90,6 @@ bool FeaturePolicyUtils::IsFeatureAllowed(Document* aDocument,
|
|||
return true;
|
||||
}
|
||||
|
||||
// Skip apply features in experimental pharse
|
||||
if (!StaticPrefs::dom_security_featurePolicy_experimental_enabled() &&
|
||||
IsExperimentalFeature(aFeatureName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!aDocument->IsHTMLDocument()) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ class FeaturePolicyUtils final {
|
|||
// Returns true if aFeatureName is a known feature policy name.
|
||||
static bool IsSupportedFeature(const nsAString& aFeatureName);
|
||||
|
||||
// Returns true if aFeatureName is a experimental feature policy name.
|
||||
static bool IsExperimentalFeature(const nsAString& aFeatureName);
|
||||
|
||||
// Runs aCallback for each known feature policy, with the feature name as
|
||||
// argument.
|
||||
static void ForEachFeature(const std::function<void(const char*)>& aCallback);
|
||||
|
|
|
@ -17,10 +17,8 @@ support-files =
|
|||
[test_bug535806.xhtml]
|
||||
[test_chrome_only_media_queries.html]
|
||||
[test_display_mode.html]
|
||||
support-files = display_mode.html
|
||||
tags = fullscreen
|
||||
[test_display_mode_reflow.html]
|
||||
support-files = display_mode_reflow.html
|
||||
tags = fullscreen
|
||||
[test_hover.html]
|
||||
skip-if = true # bug 1346353
|
||||
|
|
|
@ -1,123 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1104916
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Display Mode</title>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
|
||||
for (var n of imports) {
|
||||
window[n] = window.opener.wrappedJSObject[n];
|
||||
}
|
||||
|
||||
/** Test for Display Mode **/
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function waitOneEvent(element, name) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
element.addEventListener(name, function() {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
function promiseNextTick() {
|
||||
return new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
async function test_task() {
|
||||
var iframe = document.getElementById("subdoc");
|
||||
var subdoc = iframe.contentDocument;
|
||||
var style = subdoc.getElementById("style");
|
||||
var bodyComputedStyled = subdoc.defaultView.getComputedStyle(subdoc.body);
|
||||
var win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
function queryApplies(q) {
|
||||
style.setAttribute("media", q);
|
||||
return bodyComputedStyled.getPropertyValue("text-decoration-line") ==
|
||||
"underline";
|
||||
}
|
||||
|
||||
function shouldApply(q) {
|
||||
ok(queryApplies(q), q + " should apply");
|
||||
}
|
||||
|
||||
function shouldNotApply(q) {
|
||||
ok(!queryApplies(q), q + " should not apply");
|
||||
}
|
||||
|
||||
function setDisplayMode(mode) {
|
||||
win.docShell.displayMode = mode;
|
||||
}
|
||||
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: standalone)");
|
||||
shouldNotApply("all and (display-mode: minimal-ui)");
|
||||
|
||||
// Test entering the OS's fullscreen mode.
|
||||
var fullScreenEntered = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenEntered;
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
shouldApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
var fullScreenExited = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenExited;
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
|
||||
// Test entering fullscreen through document requestFullScreen.
|
||||
fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.body.mozRequestFullScreen();
|
||||
await fullScreenEntered
|
||||
ok(document.mozFullScreenElement, "window entered fullscreen");
|
||||
shouldApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
fullScreenExited = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.mozCancelFullScreen();
|
||||
await fullScreenExited;
|
||||
ok(!document.mozFullScreenElement, "window exited fullscreen");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
|
||||
// Test entering display mode mode through docshell
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_STANDALONE);
|
||||
shouldApply("all and (display-mode: standalone)");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
shouldNotApply("all and (display-mode: minimal-ui)");
|
||||
|
||||
// Test that changes in the display mode are reflected
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_MINIMAL_UI);
|
||||
shouldApply("all and (display-mode: minimal-ui)");
|
||||
shouldNotApply("all and (display-mode: standalone)");
|
||||
|
||||
// Set the display mode back.
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_BROWSER);
|
||||
|
||||
window.close();
|
||||
window.SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="test_task()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1104916">Mozilla Bug 1104916</a>
|
||||
<iframe id="subdoc" src="http://mochi.test:8888/tests/layout/style/test/chrome/media_queries_iframe.html" allowfullscreen></iframe>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -1,85 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1256084
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Display Mode</title>
|
||||
<script src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
var imports = [ "SimpleTest", "is", "isnot", "ok" ];
|
||||
for (var n of imports) {
|
||||
window[n] = window.opener.wrappedJSObject[n];
|
||||
}
|
||||
|
||||
/** Test for Display Mode **/
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function waitOneEvent(element, name) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
element.addEventListener(name, function() {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
function promiseNextTick() {
|
||||
return new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
async function test_task() {
|
||||
var iframe = document.getElementById("subdoc");
|
||||
var subdoc = iframe.contentDocument;
|
||||
var style = subdoc.getElementById("style");
|
||||
var bodyComputedStyled = subdoc.defaultView.getComputedStyle(subdoc.body);
|
||||
var win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
var secondDiv = subdoc.getElementById("b");
|
||||
var offsetTop = secondDiv.offsetTop;
|
||||
|
||||
// Test entering the OS's fullscreen mode.
|
||||
var fullScreenEntered = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenEntered;
|
||||
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
ok(offsetTop !== secondDiv.offsetTop, "offset top changes");
|
||||
var fullScreenExited = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenExited;
|
||||
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
ok(offsetTop === secondDiv.offsetTop, "offset top returns to original value");
|
||||
|
||||
offsetTop = secondDiv.offsetTop;
|
||||
// Test entering fullscreen through document requestFullScreen.
|
||||
fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.body.mozRequestFullScreen();
|
||||
await fullScreenEntered
|
||||
ok(offsetTop !== secondDiv.offsetTop, "offset top changes");
|
||||
fullScreenExited = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.mozCancelFullScreen();
|
||||
await fullScreenExited;
|
||||
ok(offsetTop === secondDiv.offsetTop, "offset top returns to original value");
|
||||
|
||||
window.close();
|
||||
window.SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body onload="test_task()">
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1256084">Mozilla Bug 1256084</a>
|
||||
<iframe id="subdoc" src="http://mochi.test:8888/tests/layout/style/test/chrome/display_mode_reflow_iframe.html"></iframe>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -11,28 +11,106 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1104916
|
|||
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
async function startTest() {
|
||||
await new Promise(r => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
set: [
|
||||
["dom.security.featurePolicy.enabled", true],
|
||||
["dom.security.featurePolicy.header.enabled", true],
|
||||
["dom.security.featurePolicy.webidl.enabled", true],
|
||||
],
|
||||
},
|
||||
r
|
||||
);
|
||||
});
|
||||
// Chrome test run tests in iframe, and fullscreen is disabled by default.
|
||||
// So run the test in a separate window.
|
||||
window.open("display_mode.html", "display_mode", "width=500,height=500");
|
||||
}
|
||||
|
||||
/** Test for Display Mode **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function waitOneEvent(element, name) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
element.addEventListener(name, function() {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
function promiseNextTick() {
|
||||
return new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
var iframe = document.getElementById("subdoc");
|
||||
var subdoc = iframe.contentDocument;
|
||||
var style = subdoc.getElementById("style");
|
||||
var bodyComputedStyled = subdoc.defaultView.getComputedStyle(subdoc.body);
|
||||
var win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
function queryApplies(q) {
|
||||
style.setAttribute("media", q);
|
||||
return bodyComputedStyled.getPropertyValue("text-decoration-line") ==
|
||||
"underline";
|
||||
}
|
||||
|
||||
function shouldApply(q) {
|
||||
ok(queryApplies(q), q + " should apply");
|
||||
}
|
||||
|
||||
function shouldNotApply(q) {
|
||||
ok(!queryApplies(q), q + " should not apply");
|
||||
}
|
||||
|
||||
function setDisplayMode(mode) {
|
||||
win.docShell.displayMode = mode;
|
||||
}
|
||||
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: standalone)");
|
||||
shouldNotApply("all and (display-mode: minimal-ui)");
|
||||
|
||||
// Test entering the OS's fullscreen mode.
|
||||
var fullScreenEntered = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenEntered;
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
shouldApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
var fullScreenExited = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenExited;
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
|
||||
// Test entering fullscreen through document requestFullScreen.
|
||||
fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.body.mozRequestFullScreen();
|
||||
await fullScreenEntered
|
||||
ok(document.mozFullScreenElement, "window entered fullscreen");
|
||||
shouldApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
fullScreenExited = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.mozCancelFullScreen();
|
||||
await fullScreenExited;
|
||||
ok(!document.mozFullScreenElement, "window exited fullscreen");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldApply("all and (display-mode: browser)");
|
||||
|
||||
// Test entering display mode mode through docshell
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_STANDALONE);
|
||||
shouldApply("all and (display-mode: standalone)");
|
||||
shouldNotApply("all and (display-mode: fullscreen)");
|
||||
shouldNotApply("all and (display-mode: browser)");
|
||||
shouldNotApply("all and (display-mode: minimal-ui)");
|
||||
|
||||
// Test that changes in the display mode are reflected
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_MINIMAL_UI);
|
||||
shouldApply("all and (display-mode: minimal-ui)");
|
||||
shouldNotApply("all and (display-mode: standalone)");
|
||||
|
||||
// Set the display mode back.
|
||||
setDisplayMode(Ci.nsIDocShell.DISPLAY_MODE_BROWSER);
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body onload="startTest();">
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1104916">Mozilla Bug 1104916</a>
|
||||
<iframe id="subdoc" src="http://mochi.test:8888/tests/layout/style/test/chrome/media_queries_iframe.html"></iframe>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
|
|
@ -11,30 +11,68 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1256084
|
|||
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
async function startTest() {
|
||||
await new Promise(r => {
|
||||
SpecialPowers.pushPrefEnv(
|
||||
{
|
||||
set: [
|
||||
["dom.security.featurePolicy.enabled", true],
|
||||
["dom.security.featurePolicy.header.enabled", true],
|
||||
["dom.security.featurePolicy.webidl.enabled", true],
|
||||
],
|
||||
},
|
||||
r
|
||||
);
|
||||
});
|
||||
// Chrome test run tests in iframe, and fullscreen is disabled by default.
|
||||
// So run the test in a separate window.
|
||||
window.open("display_mode_reflow.html", "display_mode_reflow", "width=500,height=500");
|
||||
}
|
||||
|
||||
/** Test for Display Mode **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function waitOneEvent(element, name) {
|
||||
return new Promise(function(resolve, reject) {
|
||||
element.addEventListener(name, function() {
|
||||
resolve();
|
||||
}, {once: true});
|
||||
});
|
||||
}
|
||||
|
||||
function promiseNextTick() {
|
||||
return new Promise(resolve => setTimeout(resolve, 0));
|
||||
}
|
||||
|
||||
add_task(async function() {
|
||||
var iframe = document.getElementById("subdoc");
|
||||
var subdoc = iframe.contentDocument;
|
||||
var style = subdoc.getElementById("style");
|
||||
var bodyComputedStyled = subdoc.defaultView.getComputedStyle(subdoc.body);
|
||||
var win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
|
||||
var secondDiv = subdoc.getElementById("b");
|
||||
var offsetTop = secondDiv.offsetTop;
|
||||
|
||||
// Test entering the OS's fullscreen mode.
|
||||
var fullScreenEntered = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenEntered;
|
||||
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
ok(offsetTop !== secondDiv.offsetTop, "offset top changes");
|
||||
var fullScreenExited = waitOneEvent(win, "sizemodechange");
|
||||
synthesizeKey("KEY_F11");
|
||||
await fullScreenExited;
|
||||
|
||||
// Wait for the next tick to apply media feature changes. See bug 1430380.
|
||||
await promiseNextTick();
|
||||
ok(offsetTop === secondDiv.offsetTop, "offset top returns to original value");
|
||||
|
||||
offsetTop = secondDiv.offsetTop;
|
||||
// Test entering fullscreen through document requestFullScreen.
|
||||
fullScreenEntered = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.body.mozRequestFullScreen();
|
||||
await fullScreenEntered
|
||||
ok(offsetTop !== secondDiv.offsetTop, "offset top changes");
|
||||
fullScreenExited = waitOneEvent(document, "mozfullscreenchange");
|
||||
document.mozCancelFullScreen();
|
||||
await fullScreenExited;
|
||||
ok(offsetTop === secondDiv.offsetTop, "offset top returns to original value");
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body onload="startTest();">
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1256084">Mozilla Bug 1256084</a>
|
||||
<iframe id="subdoc" src="http://mochi.test:8888/tests/layout/style/test/chrome/display_mode_reflow_iframe.html"></iframe>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
|
|
@ -2173,11 +2173,6 @@
|
|||
value: true
|
||||
mirror: always
|
||||
|
||||
- name: dom.security.featurePolicy.experimental.enabled
|
||||
type: bool
|
||||
value: false
|
||||
mirror: always
|
||||
|
||||
# Expose the 'policy' attribute in document and HTMLIFrameElement
|
||||
- name: dom.security.featurePolicy.webidl.enabled
|
||||
type: bool
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
lsan-allowed: [Alloc, CreateCDMProxy, MakeUnique, Malloc, NewPage, Realloc, mozilla::EMEDecryptor::EMEDecryptor, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::dom::MediaKeys::CreateCDMProxy, mozilla::dom::ContentChild::GetConstructedEventTarget]
|
||||
leak-threshold: [default:51200]
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.payments.request.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true, dom.webmidi.enabled:true, dom.vr.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.payments.request.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true, dom.webmidi.enabled:true, dom.vr.enabled:true]
|
||||
leak-threshold: [default:51200]
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.reporting.enabled:true, dom.reporting.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true, dom.webcomponents.elementInternals.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true, dom.webcomponents.elementInternals.enabled:true]
|
||||
[idlharness.https.html?exclude=(Document|Window|HTML.*)]
|
||||
[ElementInternals interface: operation setValidity(ValidityStateFlags, DOMString, HTMLElement)]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true]
|
||||
[idle-detection-allowed-by-feature-policy-attribute-redirect-on-load.https.sub.html]
|
||||
expected: TIMEOUT
|
||||
[Attribute allow="idle-detection" in top-level frame disallows workers in cross-origin relocation.]
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true]
|
||||
[idle-detection-allowed-by-feature-policy-attribute.https.sub.html]
|
||||
expected: TIMEOUT
|
||||
[Attribute allow="idle-detection" in top-level frame can be enabled in a worker in cross-origin iframe using Feature policy "idle-detection".]
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true]
|
||||
leak-threshold: [default:51200]
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
lsan-allowed: [Alloc, Create, Malloc, Then, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::dom::ServiceWorkerJobQueue::RunJob, mozilla::dom::ServiceWorkerManager::Unregister, mozilla::dom::ServiceWorkerRegistrationMainThread::Unregister, mozilla::dom::UnregisterCallback::UnregisterCallback, mozilla::net::nsStandardURL::TemplatedMutator, operator]
|
||||
|
|
|
@ -1 +1 @@
|
|||
prefs: [dom.vr.enabled:true, dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.experimental.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
prefs: [dom.vr.enabled:true, dom.security.featurePolicy.enabled:true, dom.security.featurePolicy.header.enabled:true, dom.security.featurePolicy.webidl.enabled:true]
|
||||
|
|
Загрузка…
Ссылка в новой задаче