1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/test/test_bug389322.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,126 @@ 1.4 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.5 +<!-- 1.6 +https://bugzilla.mozilla.org/show_bug.cgi?id=389322 1.7 +--> 1.8 +<head> 1.9 + <title>Test for Bug 389322</title> 1.10 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.11 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.12 + <script>var ctorRan = false;</script> 1.13 + <bindings xmlns="http://www.mozilla.org/xbl"> 1.14 + <binding id="test"> 1.15 + <implementation> 1.16 + <field name="field"><![CDATA[ 1.17 + (function () { 1.18 + try { 1.19 + let (x=1) (x); 1.20 + var success = true; 1.21 + } 1.22 + catch (e) { success = false; } 1.23 + XPCNativeWrapper.unwrap(window).report("XBL fields", success) 1.24 + return "" 1.25 + }()) 1.26 + ]]></field> 1.27 + <property name="property"> 1.28 + <getter><![CDATA[ 1.29 + try { 1.30 + let (x=1) (x); 1.31 + var success = true; 1.32 + } 1.33 + catch (e) { success = false; } 1.34 + XPCNativeWrapper.unwrap(window).report("XBL property getters", success) 1.35 + return 1 1.36 + ]]></getter> 1.37 + <setter><![CDATA[ 1.38 + try { 1.39 + let (x=1) (x); 1.40 + var success = true 1.41 + } 1.42 + catch (e) { success = false } 1.43 + XPCNativeWrapper.unwrap(window).report("XBL property setters", success) 1.44 + return val 1.45 + ]]></setter> 1.46 + </property> 1.47 + <method name="method"> 1.48 + <body><![CDATA[ 1.49 + try { 1.50 + let (x=1) (x); 1.51 + var success = true; 1.52 + } 1.53 + catch (e) { success = false; } 1.54 + XPCNativeWrapper.unwrap(window).report("XBL methods", success) 1.55 + ]]></body> 1.56 + </method> 1.57 + <constructor><![CDATA[ 1.58 + this.property += 1 1.59 + var x = this.field; 1.60 + this.method() 1.61 + try { 1.62 + let (x=1) (x); 1.63 + var success = true 1.64 + } 1.65 + catch (e) { success = false } 1.66 + var win = XPCNativeWrapper.unwrap(window); 1.67 + win.report("XBL constructors", success) 1.68 + 1.69 + var ev = document.createEvent("Events") 1.70 + ev.initEvent("custom", false, false) 1.71 + this.dispatchEvent(ev) 1.72 + win.ctorRan = true; 1.73 + ]]></constructor> 1.74 + </implementation> 1.75 + <handlers> 1.76 + <handler action=' 1.77 + try { 1.78 + let (x=1) (x); 1.79 + var success = true 1.80 + } 1.81 + catch (e) { success = false } 1.82 + report("XBL event handlers", success); 1.83 + ' event="custom"/> 1.84 + </handlers> 1.85 + </binding> 1.86 + </bindings> 1.87 +</head> 1.88 +<body> 1.89 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=389322">Mozilla Bug 389322</a> 1.90 +<p id="display" style="-moz-binding: url(#test)"></p> 1.91 +<div id="content" style="display: none"> 1.92 + 1.93 +</div> 1.94 +<pre id="test"> 1.95 +<script class="testbody" type="text/javascript"> 1.96 +<![CDATA[ 1.97 + 1.98 +/** Test for Bug 389322 **/ 1.99 +SimpleTest.waitForExplicitFinish(); 1.100 +addLoadEvent(function() { 1.101 + is(ctorRan, true, "Constructor should have run"); 1.102 +}); 1.103 +addLoadEvent(SimpleTest.finish); 1.104 + 1.105 +function report(testName, success) { 1.106 + is(success, true, "JS 1.7 should work in " + testName); 1.107 +} 1.108 +]]> 1.109 +</script> 1.110 +<script type="text/javascript; version=1.7"><![CDATA[ 1.111 + try { 1.112 + let (x=1) (x); 1.113 + var success = true; 1.114 + } 1.115 + catch (e) { success = false; } 1.116 + report("HTML script tags with explicit version", success) 1.117 +]]></script> 1.118 +<script type="text/javascript"><![CDATA[ 1.119 + try { 1.120 + let (x=1) (x); 1.121 + var success = false; 1.122 + } 1.123 + catch (e) { success = true; } 1.124 + is(success, true, "JS 1.7 should not work in versionless HTML script tags"); 1.125 +]]></script> 1.126 +</pre> 1.127 +</body> 1.128 +</html> 1.129 +