Bug 1477670 - remove tests for registerContentHandler, r=jkt
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 24 Jul 2018 18:04:10 +0100
changeset 428718 5b714ea69f17d1ea65db4cccc6cfceedabc22260
parent 428717 459a2b0d19bdcf5bea77d915b8d482ad7c4aeabc
child 428719 04ce1d287d583bef07b29a9b9c055ee3a2e94d87
push id34340
push userdvarga@mozilla.com
push dateFri, 27 Jul 2018 17:37:02 +0000
treeherdermozilla-central@d353b80fd66c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjkt
bugs1477670
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1477670 - remove tests for registerContentHandler, r=jkt MozReview-Commit-ID: DIshLjsXnev
browser/components/feeds/test/chrome/chrome.ini
browser/components/feeds/test/chrome/test_423060.xul
browser/components/feeds/test/test_registerHandler.html
--- a/browser/components/feeds/test/chrome/chrome.ini
+++ b/browser/components/feeds/test/chrome/chrome.ini
@@ -2,12 +2,11 @@
 prefs =
   browser.feeds.unsafelyFrameFeeds=true
 
 support-files = sample_feed.atom
   !/browser/components/feeds/test/bug408328-data.xml
   !/browser/components/feeds/test/valid-feed.xml
   !/browser/components/feeds/test/valid-unsniffable-feed.xml
 
-[test_423060.xul]
 [test_bug368464.html]
 [test_bug408328.html]
 [test_maxSniffing.html]
