Bug 1268798 part 4 - Mark Document.fullscreenElement and fullscreenEnabled with LenientSetter. r?smaug
MozReview-Commit-ID: B2F2sCLm0G8
new file mode 100644
--- /dev/null
+++ b/dom/html/test/file_fullscreen-lenient-setters.html
@@ -0,0 +1,52 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="UTF-8">
+ <title>Test for Bug 1268798</title>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+</head>
+<body>
+<script>
+"use strict";
+
+function ok(condition, msg) {
+ opener.ok(condition, "[lenient-setters] " + msg);
+}
+
+function is(a, b, msg) {
+ opener.is(a, b, "[lenient-setters] " + msg);
+}
+
+function info(msg) {
+ opener.info("[lenient-setters] " + msg);
+}
+
+let unattachedDiv = document.createElement("div");
+
+function begin() {
+ var originalElem = document.fullscreenElement;
+ try {
+ document.fullscreenElement = unattachedDiv;
+ document.fullscreenElement = [];
+ is(document.fullscreenElement, originalElem,
+ "fullscreenElement should not be changed");
+ } catch (e) {
+ ok(false, "Setting fullscreenElement should not throw");
+ }
+
+ var originalEnabled = document.fullscreenEnabled;
+ try {
+ document.fullscreenEnabled = !originalEnabled;
+ is(document.fullscreenEnabled, originalEnabled,
+ "fullscreenEnabled should not be changed");
+ } catch (e) {
+ ok(false, "Setting fullscreenEnabled should not throw");
+ }
+
+ opener.nextTest();
+}
+
+</script>
+</body>
+</html>
--- a/dom/html/test/mochitest.ini
+++ b/dom/html/test/mochitest.ini
@@ -48,16 +48,17 @@ support-files =
file_formSubmission_text.txt
file_fullscreen-api.html
file_fullscreen-backdrop.html
file_fullscreen-denied-inner.html
file_fullscreen-denied.html
file_fullscreen-esc-exit-inner.html
file_fullscreen-esc-exit.html
file_fullscreen-hidden.html
+ file_fullscreen-lenient-setters.html
file_fullscreen-multiple-inner.html
file_fullscreen-multiple.html
file_fullscreen-navigation.html
file_fullscreen-nested.html
file_fullscreen-prefixed.html
file_fullscreen-plugins.html
file_fullscreen-rollback.html
file_fullscreen-scrollbar.html
--- a/dom/html/test/test_fullscreen-api.html
+++ b/dom/html/test/test_fullscreen-api.html
@@ -39,16 +39,17 @@ var gTestWindows = [
"file_fullscreen-navigation.html",
"file_fullscreen-scrollbar.html",
"file_fullscreen-selector.html",
"file_fullscreen-top-layer.html",
"file_fullscreen-backdrop.html",
"file_fullscreen-nested.html",
"file_fullscreen-prefixed.html",
"file_fullscreen-unprefix-disabled.html",
+ "file_fullscreen-lenient-setters.html",
];
var testWindow = null;
var gTestIndex = 0;
function finish() {
SimpleTest.finish();
}
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -219,21 +219,21 @@ partial interface Document {
readonly attribute unsigned long referrerPolicy;
};
// https://fullscreen.spec.whatwg.org/#api
partial interface Document {
// Note: Per spec the 'S' in these two is lowercase, but the "Moz"
// versions hve it uppercase.
- [Func="nsDocument::IsUnprefixedFullscreenEnabled"]
+ [LenientSetter, Func="nsDocument::IsUnprefixedFullscreenEnabled"]
readonly attribute boolean fullscreenEnabled;
[BinaryName="fullscreenEnabled", Deprecated="PrefixedFullscreenAPI"]
readonly attribute boolean mozFullScreenEnabled;
- [Func="nsDocument::IsUnprefixedFullscreenEnabled"]
+ [LenientSetter, Func="nsDocument::IsUnprefixedFullscreenEnabled"]
readonly attribute Element? fullscreenElement;
[BinaryName="fullscreenElement", Deprecated="PrefixedFullscreenAPI"]
readonly attribute Element? mozFullScreenElement;
[Func="nsDocument::IsUnprefixedFullscreenEnabled"]
void exitFullscreen();
[BinaryName="exitFullscreen", Deprecated="PrefixedFullscreenAPI"]
void mozCancelFullScreen();