mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
114 lines
4.9 KiB
HTML
114 lines
4.9 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=377611
|
|
-->
|
|
<head>
|
|
<title>Test for feed discovery</title>
|
|
|
|
<!-- Straight up standard -->
|
|
<link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" />
|
|
<link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" />
|
|
<link rel="feed" title="3" href="/3.xml" />
|
|
|
|
<!-- rel is a space-separated list -->
|
|
<link rel=" alternate " type="application/atom+xml" title="4" href="/4.atom" />
|
|
<link rel="foo alternate" type="application/atom+xml" title="5" href="/5.atom" />
|
|
<link rel="alternate foo" type="application/atom+xml" title="6" href="/6.atom" />
|
|
<link rel="foo alternate foo" type="application/atom+xml" title="7" href="/7.atom" />
|
|
<link rel="meat feed cake" title="8" href="/8.atom" />
|
|
|
|
<!-- rel is case-insensitive -->
|
|
<link rel="ALTERNate" type="application/atom+xml" title="9" href="/9.atom" />
|
|
<link rel="fEEd" title="10" href="/10.atom" />
|
|
|
|
<!-- type can have leading and trailing whitespace -->
|
|
<link rel="alternate" type=" application/atom+xml " title="11" href="/11.atom" />
|
|
|
|
<!-- type is case-insensitive -->
|
|
<link rel="alternate" type="aPPliCAtion/ATom+xML" title="12" href="/12.atom" />
|
|
|
|
<!-- "feed stylesheet" is a feed, though "alternate stylesheet" isn't -->
|
|
<link rel="feed stylesheet" title="13" href="/13.atom" />
|
|
|
|
<!-- hyphens or letters around rel not allowed -->
|
|
<link rel="disabled-alternate" type="application/atom+xml" title="Bogus1" href="/Bogus1" />
|
|
<link rel="alternates" type="application/atom+xml" title="Bogus2" href="/Bogus2" />
|
|
<link rel=" alternate-like" type="application/atom+xml" title="Bogus3" href="/Bogus3" />
|
|
|
|
<!-- don't tolerate text/xml if title includes 'rss' not as a word -->
|
|
<link rel="alternate" type="text/xml" title="Bogus4 scissorsshaped" href="/Bogus4" />
|
|
|
|
<!-- don't tolerate application/xml if title includes 'rss' not as a word -->
|
|
<link rel="alternate" type="application/xml" title="Bogus5 scissorsshaped" href="/Bogus5" />
|
|
|
|
<!-- don't tolerate application/rdf+xml if title includes 'rss' not as a word -->
|
|
<link rel="alternate" type="application/rdf+xml" title="Bogus6 scissorsshaped" href="/Bogus6" />
|
|
|
|
<!-- don't tolerate random types -->
|
|
<link rel="alternate" type="text/plain" title="Bogus7 rss" href="/Bogus7" />
|
|
|
|
<!-- don't find Atom by title -->
|
|
<link rel="foopy" type="application/atom+xml" title="Bogus8 Atom and RSS" href="/Bogus8" />
|
|
|
|
<!-- don't find application/rss+xml by title -->
|
|
<link rel="goats" type="application/rss+xml" title="Bogus9 RSS and Atom" href="/Bogus9" />
|
|
|
|
<!-- don't find application/rdf+xml by title -->
|
|
<link rel="alternate" type="application/rdf+xml" title="Bogus10 RSS and Atom" href="/Bogus10" />
|
|
|
|
<!-- don't find application/xml by title -->
|
|
<link rel="alternate" type="application/xml" title="Bogus11 RSS and Atom" href="/Bogus11" />
|
|
|
|
<!-- don't find text/xml by title -->
|
|
<link rel="alternate" type="text/xml" title="Bogus12 RSS and Atom" href="/Bogus12" />
|
|
|
|
<!-- alternate and stylesheet isn't a feed -->
|
|
<link rel="alternate stylesheet" type="application/rss+xml" title="Bogus13 RSS" href="/Bogus13" />
|
|
</head>
|
|
<body>
|
|
<script type="text/javascript">
|
|
window.onload = function() {
|
|
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
|
|
|
var tests = new Array();
|
|
|
|
var currentWindow =
|
|
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
.getInterface(Components.interfaces.nsIWebNavigation)
|
|
.QueryInterface(Components.interfaces.nsIDocShellTreeItem)
|
|
.rootTreeItem
|
|
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
|
.getInterface(Components.interfaces.nsIDOMWindow);
|
|
var browser = currentWindow.gBrowser.selectedBrowser;
|
|
|
|
var discovered = browser.feeds;
|
|
tests.push({ check: discovered.length > 0,
|
|
message: "some feeds should be discovered" });
|
|
|
|
var feeds = [];
|
|
|
|
for (var aFeed of discovered) {
|
|
feeds[aFeed.href] = true;
|
|
}
|
|
|
|
for (var aLink of 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)) {
|
|
tests.push({ check: !feeds[aLink.href],
|
|
message: "don't discover " + aLink.href });
|
|
} else {
|
|
tests.push({ check: feeds[aLink.href],
|
|
message: "should discover " + aLink.href });
|
|
}
|
|
}
|
|
}
|
|
window.arguments[0].tests = tests;
|
|
window.close();
|
|
}
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|