Index: LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered.html |
diff --git a/LayoutTests/navigatorcontentutils/is-protocol-handler-registered.html b/LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered.html |
similarity index 80% |
rename from LayoutTests/navigatorcontentutils/is-protocol-handler-registered.html |
rename to LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered.html |
index 0fd435a5eeda422588f1017236952b2a19112f40..efa54f37c16a54aee2d77330d9ee4a05aa18dfd2 100644 |
--- a/LayoutTests/navigatorcontentutils/is-protocol-handler-registered.html |
+++ b/LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered.html |
@@ -1,15 +1,12 @@ |
<!DOCTYPE html> |
<html> |
<head> |
-<script src="../resources/js-test.js"></script> |
+<script src="/js-test-resources/js-test.js"></script> |
</head> |
<body> |
<p>This test makes sure that navigator.isProtocolHandlerRegistered throws the proper exceptions and returns the default state of handler.</p> |
<pre id="console"></pre> |
<script> |
-if (window.testRunner) |
- testRunner.dumpAsText(); |
- |
if (window.internals) |
internals.setNavigatorContentUtilsClientMock(document); |
@@ -47,6 +44,21 @@ invalid_schemes.forEach(function (scheme) { |
debug('FAIL Invalid scheme "' + scheme + '" allowed. Threw exception: "' + errorMessage + '".'); |
}); |
+// 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.isProtocolHandlerRegistered('web+myprotocol', "http://www.example.com/soup?url=%s"); |
+} catch (e) { |
+ succeeded = true; |
+ errorMessage = e.message; |
+} |
+ |
+if (succeeded) |
+ debug('PASS URL with origin different than document origin threw SecurityError exception: "' + errorMessage + '".'); |
+else |
+ debug('FAIL URL with origin different than document origin is allowed.'); |
+ |
debug("\nCheck if isProtocolHandlerRegistered() works correctly. If isProtocolHandlerRegistered() returns 'new' state, it works well."); |
debug("'bitcoin' scheme will be registered, and then checks if the 'bitcoin' scheme is registered by isProtocolHandlerRegistered().\n"); |
try { |