--- a/devtools/client/inspector/animation-old/test/head.js
+++ b/devtools/client/inspector/animation-old/test/head.js
@@ -38,16 +38,17 @@ registerCleanupFunction(() => {
// Some animation features are not enabled by default in release/beta channels
// yet including:
// * parts of the Web Animations API (Bug 1264101), and
// * the frames() timing function (Bug 1379582).
function enableAnimationFeatures() {
return new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.animations-api.core.enabled", true],
+ ["dom.animations-api.getAnimations.enabled", true],
["dom.animations-api.implicit-keyframes.enabled", true],
["dom.animations-api.timelines.enabled", true],
["layout.css.frames-timing.enabled", true],
]}, resolve);
});
}
/**
--- a/devtools/client/inspector/animation/test/head.js
+++ b/devtools/client/inspector/animation/test/head.js
@@ -56,16 +56,17 @@ const closeAnimationInspector = async fu
* yet including:
* * parts of the Web Animations API (Bug 1264101), and
* * the frames() timing function (Bug 1379582).
*/
const enableAnimationFeatures = function() {
return new Promise(resolve => {
SpecialPowers.pushPrefEnv({"set": [
["dom.animations-api.core.enabled", true],
+ ["dom.animations-api.getAnimations.enabled", true],
["dom.animations-api.implicit-keyframes.enabled", true],
["dom.animations-api.timelines.enabled", true],
["layout.css.frames-timing.enabled", true],
]}, resolve);
});
};
/**
--- a/dom/animation/test/crashtests/crashtests.list
+++ b/dom/animation/test/crashtests/crashtests.list
@@ -9,27 +9,27 @@ pref(dom.animations-api.core.enabled,tru
load 1272475-1.html
load 1272475-2.html
load 1278485-1.html
pref(dom.animations-api.timelines.enabled,true) load 1277272-1.html
load 1282691-1.html
pref(dom.animations-api.core.enabled,true) load 1291413-1.html
pref(dom.animations-api.core.enabled,true) load 1291413-2.html
pref(dom.animations-api.compositing.enabled,true) load 1304886-1.html
-pref(dom.animations-api.core.enabled,true) load 1309198-1.html
+pref(dom.animations-api.getAnimations.enabled,true) load 1309198-1.html
pref(dom.animations-api.implicit-keyframes.enabled,true) load 1322382-1.html
pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.implicit-keyframes.enabled,true) load 1322291-1.html
pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.implicit-keyframes.enabled,true) load 1322291-2.html
pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.compositing.enabled,true) load 1323114-1.html
pref(dom.animations-api.compositing.enabled,true) load 1323114-2.html
pref(dom.animations-api.implicit-keyframes.enabled,true) load 1323119-1.html
pref(dom.animations-api.implicit-keyframes.enabled,true) load 1324554-1.html
pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.compositing.enabled,true) load 1325193-1.html
pref(dom.animations-api.implicit-keyframes.enabled,true) load 1330190-1.html
-pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.compositing.enabled,true) load 1330190-2.html
+pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.compositing.enabled,true) pref(dom.animations-api.getAnimations.enabled,true) load 1330190-2.html
pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.compositing.enabled,true) load 1330513-1.html
pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1333539-1.html
pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1333539-2.html
load 1334582-1.html
load 1334582-2.html
load 1334583-1.html
pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.compositing.enabled,true) load 1335998-1.html
pref(dom.animations-api.core.enabled,true) load 1343589-1.html
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -1,21 +1,23 @@
[DEFAULT]
prefs =
dom.animations-api.compositing.enabled=true
dom.animations-api.core.enabled=true
+ dom.animations-api.getAnimations.enabled=true
dom.animations-api.implicit-keyframes.enabled=true
dom.animations-api.timelines.enabled=true
# Support files for chrome tests that we want to load over HTTP need
# to go in here, not chrome.ini.
support-files =
chrome/file_animate_xrays.html
mozilla/xhr_doc.html
mozilla/file_deferred_start.html
mozilla/file_disable_animations_api_compositing.html
+ mozilla/file_disable_animations_api_get_animations.html
mozilla/file_disable_animations_api_implicit_keyframes.html
mozilla/file_disable_animations_api_timelines.html
mozilla/file_discrete_animations.html
mozilla/file_restyles.html
mozilla/file_transition_finish_on_compositor.html
../../../layout/style/test/property_database.js
testcommon.js
!/dom/events/test/event_leak_utils.js
@@ -38,16 +40,17 @@ support-files =
[document-timeline/test_document-timeline.html]
skip-if = (verify && !debug && (os == 'mac'))
[document-timeline/test_request_animation_frame.html]
[mozilla/test_cascade.html]
[mozilla/test_cubic_bezier_limits.html]
[mozilla/test_deferred_start.html]
skip-if = (toolkit == 'android' && debug) || (os == 'win' && bits == 64) # Bug 1363957
[mozilla/test_disable_animations_api_compositing.html]
+[mozilla/test_disable_animations_api_get_animations.html]
[mozilla/test_disable_animations_api_implicit_keyframes.html]
[mozilla/test_disable_animations_api_timelines.html]
[mozilla/test_disabled_properties.html]
[mozilla/test_discrete_animations.html]
[mozilla/test_distance_of_basic_shape.html]
[mozilla/test_distance_of_filter.html]
[mozilla/test_distance_of_transform.html]
[mozilla/test_document_timeline_origin_time_range.html]
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/file_disable_animations_api_get_animations.html
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src="../testcommon.js"></script>
+<body>
+<script>
+'use strict';
+
+test(t => {
+ assert_false('getAnimations' in addDiv(t));
+}, 'Element.getAnimations() is not available when getAnimations pref is'
+ + ' disabled');
+
+test(t => {
+ assert_false('getAnimations' in document);
+}, 'Document.getAnimations() is not available when getAnimations pref is'
+ + ' disabled');
+
+test(t => {
+ assert_false('CSSPseudoElement' in window);
+}, 'CSSPseudoElement interface is not available when getAnimations pref is'
+ + ' disabled');
+
+done();
+</script>
+</body>
--- a/dom/animation/test/mozilla/test_deferred_start.html
+++ b/dom/animation/test/mozilla/test_deferred_start.html
@@ -5,16 +5,17 @@
<div id="log"></div>
<script>
'use strict';
setup({explicit_done: true});
SpecialPowers.pushPrefEnv(
{
set: [
["dom.animations-api.core.enabled", true],
+ ["dom.animations-api.getAnimations.enabled", true],
["dom.animations-api.timelines.enabled", true],
],
},
function() {
window.open("file_deferred_start.html");
}
);
</script>
new file mode 100644
--- /dev/null
+++ b/dom/animation/test/mozilla/test_disable_animations_api_get_animations.html
@@ -0,0 +1,14 @@
+<!doctype html>
+<meta charset=utf-8>
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="log"></div>
+<script>
+'use strict';
+setup({explicit_done: true});
+SpecialPowers.pushPrefEnv(
+ { "set": [["dom.animations-api.getAnimations.enabled", false]]},
+ function() {
+ window.open("file_disable_animations_api_get_animations.html");
+ });
+</script>
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -3303,16 +3303,27 @@ nsDocument::IsWebAnimationsEnabled(Calle
{
MOZ_ASSERT(NS_IsMainThread());
return aCallerType == dom::CallerType::System ||
nsContentUtils::AnimationsAPICoreEnabled();
}
bool
+nsDocument::IsWebAnimationsGetAnimationsEnabled(JSContext* aCx,
+ JSObject* /*unused*/
+)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ return nsContentUtils::IsSystemCaller(aCx) ||
+ StaticPrefs::dom_animations_api_getAnimations_enabled();
+}
+
+bool
nsDocument::AreWebAnimationsImplicitKeyframesEnabled(JSContext* aCx,
JSObject* /*unused*/
)
{
MOZ_ASSERT(NS_IsMainThread());
return nsContentUtils::IsSystemCaller(aCx) ||
StaticPrefs::dom_animations_api_implicit_keyframes_enabled();
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -155,16 +155,18 @@ public:
nsIStreamListener **aDocListener,
bool aReset = true,
nsIContentSink* aContentSink = nullptr) override = 0;
virtual void StopDocumentLoad() override;
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(mozilla::dom::CallerType aCallerType);
+ static bool IsWebAnimationsGetAnimationsEnabled(JSContext* aCx,
+ JSObject* aObject);
static bool AreWebAnimationsImplicitKeyframesEnabled(JSContext* aCx,
JSObject* aObject);
static bool AreWebAnimationsTimelinesEnabled(JSContext* aCx,
JSObject* aObject);
virtual void EndUpdate() override;
virtual void BeginLoad() override;
virtual void EndLoad() override;
--- a/dom/base/test/test_bug1295852.html
+++ b/dom/base/test/test_bug1295852.html
@@ -5,17 +5,17 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css">
<body>
<script>
var names = [
"span", "_moz_generated_content_before", "_moz_generated_content_after"
];
-if (SpecialPowers.getBoolPref("dom.animations-api.core.enabled")) {
+if (SpecialPowers.getBoolPref("dom.animations-api.getAnimations.enabled")) {
names.forEach(name => {
var element = document.createElement(name);
element.animate({ "color": ["red", "blue"] }, { duration: 1000 });
is(element.getAnimations().length, 1);
});
} else {
ok("Test requires Web Animations, which is disabled.");
}
--- a/dom/base/test/test_domwindowutils.html
+++ b/dom/base/test/test_domwindowutils.html
@@ -52,17 +52,22 @@ function test_sendMouseEventOptionals()
// Check explicit value for optional args
utils.sendMouseEvent("mouseup", x, y, button, clickCount, modifiers,
false, pressure, source, false);
}
function test_getUnanimatedComputedStyle() {
SpecialPowers.pushPrefEnv(
- { set: [["dom.animations-api.core.enabled", true]] },
+ {
+ set: [
+ ["dom.animations-api.core.enabled", true],
+ ["dom.animations-api.getAnimations.enabled", true],
+ ],
+ },
() => {
window.open("file_domwindowutils_animation.html");
}
);
}
var tests = [
test_sendMouseEventDefaults,
--- a/dom/smil/test/test_smilWithTransition.html
+++ b/dom/smil/test/test_smilWithTransition.html
@@ -5,14 +5,14 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<pre id="test">
<script>
'use strict';
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
- { "set": [["dom.animations-api.core.enabled", true]]},
+ { "set": [["dom.animations-api.getAnimations.enabled", true]]},
function() {
window.open("file_smilWithTransition.html");
});
</script>
</html>
--- a/dom/webidl/Animatable.webidl
+++ b/dom/webidl/Animatable.webidl
@@ -18,11 +18,11 @@ dictionary AnimationFilter {
boolean subtree = false;
};
[NoInterfaceObject]
interface Animatable {
[Throws]
Animation animate(object? keyframes,
optional UnrestrictedDoubleOrKeyframeAnimationOptions options);
- [Func="nsDocument::IsWebAnimationsEnabled"]
+ [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
sequence<Animation> getAnimations(optional AnimationFilter filter);
};
--- a/dom/webidl/CSSPseudoElement.webidl
+++ b/dom/webidl/CSSPseudoElement.webidl
@@ -10,16 +10,16 @@
* Copyright © 2015 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
*/
// Both CSSOM and CSS Pseudo-Elements 4 provide contradictory definitions for
// this interface.
// What we implement here is a minimal subset of the two definitions which we
// ship behind a pref until the specification issues have been resolved.
-[Func="nsDocument::IsWebAnimationsEnabled"]
+[Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
interface CSSPseudoElement {
readonly attribute DOMString type;
readonly attribute Element parentElement;
};
// https://drafts.csswg.org/web-animations/#extensions-to-the-pseudoelement-interface
CSSPseudoElement implements Animatable;
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -320,17 +320,17 @@ partial interface Document {
//(Not implemented)Element? find(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
//(Not implemented)NodeList findAll(DOMString selectors, optional (Element or sequence<Node>)? refNodes);
};
// https://drafts.csswg.org/web-animations/#extensions-to-the-document-interface
partial interface Document {
[Func="nsDocument::AreWebAnimationsTimelinesEnabled"]
readonly attribute DocumentTimeline timeline;
- [Func="nsDocument::IsWebAnimationsEnabled"]
+ [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
sequence<Animation> getAnimations();
};
// https://svgwg.org/svg2-draft/struct.html#InterfaceDocumentExtensions
partial interface Document {
[BinaryName="SVGRootElement"]
readonly attribute SVGSVGElement? rootElement;
};
--- a/layout/style/crashtests/crashtests.list
+++ b/layout/style/crashtests/crashtests.list
@@ -124,17 +124,17 @@ load 1066089-1.html
load 1074651-1.html
load 1135534.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1089463-1.html
load 1136010-1.html
load 1146101-1.html
load 1153693-1.html
load 1156969.svg
load 1161320-1.html
-pref(dom.animations-api.core.enabled,true) load 1161320-2.html
+pref(dom.animations-api.getAnimations.enabled,true) load 1161320-2.html
load 1161366-1.html
load 1163446-1.html
load 1164813-1.html
load 1167782-1.html
load 1186768-1.xhtml
load 1200568-1.html
load 1206105-1.html
load 1223688-1.html
@@ -154,17 +154,17 @@ load 1250791.html
load 1264396-1.html
load 1264949.html
# The following test relies on -webkit-text-fill-color being behind the
# layout.css.prefixes.webkit pref
pref(layout.css.prefixes.webkit,false) load 1265611-1.html
load 1270795.html
load 1275026.html
load 1278463-1.html
-pref(dom.animations-api.core.enabled,true) load 1277908-1.html # bug 1323652
+pref(dom.animations-api.getAnimations.enabled,true) load 1277908-1.html
load 1277908-2.html
load 1282076-1.html
load 1282076-2.html
load 1290994-1.html
load 1290994-2.html
load 1290994-3.html
load 1290994-4.html
load 1314531.html
@@ -270,17 +270,17 @@ load 1410226-2.html
load 1411008.html
load 1411143.html
load 1411478.html
load 1413288.html
load 1413361.html
load 1413670.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1415353.html
load 1418059.html
-test-pref(dom.animations-api.core.enabled,true) test-pref(dom.animations-api.implicit-keyframes.enabled,true) load 1418867.html
+test-pref(dom.animations-api.core.enabled,true) test-pref(dom.animations-api.implicit-keyframes.enabled,true) pref(dom.animations-api.getAnimations.enabled,true) load 1418867.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1419554.html
load 1426312.html
load 1439793.html
load 1409183.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1445682.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1449243.html
load 1450691.html
pref(dom.webcomponents.shadowdom.enabled,true) load 1453206.html
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -1,12 +1,13 @@
[DEFAULT]
prefs =
dom.animations-api.compositing.enabled=true
dom.animations-api.core.enabled=true
+ dom.animations-api.getAnimations.enabled=true
dom.animations-api.implicit-keyframes.enabled=true
dom.animations-api.timelines.enabled=true
support-files =
animation_utils.js
ccd-quirks.html
ccd.sjs
ccd-standards.html
chrome/bug418986-2.js
--- a/modules/libpref/init/StaticPrefList.h
+++ b/modules/libpref/init/StaticPrefList.h
@@ -99,16 +99,34 @@ VARCACHE_PREF(
#endif
VARCACHE_PREF(
"dom.animations-api.compositing.enabled",
dom_animations_api_compositing_enabled,
bool, PREF_VALUE
)
#undef PREF_VALUE
+// Is support for Document.getAnimations() and Element.getAnimations()
+// supported?
+//
+// Before enabling this by default, make sure also CSSPseudoElement interface
+// has been spec'ed properly, or we should add a separate pref for
+// CSSPseudoElement interface. See Bug 1174575 for further details.
+#ifdef RELEASE_OR_BETA
+# define PREF_VALUE false
+#else
+# define PREF_VALUE true
+#endif
+VARCACHE_PREF(
+ "dom.animations-api.getAnimations.enabled",
+ dom_animations_api_getAnimations_enabled,
+ bool, PREF_VALUE
+)
+#undef PREF_VALUE
+
// Is support for animations from the Web Animations API without 0%/100%
// keyframes enabled?
#ifdef RELEASE_OR_BETA
# define PREF_VALUE false
#else
# define PREF_VALUE true
#endif
VARCACHE_PREF(
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -3063,20 +3063,17 @@ pref("layout.idle_period.required_quiesc
// The amount of time (milliseconds) needed between an idle period's
// end and the start of the next tick to avoid jank.
pref("layout.idle_period.time_limit", 1);
// Whether -webkit-appearance is aliased to -moz-appearance
pref("layout.css.webkit-appearance.enabled", false);
-// Is support for the Web Animations API enabled?
-// Before enabling this by default, make sure also CSSPseudoElement interface
-// has been spec'ed properly, or we should add a separate pref for
-// CSSPseudoElement interface. See Bug 1174575 for further details.
+// Is support for the core interfaces of Web Animations API enabled?
#ifdef RELEASE_OR_BETA
pref("dom.animations-api.core.enabled", false);
#else
pref("dom.animations-api.core.enabled", true);
#endif
// Pref to throttle offsreen animations
pref("dom.animations.offscreen-throttling", true);
--- a/testing/web-platform/meta/css/css-animations/__dir__.ini
+++ b/testing/web-platform/meta/css/css-animations/__dir__.ini
@@ -1,4 +1,5 @@
prefs: [dom.animations-api.compositing.enabled:true,
dom.animations-api.core.enabled:true,
+ dom.animations-api.getAnimations.enabled:true,
dom.animations-api.implicit-keyframes.enabled:true,
dom.animations-api.timelines.enabled:true]
--- a/testing/web-platform/meta/css/css-scoping/__dir__.ini
+++ b/testing/web-platform/meta/css/css-scoping/__dir__.ini
@@ -1,1 +1,1 @@
-prefs: [dom.animations-api.core.enabled:true,dom.webcomponents.shadowdom.enabled:true]
+prefs: [dom.animations-api.getAnimations.enabled:true,dom.webcomponents.shadowdom.enabled:true]
--- a/testing/web-platform/meta/css/css-transitions/__dir__.ini
+++ b/testing/web-platform/meta/css/css-transitions/__dir__.ini
@@ -1,4 +1,5 @@
prefs: [dom.animations-api.compositing.enabled:true,
dom.animations-api.core.enabled:true,
+ dom.animations-api.getAnimations.enabled:true,
dom.animations-api.implicit-keyframes.enabled:true,
dom.animations-api.timelines.enabled:true]
--- a/testing/web-platform/meta/web-animations/__dir__.ini
+++ b/testing/web-platform/meta/web-animations/__dir__.ini
@@ -1,5 +1,6 @@
prefs: [dom.animations-api.compositing.enabled:true,
dom.animations-api.core.enabled:true,
+ dom.animations-api.getAnimations.enabled:true,
dom.animations-api.implicit-keyframes.enabled:true,
dom.animations-api.timelines.enabled:true,
layout.css.frames-timing.enabled:true]