|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
|
3 <?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id= |
|
6 --> |
|
7 <window title="Mozilla Bug " |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
10 |
|
11 <!-- test results are displayed in the html:body --> |
|
12 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
13 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=" |
|
14 target="_blank">Mozilla Bug </a> |
|
15 </body> |
|
16 |
|
17 <!-- test code goes here --> |
|
18 <script type="application/javascript"> |
|
19 <![CDATA[ |
|
20 /** Test for Bug **/ |
|
21 var obs = Components.classes["@mozilla.org/observer-service;1"] |
|
22 .getService(Components.interfaces.nsIObserverService); |
|
23 var didCall = false; |
|
24 var observer = { |
|
25 QueryInterface: function QueryInterface(aIID) { |
|
26 if (aIID.equals(Components.interfaces.nsIObserver) || |
|
27 aIID.equals(Components.interfaces.nsISupports)) |
|
28 return this; |
|
29 throw Components.results.NS_NOINTERFACE; |
|
30 }, |
|
31 observe: function(subject, topic, data) { |
|
32 obs.removeObserver(observer, "cycle-collector-begin"); |
|
33 observer = null; |
|
34 didCall = true; |
|
35 } |
|
36 }; |
|
37 |
|
38 obs.addObserver(observer, "cycle-collector-begin", false); |
|
39 window.QueryInterface(Components.interfaces.nsIInterfaceRequestor) |
|
40 .getInterface(Components.interfaces.nsIDOMWindowUtils).cycleCollect(); |
|
41 |
|
42 ok(didCall, "Observer should have been called!"); |
|
43 ]]> |
|
44 </script> |
|
45 </window> |