Index: LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html |
diff --git a/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html b/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html |
deleted file mode 100644 |
index 28d721949c8712a5d372a7ddfef8abe78a86bb90..0000000000000000000000000000000000000000 |
--- a/LayoutTests/fast/dom/navigatorcontentutils/unregister-protocol-handler.html |
+++ /dev/null |
@@ -1,126 +0,0 @@ |
-<html> |
-<head> |
-<script src="../../../resources/js-test.js"></script> |
-</head> |
-<body> |
-<p>This test makes sure that navigator.unregisterProtocolHandler 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); |
- |
-if (window.navigator.unregisterProtocolHandler) |
- debug('PASS window.navigator.unregisterProtocolHandler is defined.'); |
-else |
- debug('FAIL window.navigator.unregisterProtocolHandler is not defined.'); |
- |
-var invalid_protocols = ['http', 'https', 'file', 'web+']; |
-invalid_protocols.forEach(function (protocol) { |
- var succeeded = false; |
- try { |
- window.navigator.unregisterProtocolHandler(protocol, "invalid protocol %s", "title"); |
- } catch (e) { |
- succeeded = 'SecurityError' == e.name; |
- errorMessage = e.message; |
- } |
- |
- if (succeeded) |
- debug('PASS Invalid protocol "' + protocol + '" threw SecurityError exception: "' + errorMessage + '".'); |
- else |
- debug('FAIL Invalid protocol "' + protocol + '" allowed.'); |
-}); |
- |
-var valid_protocols = ['bitcoin', 'BitcoIn', 'geo', 'im', 'irc', 'Irc', 'ircs', 'magnet', 'MagneT', 'mailto', 'mms', 'news', 'nntp', 'sip', 'sms', 'smsto', 'SmsTo', 'ssh', 'tel', 'urn', 'webcal', 'WebCAL', 'wtai', 'WTAI', 'xmpp']; |
-valid_protocols.forEach(function (protocol) { |
- var succeeded = false; |
- try { |
- window.navigator.unregisterProtocolHandler(protocol, "valid protocol %s", "title"); |
- succeeded = true; |
- } catch (e) { |
- succeeded = false; |
- } |
- |
- if (succeeded) |
- debug('PASS Valid protocol "' + protocol + '" allowed.'); |
- else |
- debug('FAIL Valid protocol "' + protocol + '" failed.'); |
-}); |
- |
-var invalid_schemes = ['mailto:', 'ssh:/', 'magnet:+', 'tel:sip']; |
-invalid_schemes.forEach(function (scheme) { |
- var succeeded = false; |
- try { |
- window.navigator.unregisterProtocolHandler(scheme, 'invalid scheme uri=%s', 'title'); |
- } catch (e) { |
- succeeded = 'SyntaxError' == e.name; |
- errorMessage = e.message; |
- } |
- |
- if (succeeded) |
- debug('PASS Invalid scheme "' + scheme + '" falied.'); |
- else |
- debug('Fail: Invalid scheme "' + scheme + '" allowed. Threw exception: "' + errorMessage + '".'); |
-}); |
- |
-var invalid_urls = ["", "%S"]; |
-invalid_urls.forEach(function (url) { |
- var succeeded = false; |
- try { |
- window.navigator.unregisterProtocolHandler('web+myprotocol', url, 'title'); |
- } catch (e) { |
- succeeded = 'SyntaxError' == e.name; |
- errorMessage = e.message; |
- } |
- |
- if (succeeded) |
- debug('PASS Invalid url "' + url + '" threw SyntaxError exception.' + errorMessage + '".'); |
- else |
- debug('FAIL Invalid url "' + url + '" allowed.'); |
-}); |
- |
-// Test that the API has default no-op implementation. |
-var succeeded = true; |
-try { |
- window.navigator.unregisterProtocolHandler('web+myprotocol', "%s", "title"); |
-} catch (e) { |
- succeeded = false; |
-} |
- |
-if (succeeded) |
- debug('PASS Valid call succeeded.'); |
-else |
- debug('FAIL Invalid call did not succeed.'); |
- |
-// Check if unregisterProtocolHandler can unregister protocol. |
-debug("\nCheck if unregisterProtocolHandler can unregister protocol correctly. If isProtocolHandlerRegistered() returns 'new' state, unregisterProtoclHandler() works well."); |
-debug("'bitcoin' protocol will be registered and unregistered for testing.\n"); |
-try { |
- // Register 'bitcoin' protocol for testing. |
- window.navigator.registerProtocolHandler('bitcoin', 'invalid scheme uri=%s', 'title'); |
- var state = window.navigator.isProtocolHandlerRegistered('bitcoin', 'valid protocol %s'); |
- if (state == "registered") |
- debug("PASS window.navigator.isProtocolHandlerRegistered returns 'registered' state. 'bitcoin' is registered successfully."); |
- else if (state == "new") |
- debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'new' state. Fail to register 'bitcoin' protocol."); |
- else if (state == "declined") |
- debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declined' state. Fail to register 'bitcoin' protocol."); |
- |
- window.navigator.unregisterProtocolHandler('bitcoin', 'invalid scheme uri=%s'); |
- var state = window.navigator.isProtocolHandlerRegistered('bitcoin', 'valid protocol %s'); |
- if (state == "new") |
- debug("PASS window.navigator.isProtocolHandlerRegistered returns 'new' state. 'bitcoin' is unregistered successfully."); |
- else if (state == "registered") |
- debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'registered' state. Fail to unregister 'bitcoin' protocol."); |
- else if (state == "declined") |
- debug("FAIL window.navigator.isProtocolHandlerRegistered returns 'declined' state. Fail to unregister 'bitcoin' protocol."); |
-} catch (e) { |
- debug('FAIL window.navigator.isProtocolHandlerRegistered call is failed: "' + e.message + '".'); |
-} |
-debug("\n"); |
- |
-</script> |
-</body> |
-</html> |