Index: LayoutTests/navigatorcontentutils/unregister-protocol-handler.html |
diff --git a/LayoutTests/navigatorcontentutils/unregister-protocol-handler.html b/LayoutTests/navigatorcontentutils/unregister-protocol-handler.html |
index b6180f93e6e679c119a050b860e816e0f61852b7..51926ddb73882933b1e53900c42575dafddecf35 100644 |
--- a/LayoutTests/navigatorcontentutils/unregister-protocol-handler.html |
+++ b/LayoutTests/navigatorcontentutils/unregister-protocol-handler.html |
@@ -94,6 +94,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. |
+succeeded = false; |
+var errorMessage; |
+try { |
+ window.navigator.unregisterProtocolHandler('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 unregisterProtocolHandler can unregister protocol. |
debug("\nCheck if unregisterProtocolHandler can unregister protocol correctly. If isProtocolHandlerRegistered() returns 'new' state, unregisterProtoclHandler() works well."); |
debug("'bitcoin' protocol will be registered and unregistered for testing.\n"); |