Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | <!DOCTYPE HTML> |
michael@0 | 2 | <html> |
michael@0 | 3 | <!-- |
michael@0 | 4 | https://bugzilla.mozilla.org/show_bug.cgi?id=377611 |
michael@0 | 5 | --> |
michael@0 | 6 | <head> |
michael@0 | 7 | <title>Test for feed discovery</title> |
michael@0 | 8 | |
michael@0 | 9 | <!-- Straight up standard --> |
michael@0 | 10 | <link rel="alternate" type="application/atom+xml" title="1" href="/1.atom" /> |
michael@0 | 11 | <link rel="alternate" type="application/rss+xml" title="2" href="/2.rss" /> |
michael@0 | 12 | <link rel="feed" title="3" href="/3.xml" /> |
michael@0 | 13 | |
michael@0 | 14 | <!-- rel is a space-separated list --> |
michael@0 | 15 | <link rel=" alternate " type="application/atom+xml" title="4" href="/4.atom" /> |
michael@0 | 16 | <link rel="foo alternate" type="application/atom+xml" title="5" href="/5.atom" /> |
michael@0 | 17 | <link rel="alternate foo" type="application/atom+xml" title="6" href="/6.atom" /> |
michael@0 | 18 | <link rel="foo alternate foo" type="application/atom+xml" title="7" href="/7.atom" /> |
michael@0 | 19 | <link rel="meat feed cake" title="8" href="/8.atom" /> |
michael@0 | 20 | |
michael@0 | 21 | <!-- rel is case-insensitive --> |
michael@0 | 22 | <link rel="ALTERNate" type="application/atom+xml" title="9" href="/9.atom" /> |
michael@0 | 23 | <link rel="fEEd" title="10" href="/10.atom" /> |
michael@0 | 24 | |
michael@0 | 25 | <!-- type can have leading and trailing whitespace --> |
michael@0 | 26 | <link rel="alternate" type=" application/atom+xml " title="11" href="/11.atom" /> |
michael@0 | 27 | |
michael@0 | 28 | <!-- type is case-insensitive --> |
michael@0 | 29 | <link rel="alternate" type="aPPliCAtion/ATom+xML" title="12" href="/12.atom" /> |
michael@0 | 30 | |
michael@0 | 31 | <!-- "feed stylesheet" is a feed, though "alternate stylesheet" isn't --> |
michael@0 | 32 | <link rel="feed stylesheet" title="13" href="/13.atom" /> |
michael@0 | 33 | |
michael@0 | 34 | <!-- hyphens or letters around rel not allowed --> |
michael@0 | 35 | <link rel="disabled-alternate" type="application/atom+xml" title="Bogus1" href="/Bogus1" /> |
michael@0 | 36 | <link rel="alternates" type="application/atom+xml" title="Bogus2" href="/Bogus2" /> |
michael@0 | 37 | <link rel=" alternate-like" type="application/atom+xml" title="Bogus3" href="/Bogus3" /> |
michael@0 | 38 | |
michael@0 | 39 | <!-- don't tolerate text/xml if title includes 'rss' not as a word --> |
michael@0 | 40 | <link rel="alternate" type="text/xml" title="Bogus4 scissorsshaped" href="/Bogus4" /> |
michael@0 | 41 | |
michael@0 | 42 | <!-- don't tolerate application/xml if title includes 'rss' not as a word --> |
michael@0 | 43 | <link rel="alternate" type="application/xml" title="Bogus5 scissorsshaped" href="/Bogus5" /> |
michael@0 | 44 | |
michael@0 | 45 | <!-- don't tolerate application/rdf+xml if title includes 'rss' not as a word --> |
michael@0 | 46 | <link rel="alternate" type="application/rdf+xml" title="Bogus6 scissorsshaped" href="/Bogus6" /> |
michael@0 | 47 | |
michael@0 | 48 | <!-- don't tolerate random types --> |
michael@0 | 49 | <link rel="alternate" type="text/plain" title="Bogus7 rss" href="/Bogus7" /> |
michael@0 | 50 | |
michael@0 | 51 | <!-- don't find Atom by title --> |
michael@0 | 52 | <link rel="foopy" type="application/atom+xml" title="Bogus8 Atom and RSS" href="/Bogus8" /> |
michael@0 | 53 | |
michael@0 | 54 | <!-- don't find application/rss+xml by title --> |
michael@0 | 55 | <link rel="goats" type="application/rss+xml" title="Bogus9 RSS and Atom" href="/Bogus9" /> |
michael@0 | 56 | |
michael@0 | 57 | <!-- don't find application/rdf+xml by title --> |
michael@0 | 58 | <link rel="alternate" type="application/rdf+xml" title="Bogus10 RSS and Atom" href="/Bogus10" /> |
michael@0 | 59 | |
michael@0 | 60 | <!-- don't find application/xml by title --> |
michael@0 | 61 | <link rel="alternate" type="application/xml" title="Bogus11 RSS and Atom" href="/Bogus11" /> |
michael@0 | 62 | |
michael@0 | 63 | <!-- don't find text/xml by title --> |
michael@0 | 64 | <link rel="alternate" type="text/xml" title="Bogus12 RSS and Atom" href="/Bogus12" /> |
michael@0 | 65 | |
michael@0 | 66 | <!-- alternate and stylesheet isn't a feed --> |
michael@0 | 67 | <link rel="alternate stylesheet" type="application/rss+xml" title="Bogus13 RSS" href="/Bogus13" /> |
michael@0 | 68 | </head> |
michael@0 | 69 | <body> |
michael@0 | 70 | <script type="text/javascript"> |
michael@0 | 71 | window.onload = function() { |
michael@0 | 72 | |
michael@0 | 73 | var tests = new Array(); |
michael@0 | 74 | |
michael@0 | 75 | var currentWindow = |
michael@0 | 76 | SpecialPowers.wrap(window).QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) |
michael@0 | 77 | .getInterface(SpecialPowers.Ci.nsIWebNavigation) |
michael@0 | 78 | .QueryInterface(SpecialPowers.Ci.nsIDocShellTreeItem) |
michael@0 | 79 | .rootTreeItem |
michael@0 | 80 | .QueryInterface(SpecialPowers.Ci.nsIInterfaceRequestor) |
michael@0 | 81 | .getInterface(SpecialPowers.Ci.nsIDOMWindow); |
michael@0 | 82 | var browser = currentWindow.gBrowser.selectedBrowser; |
michael@0 | 83 | |
michael@0 | 84 | var discovered = browser.feeds; |
michael@0 | 85 | tests.push({ check: discovered.length > 0, |
michael@0 | 86 | message: "some feeds should be discovered" }); |
michael@0 | 87 | |
michael@0 | 88 | var feeds = []; |
michael@0 | 89 | |
michael@0 | 90 | for (var aFeed of discovered) { |
michael@0 | 91 | feeds[aFeed.href] = true; |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | for (var aLink of document.getElementsByTagName("link")) { |
michael@0 | 95 | // ignore real stylesheets, and anything without an href property |
michael@0 | 96 | if (aLink.type != "text/css" && aLink.href) { |
michael@0 | 97 | if (/bogus/i.test(aLink.title)) { |
michael@0 | 98 | tests.push({ check: !feeds[aLink.href], |
michael@0 | 99 | message: "don't discover " + aLink.href }); |
michael@0 | 100 | } else { |
michael@0 | 101 | tests.push({ check: feeds[aLink.href], |
michael@0 | 102 | message: "should discover " + aLink.href }); |
michael@0 | 103 | } |
michael@0 | 104 | } |
michael@0 | 105 | } |
michael@0 | 106 | window.arguments[0].tests = tests; |
michael@0 | 107 | window.close(); |
michael@0 | 108 | } |
michael@0 | 109 | </script> |
michael@0 | 110 | </body> |
michael@0 | 111 | </html> |
michael@0 | 112 |