summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_feed_discovery.js
blob: 73dcef755cbcb5667f4b7fff58702bf530f07089 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
const URL = "http://mochi.test:8888/browser/browser/base/content/test/general/feed_discovery.html"

/** Test for Bug 377611 **/

add_task(function* () {
  // Open a new tab.
  gBrowser.selectedTab = gBrowser.addTab(URL);
  registerCleanupFunction(() => gBrowser.removeCurrentTab());

  let browser = gBrowser.selectedBrowser;
  yield BrowserTestUtils.browserLoaded(browser);

  let discovered = browser.feeds;
  ok(discovered.length > 0, "some feeds should be discovered");

  let feeds = {};
  for (let aFeed of discovered) {
    feeds[aFeed.href] = true;
  }

  yield ContentTask.spawn(browser, feeds, function* (contentFeeds) {
    for (let aLink of content.document.getElementsByTagName("link")) {
      // ignore real stylesheets, and anything without an href property
      if (aLink.type != "text/css" && aLink.href) {
        if (/bogus/i.test(aLink.title)) {
          ok(!contentFeeds[aLink.href], "don't discover " + aLink.href);
        } else {
          ok(contentFeeds[aLink.href], "should discover " + aLink.href);
        }
      }
    }
  });
})