|
1 <html xmlns="http://www.w3.org/1999/xhtml"> |
|
2 |
|
3 <head> |
|
4 <title>Gracefully handle setting a field on a bad |this|</title> |
|
5 |
|
6 <bindings xmlns="http://www.mozilla.org/xbl"> |
|
7 <binding id="a"> |
|
8 <implementation> |
|
9 <field name="f">17</field> |
|
10 </implementation> |
|
11 </binding> |
|
12 </bindings> |
|
13 |
|
14 <script type="application/javascript"> |
|
15 window.onload = function() |
|
16 { |
|
17 var bound = document.getElementById("bound"); |
|
18 try |
|
19 { |
|
20 Object.getPrototypeOf(bound).f = 42; |
|
21 } |
|
22 catch (e) { /* Throwing's fine, crashing isn't. */ } |
|
23 }; |
|
24 </script> |
|
25 </head> |
|
26 |
|
27 <body> |
|
28 <div id="bound" style="-moz-binding: url(#a)"></div> |
|
29 </body> |
|
30 |
|
31 </html> |