| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <meta charset="utf-8"> | 4 <script src="../../resources/js-test.js"></script> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script> |
| 6 <script> | 6 description("Tests to ensure that attributes are not set when an exceptions is r
aised while converting argument to JSValue."); |
| 7 description("Tests to ensure that attributes are not set when an exceptions
is raised while converting argument to JSValue."); | 7 window.jsTestIsAsync = true; |
| 8 function setName(select) { | 8 function setName(select) { |
| 9 var stringLike = { | 9 var stringLike = { |
| 10 toString: function() { | 10 toString: function() { |
| 11 throw new Error("error"); | 11 throw new Error("error"); |
| 12 } | 12 } |
| 13 }; | 13 }; |
| 14 select.name = stringLike;; | 14 select.name = stringLike; |
| 15 } | 15 } |
| 16 | 16 |
| 17 function setSelectedIndex(select) { | 17 function setSelectedIndex(select) { |
| 18 var integerLike = { | 18 var integerLike = { |
| 19 valueOf: function() { | 19 valueOf: function() { |
| 20 throw new Error("error"); | 20 throw new Error("error"); |
| 21 } | 21 } |
| 22 }; | 22 }; |
| 23 select.selectedIndex = integerLike;; | 23 select.selectedIndex = integerLike; |
| 24 } | 24 } |
| 25 | 25 |
| 26 function runTest() { | 26 function runTest() { |
| 27 var select = document.getElementById("select"); | 27 shouldThrow('setName(select)'); |
| 28 try { | 28 shouldBe('select.name', '"select"'); |
| 29 setName(select); | |
| 30 } catch(e) { | |
| 31 } | |
| 32 shouldBe('select.name', '"select"'); | |
| 33 | 29 |
| 34 try { | 30 shouldThrow('setSelectedIndex(select)'); |
| 35 setSelectedIndex(select); | 31 shouldBe('select.selectedIndex', '1'); |
| 36 } catch(e) { | 32 finishJSTest(); |
| 37 } | 33 } |
| 38 shouldBe('select.selectedIndex', '1'); | 34 </script> |
| 39 } | 35 </head> |
| 40 </script> | 36 <body onload="runTest()"> |
| 41 | 37 <select id="select" name="select"> |
| 42 </head> | 38 <option value="value1">Value 1</option> |
| 43 <body onload="runTest()"> | 39 <option value="value2" selected>Value 2</option> |
| 44 <select id="select" name="select"> | 40 <option value="value3">Value 3</option> |
| 45 <option value="value1">Value 1</option> | 41 </select> |
| 46 <option value="value2" selected>Value 2</option> | |
| 47 <option value="value3">Value 3</option> | |
| 48 </select> | |
| 49 <p id="description"></p> | |
| 50 <script src="../../resources/js-test.js"></script> | |
| 51 </body> | 42 </body> |
| 52 </html> | 43 </html> |
| OLD | NEW |