1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/test/file_bug950909.xml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,37 @@ 1.4 +<?xml version="1.0"?> 1.5 +<bindings id="chromeTestBindings" xmlns="http://www.mozilla.org/xbl"> 1.6 + <binding id="testBinding"> 1.7 + <implementation implements="nsIObserver"> 1.8 + <constructor> 1.9 + <![CDATA[ 1.10 + // This binding gets applied to a content object, and thus is actually 1.11 + // running in a content XBL scope. 1.12 + var win = XPCNativeWrapper.unwrap(window); 1.13 + var SpecialPowers = win.SpecialPowers; 1.14 + var ok = SpecialPowers.unwrap(SpecialPowers.wrap(window).parent.ok); 1.15 + ok(win != window, "Should be running in an XBL scope with Xrays"); 1.16 + 1.17 + // Generate an XPCWrappedJS for the reflector. We need to do this 1.18 + // explicitly with a testing helper, because we're converging on 1.19 + // removing XPConnect from the web, which means that it won't be 1.20 + // possible to generate an XPCWrappedJS from content (or XBL) code. 1.21 + var scope = {}; 1.22 + var holder = SpecialPowers.Cu.generateXPCWrappedJS(this, scope); 1.23 + 1.24 + // Now, QI |this|, which will generate an aggregated native. 1.25 + this.QueryInterface(Components.interfaces.nsIObserver); 1.26 + 1.27 + ok(true, "Didn't assert or crash"); 1.28 + 1.29 + SpecialPowers.wrap(window).parent.SimpleTest.finish(); 1.30 + ]]> 1.31 + </constructor> 1.32 + <method name="observe"> 1.33 + <parameter name="aSubject"/> 1.34 + <parameter name="aTopic"/> 1.35 + <parameter name="aData"/> 1.36 + <body><![CDATA[]]></body> 1.37 + </method> 1.38 + </implementation> 1.39 + </binding> 1.40 +</bindings>