1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/xbl/test/test_bug371724.xhtml Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +<?xml version="1.0" encoding="UTF-8"?> 1.5 +<html xmlns="http://www.w3.org/1999/xhtml"> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=371724 1.8 +--> 1.9 +<head> 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 + <bindings xmlns="http://www.mozilla.org/xbl"> 1.13 + <binding id="rd"> 1.14 + <implementation> 1.15 + <property name="hallo" onget="return true;" readonly="true" exposeToUntrustedContent="true"/> 1.16 + </implementation> 1.17 + </binding> 1.18 + </bindings> 1.19 +</head> 1.20 +<body> 1.21 + <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=371724">Mozilla Bug 371724</a> 1.22 + <p id="display"></p> 1.23 + <div id="content" style="display: none"></div> 1.24 + <div id="a" style="-moz-binding:url('#rd');">Success!</div> 1.25 + <pre id="test"> 1.26 + <script class="testbody" type="text/javascript"> 1.27 + /** Test for Bug 371724 **/ 1.28 + SimpleTest.waitForExplicitFinish(); 1.29 + function checkReadOnly() { 1.30 + var elt = document.getElementById('a'); 1.31 + var oldValue = elt.hallo; 1.32 + var actual; 1.33 + try { 1.34 + elt.hallo = false; 1.35 + actual = elt.hallo; 1.36 + } catch (ex) { 1.37 + actual = "" + ex; 1.38 + } 1.39 + is(actual, true, 1.40 + "Setting a readonly xbl property should do nothing if !strict"); 1.41 + checkReadOnlyStrict(); 1.42 + } 1.43 + function checkReadOnlyStrict() { 1.44 + "use strict"; 1.45 + var elt = document.getElementById('a'); 1.46 + var actual; 1.47 + try { 1.48 + elt.hallo = false; 1.49 + actual = "should have thrown"; 1.50 + } catch (ex) { 1.51 + actual = ex instanceof TypeError; 1.52 + } 1.53 + is(actual, true, 1.54 + "Setting a readonly xbl property should throw a TypeError exception if strict"); 1.55 + SimpleTest.finish(); 1.56 + } 1.57 + addLoadEvent(checkReadOnly); 1.58 + </script> 1.59 + </pre> 1.60 +</body> 1.61 +</html>