|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <!-- |
|
4 https://bugzilla.mozilla.org/show_bug.cgi?id=392338 |
|
5 --> |
|
6 <head> |
|
7 <title>Test for Bug 392338</title> |
|
8 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body> |
|
12 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=392338">Mozilla Bug 392338</a> |
|
13 <p id="display"></p> |
|
14 <div id="content" style="display: none"> |
|
15 |
|
16 </div> |
|
17 <pre id="test"> |
|
18 <script class="testbody" type="text/javascript"> |
|
19 |
|
20 /** Test for Bug 392338 **/ |
|
21 function obs () { |
|
22 SpecialPowers.addObserver(this, "http-on-modify-request", false); |
|
23 this.window = window; |
|
24 } |
|
25 |
|
26 obs.prototype = { |
|
27 observe: function obs_observe (theSubject, theTopic, theData) |
|
28 { |
|
29 this.timeToFinish = true; |
|
30 try{ |
|
31 var ir = theSubject.QueryInterface(this.window.SpecialPowers.Ci |
|
32 .nsIChannel).notificationCallbacks; |
|
33 if (!ir) { |
|
34 this.timeToFinish = false; |
|
35 return; |
|
36 } |
|
37 this.window.ok(true, "No exception thrown"); |
|
38 |
|
39 this.window.is(ir.toString().indexOf(this.window.SpecialPowers.Ci.nsIInterfaceRequestor) != -1, |
|
40 true, "Must be an interface requestor"); |
|
41 |
|
42 if (ir instanceof this.window.SpecialPowers.Ci.nsIClassInfo) { |
|
43 var count = {}; |
|
44 var interfaces = ir. |
|
45 QueryInterface(this.window.SpecialPowers.Ci.nsIClassInfo). |
|
46 getInterfaces(count). |
|
47 map(function(id) { |
|
48 return this.window.SpecialPowers.CiByID[id].toString(); |
|
49 }); |
|
50 this.window.isnot(interfaces.indexOf("nsIInterfaceRequestor"), -1, |
|
51 "Must have interface requestor classinfo"); |
|
52 } |
|
53 } catch(ex) { |
|
54 this.window.is(true, false, "Exception thrown " + ex); |
|
55 } finally { |
|
56 if (this.timeToFinish) { |
|
57 this.remove(); |
|
58 this.window.SimpleTest.finish(); |
|
59 this.window = null; |
|
60 } |
|
61 } |
|
62 }, |
|
63 |
|
64 remove: function obs_remove() |
|
65 { |
|
66 SpecialPowers.removeObserver(this, "http-on-modify-request"); |
|
67 } |
|
68 } |
|
69 |
|
70 var o; |
|
71 |
|
72 SimpleTest.waitForExplicitFinish(); |
|
73 addLoadEvent(function() { |
|
74 var doc = document.implementation.createDocument("", "", null); |
|
75 o = new obs(); |
|
76 doc.load(window.location.href); |
|
77 }); |
|
78 |
|
79 </script> |
|
80 </pre> |
|
81 </body> |
|
82 </html> |
|
83 |