mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 383746 - Page Info RSS section should use code in browser.js to enumerate page feeds. Patch by Ehsan Akhgari <ehsan.akhgari@gmail.com>. r=mano.
This commit is contained in:
parent
754a82609e
commit
8a9805b57e
@ -41,6 +41,7 @@
|
|||||||
# Michael Ventnor <m.ventnor@gmail.com>
|
# Michael Ventnor <m.ventnor@gmail.com>
|
||||||
# Simon Bünzli <zeniko@gmail.com>
|
# Simon Bünzli <zeniko@gmail.com>
|
||||||
# Johnathan Nightingale <johnath@mozilla.com>
|
# Johnathan Nightingale <johnath@mozilla.com>
|
||||||
|
# Ehsan Akhgari <ehsan.akhgari@gmail.com>
|
||||||
#
|
#
|
||||||
# Alternatively, the contents of this file may be used under the terms of
|
# Alternatively, the contents of this file may be used under the terms of
|
||||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||||
@ -5612,38 +5613,10 @@ var FeedHandler = {
|
|||||||
// along all events. It should give us the browser for the tab, as well as
|
// along all events. It should give us the browser for the tab, as well as
|
||||||
// the actual event.
|
// the actual event.
|
||||||
|
|
||||||
var erel = event.target.rel;
|
var feed = recognizeFeedFromLink(event.target,
|
||||||
var etype = event.target.type;
|
event.target.ownerDocument.contentPrincipal);
|
||||||
var etitle = event.target.title;
|
|
||||||
const rssTitleRegex = /(^|\s)rss($|\s)/i;
|
|
||||||
var rels = {};
|
|
||||||
|
|
||||||
if (erel) {
|
if (feed) {
|
||||||
for each (var relValue in erel.split(/\s+/))
|
|
||||||
rels[relValue] = true;
|
|
||||||
}
|
|
||||||
var isFeed = rels.feed;
|
|
||||||
|
|
||||||
if (!isFeed &&
|
|
||||||
(!rels.alternate || rels.stylesheet || !etype))
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!isFeed) {
|
|
||||||
// Use type value
|
|
||||||
etype = etype.replace(/^\s+/, "");
|
|
||||||
etype = etype.replace(/\s+$/, "");
|
|
||||||
etype = etype.replace(/\s*;.*/, "");
|
|
||||||
etype = etype.toLowerCase();
|
|
||||||
isFeed = (etype == "application/rss+xml" ||
|
|
||||||
etype == "application/atom+xml");
|
|
||||||
if (!isFeed) {
|
|
||||||
// really slimy: general XML types with magic letters in the title
|
|
||||||
isFeed = ((etype == "text/xml" || etype == "application/xml" ||
|
|
||||||
etype == "application/rdf+xml") && rssTitleRegex.test(etitle));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFeed) {
|
|
||||||
const targetDoc = event.target.ownerDocument;
|
const targetDoc = event.target.ownerDocument;
|
||||||
|
|
||||||
// find which tab this is for, and set the attribute on the browser
|
// find which tab this is for, and set the attribute on the browser
|
||||||
@ -5656,21 +5629,8 @@ var FeedHandler = {
|
|||||||
var feeds = [];
|
var feeds = [];
|
||||||
if (browserForLink.feeds != null)
|
if (browserForLink.feeds != null)
|
||||||
feeds = browserForLink.feeds;
|
feeds = browserForLink.feeds;
|
||||||
var wrapper = event.target;
|
|
||||||
|
|
||||||
try {
|
feeds.push(feed);
|
||||||
urlSecurityCheck(wrapper.href,
|
|
||||||
gBrowser.contentPrincipal,
|
|
||||||
Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
|
|
||||||
}
|
|
||||||
catch (ex) {
|
|
||||||
dump(ex.message);
|
|
||||||
return; // doesn't pass security check
|
|
||||||
}
|
|
||||||
|
|
||||||
feeds.push({ href: wrapper.href,
|
|
||||||
type: etype,
|
|
||||||
title: wrapper.title});
|
|
||||||
browserForLink.feeds = feeds;
|
browserForLink.feeds = feeds;
|
||||||
if (browserForLink == gBrowser || browserForLink == gBrowser.mCurrentBrowser) {
|
if (browserForLink == gBrowser || browserForLink == gBrowser.mCurrentBrowser) {
|
||||||
var feedButton = document.getElementById("feed-button");
|
var feedButton = document.getElementById("feed-button");
|
||||||
|
Loading…
Reference in New Issue
Block a user