deleted file mode 100644
--- a/browser/components/feeds/test/chrome/test_423060.xul
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
-<?xml-stylesheet
-  href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
-<window title="Make sure feed preview works when a default reader is selected"
-  xmlns:html="http://www.w3.org/1999/xhtml"
-  xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript"
-   src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
-  <body xmlns="http://www.w3.org/1999/xhtml" />
-
-  <script type="application/javascript">
-    SimpleTest.waitForExplicitFinish();
-
-    var wccrID = "@mozilla.org/embeddor.implemented/web-content-handler-registrar;1";
-    /* abort the test if web feed handlers are not available */
-    if (!Cc[wccrID])
-      SimpleTest.finish()
-
-    /* Turn off the first run UI */
-    var prefBranch = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
-    prefBranch.setBoolPref("browser.feeds.showFirstRunUI", false);
-
-    /* register a handler for the feed type */
-    const MAYBE_FEED = "application/vnd.mozilla.maybe.feed";
-    var handlerPage = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=%s";
-    var wccr = Cc[wccrID].getService(Ci.nsIWebContentConverterService);
-    wccr.registerContentHandler(MAYBE_FEED, handlerPage, "Demo handler", null);
-    var demoHandler = wccr.getWebContentHandlerByURI(MAYBE_FEED, handlerPage);
-    wccr.setAutoHandler(MAYBE_FEED, demoHandler);
-
-    /* Don't show the preview page */
-    prefBranch.setCharPref("browser.feeds.handler", "reader");
-
-    function finishUp() {
-      var theframe = document.getElementById('theframe');
-      var previewURL = "http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/demohandler.html?feedurl=http%3A%2F%2Fmochi.test%3A8888%2Ftests%2Ftoolkit%2Fcomponents%2Fplaces%2Ftests%2Fchrome%2Fsample_feed.atom";
-      is(theframe.contentDocument.URL, previewURL);
-
-      /* remove our demoHandler */
-      wccr.setAutoHandler(MAYBE_FEED, null);
-      wccr.removeContentHandler(MAYBE_FEED, handlerPage);
-      prefBranch.setCharPref("browser.feeds.handler", "ask");
-      prefBranch.setBoolPref("browser.feeds.showFirstRunUI", true);
-
-      SimpleTest.finish();
-    }
-  </script>
-  <html:iframe src="http://mochi.test:8888/tests/toolkit/components/places/tests/chrome/sample_feed.atom" height="400px" 
-    id="theframe" onload="finishUp();">
-  </html:iframe>
-</window>
--- a/browser/components/feeds/test/test_registerHandler.html
+++ b/browser/components/feeds/test/test_registerHandler.html
@@ -18,82 +18,65 @@ https://bugzilla.mozilla.org/show_bug.cg
 <script class="testbody" type="text/javascript">
 
 /** Test for Bug 402788 **/
   SimpleTest.waitForExplicitFinish();
 
   // return false if an exception has been catched, true otherwise
   function testRegisterHandler(aIsProtocol, aTxt, aUri, aTitle) {
     try {
-      if (aIsProtocol)
-        navigator.registerProtocolHandler(aTxt, aUri, aTitle);
-      else
-        navigator.registerContentHandler(aTxt, aUri, aTitle);
+      navigator.registerProtocolHandler(aTxt, aUri, aTitle);
     } catch (e) {
       return false;
     }
 
     return true;
   }
 
   async function tests() {
     await SpecialPowers.pushPrefEnv({
       set: [
-        ["dom.registerContentHandler.enabled", true],
         ["dom.registerProtocolHandler.insecure.enabled", true],
       ]
     });
-    ok(navigator.registerContentHandler, "navigator.registerContentHandler should be defined");
 
     // testing a generic case
     is(testRegisterHandler(true, "web+foo", "http://mochi.test:8888/%s", "Foo handler"), true, "registering a web+foo protocol handler should work");
-    is(testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/%s", "Foo handler"), true, "registering a foo content handler should work");
 
     // testing with wrong uris
     is(testRegisterHandler(true, "web+foo", "http://mochi.test:8888/", "Foo handler"), false, "a protocol handler uri should contain %s");
-    is(testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/", "Foo handler"), false, "a content handler uri should contain %s");
 
     // the spec explicitly allows relative urls to be passed
     is(testRegisterHandler(true, "web+foo", "foo/%s", "Foo handler"), true, "a protocol handler uri should be valid");
-    is(testRegisterHandler(false, "application/rss+xml", "foo/%s", "Foo handler"), true, "a content handler uri should be valid");
 
     // we should only accept to register when the handler has the same host as the current page (bug 402287)
     is(testRegisterHandler(true, "fweb+oo", "http://remotehost:8888/%s", "Foo handler"), false, "registering a web+foo protocol handler with a different host should not work");
-    is(testRegisterHandler(false, "application/rss+xml", "http://remotehost:8888/%s", "Foo handler"), false, "registering a foo content handler with a different host should not work");
 
     // restriction to http(s) for the uri of the handler (bug 401343)
     // https should work (http already tested in the generic case)
     is(testRegisterHandler(true, "web+foo", "https://mochi.test:8888/%s", "Foo handler"), true, "registering a web+foo protocol handler with https scheme should work");
-    is(testRegisterHandler(false, "application/rss+xml", "https://mochi.test:8888/%s", "Foo handler"), true, "registering a foo content handler with https scheme should work");
     // ftp should not work
     is(testRegisterHandler(true, "web+foo", "ftp://mochi.test:8888/%s", "Foo handler"), false, "registering a web+foo protocol handler with ftp scheme should not work");
-    is(testRegisterHandler(false, "application/rss+xml", "ftp://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with ftp scheme should not work");
     // chrome should not work
     is(testRegisterHandler(true, "web+foo", "chrome://mochi.test:8888/%s", "Foo handler"), false, "registering a web+foo protocol handler with chrome scheme should not work");
-    is(testRegisterHandler(false, "application/rss+xml", "chrome://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with chrome scheme should not work");
     // foo should not work
     is(testRegisterHandler(true, "web+foo", "foo://mochi.test:8888/%s", "Foo handler"), false, "registering a web+foo protocol handler with foo scheme should not work");
-    is(testRegisterHandler(false, "application/rss+xml", "foo://mochi.test:8888/%s", "Foo handler"), false, "registering a foo content handler with foo scheme should not work");
 
     // for security reasons, protocol handlers should never be registered for some schemes (chrome, vbscript, ...) (bug 402788)
     is(testRegisterHandler(true, "chrome", "http://mochi.test:8888/%s", "chrome handler"), false, "registering a chrome protocol handler should not work");
     is(testRegisterHandler(true, "vbscript", "http://mochi.test:8888/%s", "vbscript handler"), false, "registering a vbscript protocol handler should not work");
     is(testRegisterHandler(true, "javascript", "http://mochi.test:8888/%s", "javascript handler"), false, "registering a javascript protocol handler should not work");
     is(testRegisterHandler(true, "moz-icon", "http://mochi.test:8888/%s", "moz-icon handler"), false, "registering a moz-icon protocol handler should not work");
 
     // registering anything not on the list of safe schemes and unprefixed by web+ shouldn't work
     is(testRegisterHandler(true, "foo", "http://mochi.test:8888/%s", "chrome handler"), false, "registering a foo protocol handler should not work");
     is(testRegisterHandler(true, "web+", "http://mochi.test:8888/%s", "chrome handler"), false, "registering a 'web+' protocol handler should not work");
     is(testRegisterHandler(true, "web+1", "http://mochi.test:8888/%s", "chrome handler"), false, "registering a 'web+1' protocol handler should not work");
 
 
-    // for security reasons, content handlers should never be registered for some types (html, ...)
-    is(testRegisterHandler(false, "application/rss+xml", "http://mochi.test:8888/%s", "Foo handler"), true, "registering rss content handlers should work");
-    is(testRegisterHandler(false, "application/atom+xml", "http://mochi.test:8888/%s", "Foo handler"), true, "registering atom content handlers should work");
-    todo_is(testRegisterHandler(false, "text/html", "http://mochi.test:8888/%s", "Foo handler"), false, "registering html content handlers should not work"); // bug 403798
     SimpleTest.finish();
   }
 
   tests();
 
 </script>
 </pre>
 </body>