| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test.js"></script> |
| <script> |
| description("Tests to ensure that attributes are not set when an exceptions is raised while converting argument to JSValue."); |
| window.jsTestIsAsync = true; |
| function setName(select) { |
| var stringLike = { |
| toString: function() { |
| throw new Error("error"); |
| } |
| }; |
| select.name = stringLike; |
| } |
| |
| function setSelectedIndex(select) { |
| var integerLike = { |
| valueOf: function() { |
| throw new Error("error"); |
| } |
| }; |
| select.selectedIndex = integerLike; |
| } |
| |
| function runTest() { |
| shouldThrow('setName(select)'); |
| shouldBe('select.name', '"select"'); |
| |
| shouldThrow('setSelectedIndex(select)'); |
| shouldBe('select.selectedIndex', '1'); |
| finishJSTest(); |
| } |
| </script> |
| </head> |
| <body onload="runTest()"> |
| <select id="select" name="select"> |
| <option value="value1">Value 1</option> |
| <option value="value2" selected>Value 2</option> |
| <option value="value3">Value 3</option> |
| </select> |
| </body> |
| </html> |