зеркало из https://github.com/mozilla/pjs.git
Bug 623945: Null-check animationController before using it, in SVGDocumentWrapper::StartAnimation/StopAnimation. r=roc a=joe
This commit is contained in:
Родитель
f548acf13c
Коммит
db8fceee6a
|
@ -68,6 +68,9 @@ _TEST_FILES = \
|
|||
test_pointer-events.xhtml \
|
||||
test_scientific.html \
|
||||
scientific-helper.svg \
|
||||
test_SVGAnimatedImageSMILDisabled.html \
|
||||
animated-svg-image-helper.html \
|
||||
animated-svg-image-helper.svg \
|
||||
test_SVGLengthList.xhtml \
|
||||
test_SVGPathSegList.xhtml \
|
||||
test_SVGStyleElement.xhtml \
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<html>
|
||||
<img src="animated-svg-image-helper.svg">
|
||||
</html>
|
|
@ -0,0 +1,3 @@
|
|||
<svg xmlns="http://www.w3.org/2000/svg">
|
||||
<set attributeName="font-size" to="50"/>
|
||||
</svg>
|
После Ширина: | Высота: | Размер: 91 B |
|
@ -0,0 +1,58 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=623945
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 623945</title>
|
||||
<script type="application/javascript" src="/MochiKit/packed.js"></script>
|
||||
<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=623945">Mozilla Bug 623945</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
/** Test for Bug 623945 **/
|
||||
/* This test makes sure we don't crash when using an animated SVG image with
|
||||
* the 'svg.smil.enabled' pref turned off. */
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function setSMILEnabled(enabled) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefs.setBoolPref("svg.smil.enabled", enabled);
|
||||
}
|
||||
|
||||
function iframeLoaded() {
|
||||
// Woo-hoo, we didn't crash! Declare success!
|
||||
ok(true, "got through the test without crashing");
|
||||
|
||||
// Re-enable SMIL pref for future tests.
|
||||
setSMILEnabled(true);
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function main() {
|
||||
// First, we turn off the SMIL pref:
|
||||
setSMILEnabled(false);
|
||||
|
||||
// Then, we load an HTML document with an animated SVG image.
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.onload = iframeLoaded;
|
||||
iframe.src = "animated-svg-image-helper.html";
|
||||
document.getElementById("content").appendChild(iframe);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -204,7 +204,10 @@ SVGDocumentWrapper::StartAnimation()
|
|||
nsIDocument* doc = mViewer->GetDocument();
|
||||
if (doc) {
|
||||
#ifdef MOZ_SMIL
|
||||
doc->GetAnimationController()->Resume(nsSMILTimeContainer::PAUSE_IMAGE);
|
||||
nsSMILAnimationController* controller = doc->GetAnimationController();
|
||||
if (controller) {
|
||||
controller->Resume(nsSMILTimeContainer::PAUSE_IMAGE);
|
||||
}
|
||||
#endif // MOZ_SMIL
|
||||
doc->SetImagesNeedAnimating(PR_TRUE);
|
||||
}
|
||||
|
@ -221,7 +224,10 @@ SVGDocumentWrapper::StopAnimation()
|
|||
nsIDocument* doc = mViewer->GetDocument();
|
||||
if (doc) {
|
||||
#ifdef MOZ_SMIL
|
||||
doc->GetAnimationController()->Pause(nsSMILTimeContainer::PAUSE_IMAGE);
|
||||
nsSMILAnimationController* controller = doc->GetAnimationController();
|
||||
if (controller) {
|
||||
controller->Pause(nsSMILTimeContainer::PAUSE_IMAGE);
|
||||
}
|
||||
#endif // MOZ_SMIL
|
||||
doc->SetImagesNeedAnimating(PR_FALSE);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче