| <!DOCTYPE html> |
| <html> |
| <head> |
| <meta charset="utf-8"> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script> |
| description("Tests to ensure that attributes are not set when an exceptions is raised while converting argument to JSValue."); |
| 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() { |
| var select = document.getElementById("select"); |
| try { |
| setName(select); |
| } catch(e) { |
| } |
| shouldBe('select.name', '"select"'); |
| |
| try { |
| setSelectedIndex(select); |
| } catch(e) { |
| } |
| shouldBe('select.selectedIndex', '1'); |
| } |
| </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> |
| <p id="description"></p> |
| <script src="../../resources/js-test-pre.js"></script> |
| </body> |
| </html> |