Index: LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html |
diff --git a/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html b/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6e2e53d44e81cf4441b0c185e17a2a0a55b74fff |
--- /dev/null |
+++ b/LayoutTests/fast/dom/navigatorcontentutils/is-protocol-handler-registered.html |
@@ -0,0 +1,43 @@ |
+<!DOCTYPE html> |
+<html> |
+<head> |
+<script src="../../../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.navigator.isProtocolHandlerRegistered) |
+ debug('PASS window.navigator.isProtocolHandlerRegistered is defined.'); |
+else |
+ debug('FAIL window.navigator.isProtocolHandlerRegistered is not defined.'); |
+ |
+var invalidUrl = "%S"; |
+var succeeded = false; |
+try { |
+ window.navigator.isProtocolHandlerRegistered(protocol, invalidUrl); |
+ succeeded = false; |
+} catch (e) { |
+ succeeded = true; |
+} |
+if (succeeded) |
+ debug('PASS Invalid url "' + invalidUrl + '" threw SyntaxError exception.'); |
+else |
+ debug('FAIL Invalid url "' + invalidUrl + '" allowed.'); |
+ |
+// FIXME: Need to check if this function can return 'registered' and 'declined' states as well. |
+try { |
+ var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid protocol %s"); |
+ if (state == "new") |
+ debug('PASS window.navigator.isProtocolHandlerRegistered returns "new" state'); |
+ else |
+ debug("FAIL window.navigator.isProtocolHandlerRegistered doesn't return the default state."); |
+} catch (e) { |
+ debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".'); |
+} |
+</script> |
+</body> |
+</html> |