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

Unified Diff: LayoutTests/navigatorcontentutils/register-protocol-handler.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: Created 6 years, 5 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
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");

Powered by Google App Engine
This is Rietveld 408576698