Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Unified Diff: LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered.html

Issue 392993005: Custom handlers should throw SecurityError exception if the URL's origin differs from the document'… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Done Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
« no previous file with comments | « no previous file | LayoutTests/http/tests/navigatorcontentutils/is-protocol-handler-registered-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698