Index: LayoutTests/http/tests/navigatorcontentutils/register-protocol-handler.html |
diff --git a/LayoutTests/navigatorcontentutils/register-protocol-handler.html b/LayoutTests/http/tests/navigatorcontentutils/register-protocol-handler.html |
similarity index 87% |
rename from LayoutTests/navigatorcontentutils/register-protocol-handler.html |
rename to LayoutTests/http/tests/navigatorcontentutils/register-protocol-handler.html |
index 9b68afa0fdc5c7e512b728c7fb2e237e74444275..cdf3857fcf63edfcecad36da52dda51e453c7c0a 100644 |
--- a/LayoutTests/navigatorcontentutils/register-protocol-handler.html |
+++ b/LayoutTests/http/tests/navigatorcontentutils/register-protocol-handler.html |
@@ -1,14 +1,11 @@ |
<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.registerProtocolHandler throws the proper exceptions and has no-op default implementation.</p> |
<pre id="console"></pre> |
<script> |
-if (window.testRunner) |
- testRunner.dumpAsText(); |
- |
if (window.internals) |
internals.setNavigatorContentUtilsClientMock(document); |
@@ -82,6 +79,21 @@ invalid_urls.forEach(function (url) { |
debug('FAIL Invalid url "' + url + '" allowed.'); |
}); |
+// 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.registerProtocolHandler('web+myprotocol', "http://www.example.com/soup?url=%s", "title"); |
+} 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.'); |
+ |
// Test that the API has default no-op implementation. |
var succeeded = true; |
try { |