|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?> |
|
3 <?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?> |
|
4 <!-- |
|
5 https://bugzilla.mozilla.org/show_bug.cgi?id=565388 |
|
6 --> |
|
7 <window title="Mozilla Bug 565388" |
|
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> |
|
9 |
|
10 <script type="application/javascript" |
|
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
12 |
|
13 <!-- test code goes here --> |
|
14 <script type="application/javascript"> |
|
15 <![CDATA[ |
|
16 |
|
17 /** Test for Bug 565388 **/ |
|
18 SimpleTest.waitForExplicitFinish(); |
|
19 |
|
20 var Ci = Components.interfaces; |
|
21 var Cc = Components.classes; |
|
22 |
|
23 var progressListener = { |
|
24 add: function(docShell, callback) { |
|
25 this.callback = callback; |
|
26 this.docShell = docShell; |
|
27 docShell. |
|
28 QueryInterface(Ci.nsIInterfaceRequestor). |
|
29 getInterface(Ci.nsIWebProgress). |
|
30 addProgressListener(this, Ci.nsIWebProgress.NOTIFY_STATE_WINDOW); |
|
31 }, |
|
32 |
|
33 finish: function() { |
|
34 this.docShell. |
|
35 QueryInterface(Ci.nsIInterfaceRequestor). |
|
36 getInterface(Ci.nsIWebProgress). |
|
37 removeProgressListener(this); |
|
38 this.callback(); |
|
39 }, |
|
40 |
|
41 onStateChange: function (webProgress, req, flags, status) { |
|
42 if (req.name.startsWith("data:application/vnd.mozilla.xul")) { |
|
43 if (flags & Ci.nsIWebProgressListener.STATE_STOP) |
|
44 this.finish(); |
|
45 } |
|
46 }, |
|
47 |
|
48 QueryInterface: function(iid) { |
|
49 if (iid.equals(Components.interfaces.nsIWebProgressListener) || |
|
50 iid.equals(Components.interfaces.nsISupportsWeakReference)) |
|
51 return this; |
|
52 throw Components.results.NS_ERROR_NO_INTERFACE; |
|
53 } |
|
54 } |
|
55 |
|
56 var systemPrincipal = Cc["@mozilla.org/systemprincipal;1"]. |
|
57 createInstance(Ci.nsIPrincipal); |
|
58 var docShell = Cc["@mozilla.org/appshell/appShellService;1"]. |
|
59 getService(Ci.nsIAppShellService). |
|
60 createWindowlessBrowser(true). |
|
61 QueryInterface(Ci.nsIInterfaceRequestor). |
|
62 getInterface(Ci.nsIDocShell); |
|
63 docShell.createAboutBlankContentViewer(systemPrincipal); |
|
64 var win = docShell.contentViewer.DOMDocument.defaultView; |
|
65 |
|
66 progressListener.add(docShell, function(){ |
|
67 is(win.document.documentURI, "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window/>"); |
|
68 SimpleTest.finish(); |
|
69 }); |
|
70 |
|
71 win.location = "data:application/vnd.mozilla.xul+xml;charset=utf-8,<window/>"; |
|
72 |
|
73 ]]> |
|
74 </script> |
|
75 |
|
76 <!-- test results are displayed in the html:body --> |
|
77 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
78 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=565388" |
|
79 target="_blank">Mozilla Bug 565388</a> |
|
80 </body> |
|
81 </window> |