| OLD | NEW |
| (Empty) |
| 1 description("Test URL protocol setter."); | |
| 2 | |
| 3 var a = document.createElement("a"); | |
| 4 a.setAttribute("href", "http://www.apple.com/"); | |
| 5 document.body.appendChild(a); | |
| 6 | |
| 7 shouldThrow("location.protocol = ''", '"SyntaxError: Failed to set the \'protoco
l\' property on \'Location\': \'\' is an invalid protocol."'); | |
| 8 shouldThrow("location.protocol = ':'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \':\' is an invalid protocol."'); | |
| 9 shouldThrow("location.protocol = 'é'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'é\' is an invalid protocol."'); | |
| 10 shouldThrow("location.protocol = '['", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'[\' is an invalid protocol."'); | |
| 11 shouldThrow("location.protocol = '0'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'0\' is an invalid protocol."'); | |
| 12 | |
| 13 // IE raises exceptions for anchors, too - but Firefox does not. In either case,
protocol shouldn't change. | |
| 14 try { a.protocol = '' } catch (ex) { } | |
| 15 try { a.protocol = 'é' } catch (ex) { } | |
| 16 try { a.protocol = '[' } catch (ex) { } | |
| 17 try { a.protocol = '0' } catch (ex) { } | |
| 18 shouldBe("a.protocol", "'http:'"); | |
| 19 | |
| 20 a.protocol = "https"; | |
| 21 shouldBe("a.href", "'https://www.apple.com/'"); | |
| 22 | |
| 23 a.protocol = "http:"; | |
| 24 shouldBe("a.href", "'http://www.apple.com/'"); | |
| 25 | |
| 26 a.protocol = "https://foobar"; | |
| 27 shouldBe("a.href", "'https://www.apple.com/'"); | |
| OLD | NEW |