blob: 37d179c78c4eca89b2d74ca90108c01e9fdd854e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
<!DOCTYPE HTML>
<html>
<!--
Test that a image decoding error producs a net:failed-to-process-uri-content
observer event with the nsIURI of the failed image as the subject
-->
<head>
<title>Test for image net:failed-to-process-uri-content</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<pre id="test">
</pre>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
const Ci = SpecialPowers.Ci;
const Cc = SpecialPowers.Cc;
var obs = Cc["@mozilla.org/observer-service;1"].getService();
obs = obs.QueryInterface(Ci.nsIObserverService);
var observer = {
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsISupports) ||
aIID.equals(Ci.nsIObserver))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
observe: function(subject, topic, data) {
ok(topic == "net:failed-to-process-uri-content", "wrong topic");
subject = subject.QueryInterface(Ci.nsIURI);
is(subject.asciiSpec, "http://mochi.test:8888/tests/image/test/mochitest/invalid.jpg", "wrong subject");
obs.removeObserver(this, "net:failed-to-process-uri-content");
SimpleTest.finish();
}
};
obs.addObserver(SpecialPowers.wrapCallbackObject(observer), "net:failed-to-process-uri-content", false);
document.write('<img src="damon.jpg">');
document.write('<img src="invalid.jpg">');
</script>
</body>
</html>
|