|
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=780529 |
|
6 --> |
|
7 <window title="Mozilla Bug 780529" |
|
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=780529" |
|
14 target="_blank">Mozilla Bug 780529</a> |
|
15 </body> |
|
16 |
|
17 <!-- test code goes here --> |
|
18 <script type="application/javascript"> |
|
19 <![CDATA[ |
|
20 /** Test for Bug 780529 **/ |
|
21 var req = new XMLHttpRequest(); |
|
22 req.open("GET", "", true); |
|
23 // Have to call send() to get the XHR hooked up as the notification callbacks |
|
24 req.send(); |
|
25 var callbacks = req.channel.notificationCallbacks; |
|
26 var sink = callbacks.getInterface(Components.interfaces.nsIChannelEventSink); |
|
27 ok(sink instanceof Components.interfaces.nsIChannelEventSink, |
|
28 "Should be a channel event sink") |
|
29 ok("asyncOnChannelRedirect" in sink, |
|
30 "Should have the right methods for an event sink"); |
|
31 |
|
32 is(callbacks.getInterface(Components.interfaces.nsIXMLHttpRequest), req, |
|
33 "Should have the right object"); |
|
34 sinkReq = sink.QueryInterface(Components.interfaces.nsIInterfaceRequestor); |
|
35 isnot(sinkReq, callbacks, "Sink should not be the XHR object"); |
|
36 is(sinkReq.getInterface(Components.interfaces.nsIXMLHttpRequest), req, |
|
37 "Should have the XHR object now"); |
|
38 ]]> |
|
39 </script> |
|
40 </window> |