Index: LayoutTests/navigatorcontentutils/register-protocol-handler.html |
diff --git a/LayoutTests/navigatorcontentutils/register-protocol-handler.html b/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
index 5501432fa49436f100272390e8ab95ad2cd87286..8a73295ed4b2831b2b2414c6da9ad3733ec8a239 100644 |
--- a/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
+++ b/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
@@ -95,6 +95,21 @@ if (succeeded) |
else |
debug('FAIL Invalid call did not succeed.'); |
+// Test that the API throws SecurityError exception if the URL's origin differs from the document's origin. |
gyuyoung-inactive
2014/07/16 06:20:17
I think it would be nicer to move this test to inv
pals
2014/07/18 14:17:53
Done.
|
+succeeded = false; |
+var errorMessage; |
+try { |
+ window.navigator.registerProtocolHandler('web+myprotocol', "http://www.example.com/soup?url=%s", "title"); |
+} catch (e) { |
+ succeeded = true; |
+ errorMessage = e.message; |
+} |
+ |
+if (succeeded) |
+ debug('PASS Invalid url threw SecurityError exception: "' + errorMessage + '".'); |
+else |
+ debug('FAIL URL with origin different than document origin is allowed.'); |
+ |
// Check if registerProtocolHandler can register protocol. |
debug("\nCheck if registerProtocolHandler can register protocol correctly. If isProtocolHandlerRegistered() returns 'registered' state, registerProtoclHandler() works well."); |
debug("'bitcoin' protocol will be registered for testing.\n"); |