| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> | 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> | 5 </head> |
| 6 <body> | 6 <body> |
| 7 <script src="script-tests/invalid-protocol.js"></script> | 7 <script> |
| 8 description("Test URL protocol setter."); |
| 9 |
| 10 var a = document.createElement("a"); |
| 11 a.setAttribute("href", "http://www.apple.com/"); |
| 12 document.body.appendChild(a); |
| 13 |
| 14 shouldThrow("location.protocol = ''", '"SyntaxError: Failed to set the \'protoco
l\' property on \'Location\': \'\' is an invalid protocol."'); |
| 15 shouldThrow("location.protocol = ':'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \':\' is an invalid protocol."'); |
| 16 shouldThrow("location.protocol = 'é'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'é\' is an invalid protocol."'); |
| 17 shouldThrow("location.protocol = '['", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'[\' is an invalid protocol."'); |
| 18 shouldThrow("location.protocol = '0'", '"SyntaxError: Failed to set the \'protoc
ol\' property on \'Location\': \'0\' is an invalid protocol."'); |
| 19 |
| 20 // IE raises exceptions for anchors, too - but Firefox does not. In either case,
protocol shouldn't change. |
| 21 try { a.protocol = '' } catch (ex) { } |
| 22 try { a.protocol = 'é' } catch (ex) { } |
| 23 try { a.protocol = '[' } catch (ex) { } |
| 24 try { a.protocol = '0' } catch (ex) { } |
| 25 shouldBe("a.protocol", "'http:'"); |
| 26 |
| 27 a.protocol = "https"; |
| 28 shouldBe("a.href", "'https://www.apple.com/'"); |
| 29 |
| 30 a.protocol = "http:"; |
| 31 shouldBe("a.href", "'http://www.apple.com/'"); |
| 32 |
| 33 a.protocol = "https://foobar"; |
| 34 shouldBe("a.href", "'https://www.apple.com/'"); |
| 35 </script> |
| 8 </body> | 36 </body> |
| 9 </html> | 37 </html> |
| OLD | NEW |