Bug 876282 - Add unprefixed cancelAnimationFrame; r=bz

--HG--
rename : content/base/test/test_bug647518.html => content/base/test/test_bug876282.html
This commit is contained in:
Ms2ger 2013-05-28 19:31:31 +02:00
parent 214e104806
commit c9bfa03ce9
4 changed files with 57 additions and 4 deletions

View File

@ -629,6 +629,7 @@ MOCHITEST_FILES_C= \
test_bug868999.html \
test_bug869000.html \
test_bug869002.html \
test_bug876282.html \
$(NULL)
# OOP tests don't work on Windows (bug 763081) or native-fennec

View File

@ -0,0 +1,45 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=647518
-->
<head>
<title>Test for Bug 647518</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=647518">Mozilla Bug 647518</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 647518 **/
SimpleTest.waitForExplicitFinish();
var counter = 3;
var called = false;
var handle1 = window.requestAnimationFrame(function() {
called = true;
});
ok(handle1 > 0, "Should get back a nonzero handle");
function checker() {
--counter;
if (counter == 0) {
is(called, false, "Canceled callback should not have been called");
SimpleTest.finish();
} else {
window.requestAnimationFrame(checker);
}
}
window.requestAnimationFrame(checker);
window.cancelAnimationFrame(handle1);
</script>
</pre>
</body>
</html>

View File

@ -4429,13 +4429,19 @@ nsGlobalWindow::RequestAnimationFrame(const JS::Value& aCallback,
NS_IMETHODIMP
nsGlobalWindow::MozCancelRequestAnimationFrame(int32_t aHandle)
{
return MozCancelAnimationFrame(aHandle);
return CancelAnimationFrame(aHandle);
}
NS_IMETHODIMP
nsGlobalWindow::MozCancelAnimationFrame(int32_t aHandle)
{
FORWARD_TO_INNER(MozCancelAnimationFrame, (aHandle),
return CancelAnimationFrame(aHandle);
}
NS_IMETHODIMP
nsGlobalWindow::CancelAnimationFrame(int32_t aHandle)
{
FORWARD_TO_INNER(CancelAnimationFrame, (aHandle),
NS_ERROR_NOT_INITIALIZED);
if (!mDoc) {

View File

@ -25,7 +25,7 @@ interface nsIVariant;
* @see <http://www.whatwg.org/html/#window>
*/
[scriptable, uuid(e0f33b20-72ef-415b-9ff2-8bf176f581f8)]
[scriptable, uuid(be62660a-e3f6-409c-a4a9-378364a9526f)]
interface nsIDOMWindow : nsISupports
{
// the current browsing context
@ -454,6 +454,7 @@ interface nsIDOMWindow : nsISupports
void mozCancelAnimationFrame(in long aHandle);
// Backwards-compat shim for now to make Google maps work
void mozCancelRequestAnimationFrame(in long aHandle);
void cancelAnimationFrame(in long aHandle);
/**
* The current animation start time in milliseconds since the epoch.
@ -508,5 +509,5 @@ interface nsIDOMWindowPerformance : nsISupports
* Empty interface for compatibility with older versions.
* @deprecated Use nsIDOMWindow instead
*/
[scriptable, uuid(36aeaa8e-3126-49de-9581-276dd7117826)]
[scriptable, uuid(ad5768c7-8668-4cd4-bcac-3d0a400d50be)]
interface nsIDOMWindowInternal : nsIDOMWindow {};