[tbb-commits] [tor-browser/tor-browser-60.2.1esr-8.5-1] Bug 680300 - Part 2: Add a test case for ensuring no error reporting when loading an unknown protocol. r=smaug
gk at torproject.org
gk at torproject.org
Tue Oct 9 10:03:57 UTC 2018
commit 0a5a1991dec543177e78283f27407e2a6d4892d8
Author: Tim Huang <tihuang at mozilla.com>
Date: Sun Sep 23 22:24:05 2018 +0000
Bug 680300 - Part 2: Add a test case for ensuring no error reporting when loading an unknown protocol. r=smaug
This test case will try to navigate an iframe to an unknown protocol and
check whether no errors been reported.
Differential Revision: https://phabricator.services.mozilla.com/D3493
--HG--
extra : moz-landing-system : lando
---
uriloader/exthandler/tests/mochitest/mochitest.ini | 1 +
.../test_unknown_ext_protocol_handlers.html | 28 ++++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/uriloader/exthandler/tests/mochitest/mochitest.ini b/uriloader/exthandler/tests/mochitest/mochitest.ini
index 266d783e569b..12ffa16a4233 100644
--- a/uriloader/exthandler/tests/mochitest/mochitest.ini
+++ b/uriloader/exthandler/tests/mochitest/mochitest.ini
@@ -8,5 +8,6 @@ support-files =
[test_handlerApps.xhtml]
skip-if = (toolkit == 'android' || os == 'mac') || e10s # OS X: bug 786938
scheme = https
+[test_unknown_ext_protocol_handlers.html]
[test_unsafeBidiChars.xhtml]
[test_web_protocol_handlers.html]
diff --git a/uriloader/exthandler/tests/mochitest/test_unknown_ext_protocol_handlers.html b/uriloader/exthandler/tests/mochitest/test_unknown_ext_protocol_handlers.html
new file mode 100644
index 000000000000..9a399e486257
--- /dev/null
+++ b/uriloader/exthandler/tests/mochitest/test_unknown_ext_protocol_handlers.html
@@ -0,0 +1,28 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Test for no error reporting for unknown external protocols</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<iframe id="testFrame"></iframe>
+<script type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+window.onload = () => {
+ let testFrame = document.getElementById("testFrame");
+
+ try {
+ testFrame.contentWindow.location.href = "unknownextproto:";
+ ok(true, "There is no error reporting for unknown external protocol navigation.");
+ } catch (e) {
+ ok(false, "There should be no error reporting for unknown external protocol navigation.");
+ }
+
+ SimpleTest.finish();
+}
+</script>
+</body>
+</html>
More information about the tbb-commits
mailing list