зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1577084 - A mochitest to make sure images outside of display port is not decoded. r=tnikkel
Differential Revision: https://phabricator.services.mozilla.com/D57090 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
7035f2def8
Коммит
99e39cdefa
|
@ -0,0 +1,22 @@
|
|||
<!DOCTYPE html>
|
||||
<meta charset=utf-8>
|
||||
<script src="imgutils.js"></script>
|
||||
<img id="img" src="animated1.gif">
|
||||
<script>
|
||||
let observer = new ImageDecoderObserverStub();
|
||||
observer.decodeComplete = () => {
|
||||
parent.postMessage("decodeComplete", "*");
|
||||
};
|
||||
observer.loadComplete = () => {
|
||||
parent.postMessage("loadComplete", "*");
|
||||
};
|
||||
observer = SpecialPowers.wrapCallbackObject(observer);
|
||||
const gObserver = SpecialPowers.Cc["@mozilla.org/image/tools;1"]
|
||||
.getService(SpecialPowers.Ci.imgITools)
|
||||
.createScriptedObserver(observer);
|
||||
const img = document.getElementById("img");
|
||||
SpecialPowers.wrap(img).addObserver(gObserver);
|
||||
window.addEventListener("unload", () => {
|
||||
SpecialPowers.wrap(img).removeObserver(gObserver);
|
||||
});
|
||||
</script>
|
|
@ -95,6 +95,8 @@ support-files =
|
|||
12M-pixels-1.png
|
||||
12M-pixels-2.png
|
||||
|
||||
[test_animated_gif.html]
|
||||
support-files = child.html
|
||||
[test_animation.html]
|
||||
[test_animation_operators.html]
|
||||
[test_animation2.html]
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Images outside of display port are not decoded</title>
|
||||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script src="imgutils.js"></script>
|
||||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<div id="scroller" style="height: 300px; overflow: scroll;">
|
||||
<div style="width: 100%; height: 5000px;"></div>
|
||||
<iframe src="http://example.org/tests/image/test/mochitest/child.html"></iframe>
|
||||
<div style="width: 100%; height: 5000px;"></div>
|
||||
</div>
|
||||
<pre id="test"></pre>
|
||||
<script>
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let loadCompleteCount = 0;
|
||||
window.addEventListener("message", event => {
|
||||
isnot(event.data, "decodeComplete",
|
||||
"The image outside of the display port should not be decoded");
|
||||
if (event.data == "loadComplete") {
|
||||
loadCompleteCount++
|
||||
}
|
||||
});
|
||||
|
||||
const start = document.timeline.currentTime;
|
||||
// Waits a second;
|
||||
SimpleTest.waitForCondition(() => {
|
||||
return 1000 < (document.timeline.currentTime - start);
|
||||
}, () => {
|
||||
is(loadCompleteCount, 1,
|
||||
"`loadComplete` should be received once");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче