Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Add a test case for navigator.isProtocolHandlerRegistered
https://bugs.webkit.org/show_bug.cgi?id=128302 Reviewed by Anders Carlsson. Add a test case for navigator.isProtocolHandlerRegistered. This new test will check if "navigator.isProtocolHandlerRegistered" throws the proper exceptions and returns a proper state of handler. Currently, this function is only supported by EFL WK1 port. * fast/dom/is-protocol-handler-registered-expected.txt: Added. * fast/dom/is-protocol-handler-registered.html: Added. * platform/efl-wk2/TestExpectations: Skip this test. * platform/gtk/TestExpectations: ditto. * platform/mac/TestExpectations: ditto. Canonical link: https://commits.webkit.org/146379@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@163607 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
76 additions
and 0 deletions.
- +19 −0 LayoutTests/ChangeLog
- +6 −0 LayoutTests/fast/dom/is-protocol-handler-registered-expected.txt
- +42 −0 LayoutTests/fast/dom/is-protocol-handler-registered.html
- +3 −0 LayoutTests/platform/efl-wk2/TestExpectations
- +3 −0 LayoutTests/platform/gtk/TestExpectations
- +3 −0 LayoutTests/platform/mac/TestExpectations
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,6 @@ | ||
This test makes sure that navigator.isProtocolHandlerRegistered throws the proper exceptions and returns the default state of handler. | ||
|
||
PASS window.navigator.isProtocolHandlerRegistered is defined. | ||
PASS Invalid url "%S" threw SyntaxError exception. | ||
PASS window.navigator.isProtocolHandlerRegistered returns "registered" state | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,42 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../../resources/js-test-pre.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.'); | ||
|
||
try { | ||
var state = window.navigator.isProtocolHandlerRegistered("bitcoin", "valid protocol %s"); | ||
if (state == "registered") | ||
debug('PASS window.navigator.isProtocolHandlerRegistered returns "registered" 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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters