|
1 <?xml version="1.0"?> |
|
2 <bindings id="chromeTestBindings" xmlns="http://www.mozilla.org/xbl"> |
|
3 <binding id="testBinding"> |
|
4 <implementation implements="nsIObserver"> |
|
5 <constructor> |
|
6 <![CDATA[ |
|
7 // This binding gets applied to a content object, and thus is actually |
|
8 // running in a content XBL scope. |
|
9 var win = XPCNativeWrapper.unwrap(window); |
|
10 var SpecialPowers = win.SpecialPowers; |
|
11 var ok = SpecialPowers.unwrap(SpecialPowers.wrap(window).parent.ok); |
|
12 ok(win != window, "Should be running in an XBL scope with Xrays"); |
|
13 |
|
14 // Generate an XPCWrappedJS for the reflector. We need to do this |
|
15 // explicitly with a testing helper, because we're converging on |
|
16 // removing XPConnect from the web, which means that it won't be |
|
17 // possible to generate an XPCWrappedJS from content (or XBL) code. |
|
18 var scope = {}; |
|
19 var holder = SpecialPowers.Cu.generateXPCWrappedJS(this, scope); |
|
20 |
|
21 // Now, QI |this|, which will generate an aggregated native. |
|
22 this.QueryInterface(Components.interfaces.nsIObserver); |
|
23 |
|
24 ok(true, "Didn't assert or crash"); |
|
25 |
|
26 SpecialPowers.wrap(window).parent.SimpleTest.finish(); |
|
27 ]]> |
|
28 </constructor> |
|
29 <method name="observe"> |
|
30 <parameter name="aSubject"/> |
|
31 <parameter name="aTopic"/> |
|
32 <parameter name="aData"/> |
|
33 <body><![CDATA[]]></body> |
|
34 </method> |
|
35 </implementation> |
|
36 </binding> |
|
37 </bindings> |