зеркало из https://github.com/mozilla/pjs.git
Bug 344991. Change accessors to return nsIFeedTextConstructs
This commit is contained in:
Родитель
f4d96c6ad6
Коммит
c49f464056
|
@ -44,16 +44,14 @@ interface nsIArray;
|
||||||
/**
|
/**
|
||||||
* An nsIFeed represents a single Atom or RSS feed.
|
* An nsIFeed represents a single Atom or RSS feed.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(29884967-afaa-43ce-ad10-8234deebea15)]
|
[scriptable, uuid(9472ff5b-10dc-4aed-a861-7619d7a4b5bf)]
|
||||||
interface nsIFeed : nsIFeedContainer
|
interface nsIFeed : nsIFeedContainer
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Uses description, subtitle, and extensions
|
* Uses description, subtitle, and extensions
|
||||||
* to generate a summary.
|
* to generate a summary.
|
||||||
*
|
|
||||||
* @param stripTags remove HTML if true.
|
|
||||||
*/
|
*/
|
||||||
AString subtitle(in boolean stripTags);
|
attribute nsIFeedTextConstruct subtitle;
|
||||||
|
|
||||||
// All content classifies as a "feed" - it is the transport.
|
// All content classifies as a "feed" - it is the transport.
|
||||||
const unsigned long TYPE_FEED = 0;
|
const unsigned long TYPE_FEED = 0;
|
||||||
|
@ -82,13 +80,13 @@ interface nsIFeed : nsIFeedContainer
|
||||||
* It supposedly enables some sort of interaction with an XML-RPC or
|
* It supposedly enables some sort of interaction with an XML-RPC or
|
||||||
* SOAP service.
|
* SOAP service.
|
||||||
*/
|
*/
|
||||||
attribute nsIPropertyBag2 cloud;
|
attribute nsIWritablePropertyBag2 cloud;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An image url and some metadata (as defined by RSS2).
|
* An image url and some metadata (as defined by RSS2).
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
attribute nsIPropertyBag2 image;
|
attribute nsIWritablePropertyBag2 image;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* No one really knows what textInput is for.
|
* No one really knows what textInput is for.
|
||||||
|
@ -97,7 +95,7 @@ interface nsIFeed : nsIFeedContainer
|
||||||
* <http://www.cadenhead.org/workbench/news/2894/rss-joy-textinput>
|
* <http://www.cadenhead.org/workbench/news/2894/rss-joy-textinput>
|
||||||
* for more details.
|
* for more details.
|
||||||
*/
|
*/
|
||||||
attribute nsIPropertyBag2 textInput;
|
attribute nsIWritablePropertyBag2 textInput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Days to skip fetching. This field was supposed to designate
|
* Days to skip fetching. This field was supposed to designate
|
||||||
|
|
|
@ -37,16 +37,17 @@
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
interface nsIURI;
|
interface nsIURI;
|
||||||
interface nsIPropertyBag2;
|
interface nsIWritablePropertyBag2;
|
||||||
interface nsIArray;
|
interface nsIArray;
|
||||||
|
interface nsIFeedTextConstruct;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A shared base for feeds and items, which are pretty similar,
|
* A shared base for feeds and items, which are pretty similar,
|
||||||
* but they have some divergent attributes and require
|
* but they have some divergent attributes and require
|
||||||
* different convenience methods.
|
* different convenience methods.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(b7e7b6b9-a461-4817-9003-3e6b9005945f)]
|
[scriptable, uuid(56877da5-598b-41dd-bf3e-72fe713c7820)]
|
||||||
interface nsIFeedContainer : nsISupports
|
interface nsIFeedContainer : nsISupports
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Many feeds contain an ID distinct from their URI, and
|
* Many feeds contain an ID distinct from their URI, and
|
||||||
|
@ -69,16 +70,13 @@ interface nsIFeedContainer : nsISupports
|
||||||
* Common namespaces are accessed using prefixes, like get("dc:subject");.
|
* Common namespaces are accessed using prefixes, like get("dc:subject");.
|
||||||
* See nsIFeedResult::registerExtensionPrefix.
|
* See nsIFeedResult::registerExtensionPrefix.
|
||||||
*/
|
*/
|
||||||
attribute nsIPropertyBag2 fields;
|
attribute nsIWritablePropertyBag2 fields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sometimes there's no title, or the title contains markup.
|
* Sometimes there's no title, or the title contains markup, so take
|
||||||
*
|
* care in decoding the attribute.
|
||||||
* @returns A plain text title string gleaned from whatever
|
*/
|
||||||
* the publisher has included in the feed. In most
|
attribute nsIFeedTextConstruct title;
|
||||||
* cases, this is the contents of the <title>.
|
|
||||||
*/
|
|
||||||
attribute AString title;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the primary link for the feed or entry.
|
* Returns the primary link for the feed or entry.
|
||||||
|
|
|
@ -40,9 +40,11 @@
|
||||||
interface nsIArray;
|
interface nsIArray;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An nsIFeedEntry represents an Atom or RSS entry/item.
|
* An nsIFeedEntry represents an Atom or RSS entry/item. Summary
|
||||||
|
* and/or full-text content may be available, but callers will have to
|
||||||
|
* check both.
|
||||||
*/
|
*/
|
||||||
[scriptable, uuid(ef51d60c-cad1-42ea-9f6c-c1811f733d90)]
|
[scriptable, uuid(364dc1e5-20fe-4315-bff7-33d2efcf2541)]
|
||||||
interface nsIFeedEntry : nsIFeedContainer {
|
interface nsIFeedEntry : nsIFeedContainer {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -54,17 +56,15 @@ interface nsIFeedEntry : nsIFeedContainer {
|
||||||
* Uses description, subtitle, summary, content and extensions
|
* Uses description, subtitle, summary, content and extensions
|
||||||
* to generate a summary.
|
* to generate a summary.
|
||||||
*
|
*
|
||||||
* @param stripTags If true, remove HTML markup.
|
|
||||||
*/
|
*/
|
||||||
AString summary(in boolean stripTags);
|
attribute nsIFeedTextConstruct summary;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses description, summary, content and extensions to provide
|
* Uses atom:content and content:encoded to provide
|
||||||
* a 'full text' view of an entry.
|
* a 'full text' view of an entry.
|
||||||
*
|
*
|
||||||
* @param stripTags If true, remove HTML markup.
|
|
||||||
*/
|
*/
|
||||||
AString content(in boolean stripTags);
|
attribute nsIFeedTextConstruct content;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enclosures are podcasts, photocasts, etc.
|
* Enclosures are podcasts, photocasts, etc.
|
||||||
|
|
|
@ -70,5 +70,12 @@ interface nsIFeedTextConstruct : nsISupports
|
||||||
* The content of the text construct.
|
* The content of the text construct.
|
||||||
*/
|
*/
|
||||||
attribute AString text;
|
attribute AString text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the text of the text construct, with all markup stripped
|
||||||
|
* and all entities decoded. If the type attribute's value is "text",
|
||||||
|
* this function returns the value of the text attribute unchanged.
|
||||||
|
*/
|
||||||
|
AString plainText();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -90,17 +90,6 @@ function isIID(a, iid) {
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isIFeedTextConstruct(a) {
|
|
||||||
var rv = false;
|
|
||||||
try {
|
|
||||||
a.QueryInterface(Ci.nsIFeedTextConstruct);
|
|
||||||
rv = true;
|
|
||||||
}
|
|
||||||
catch(e) {
|
|
||||||
}
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
function isIArray(a) {
|
function isIArray(a) {
|
||||||
return isIID(a, Ci.nsIArray);
|
return isIID(a, Ci.nsIArray);
|
||||||
}
|
}
|
||||||
|
@ -113,20 +102,6 @@ function stripTags(someHTML) {
|
||||||
return someHTML.replace(/<[^>]+>/g,"");
|
return someHTML.replace(/<[^>]+>/g,"");
|
||||||
}
|
}
|
||||||
|
|
||||||
function plainTextFromTextConstruct(textConstruct) {
|
|
||||||
if (textConstruct != null &&
|
|
||||||
isIFeedTextConstruct(textConstruct)) {
|
|
||||||
var text = textConstruct.text;
|
|
||||||
if (textConstruct.type != "text") {
|
|
||||||
text = gUnescapeHTML.unescape(stripTags(text));
|
|
||||||
}
|
|
||||||
return text;
|
|
||||||
}
|
|
||||||
|
|
||||||
// it was not a textConstruct, just a string
|
|
||||||
return textConstruct;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Searches through an array of links and returns a JS array
|
* Searches through an array of links and returns a JS array
|
||||||
* of matching property bags.
|
* of matching property bags.
|
||||||
|
@ -339,37 +314,21 @@ FeedResult.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Feed() {
|
function Feed() {
|
||||||
this._sub = null;
|
this.subtitle = null;
|
||||||
this._title = null;
|
this.title = null;
|
||||||
this.items = [];
|
this.items = [];
|
||||||
this.link = null;
|
this.link = null;
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.baseURI = null;
|
this.baseURI = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Feed.prototype = {
|
Feed.prototype = {
|
||||||
subtitle: function Feed_subtitle(doStripTags) {
|
|
||||||
if (this._sub == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (doStripTags)
|
|
||||||
return plainTextFromTextConstruct(this._sub);
|
|
||||||
|
|
||||||
if (isIID(this._sub, Ci.nsIFeedTextConstruct))
|
|
||||||
return this._sub.text;
|
|
||||||
|
|
||||||
return this._sub;
|
|
||||||
},
|
|
||||||
|
|
||||||
get title() {
|
|
||||||
return plainTextFromTextConstruct(this._title);
|
|
||||||
},
|
|
||||||
|
|
||||||
searchLists: {
|
searchLists: {
|
||||||
_sub: ["description","dc:description","rss1:description",
|
subtitle: ["description","dc:description","rss1:description",
|
||||||
"atom03:tagline","atom:subtitle"],
|
"atom03:tagline","atom:subtitle"],
|
||||||
items: ["items","atom03_entries","entries"],
|
items: ["items","atom03_entries","entries"],
|
||||||
id: ["atom:id","rdf:about"],
|
id: ["atom:id","rdf:about"],
|
||||||
_title: ["title","rss1:title", "atom03:title","atom:title"],
|
title: ["title","rss1:title", "atom03:title","atom:title"],
|
||||||
link: [["link",strToURI],["rss1:link",strToURI]],
|
link: [["link",strToURI],["rss1:link",strToURI]],
|
||||||
categories: ["categories", "dc:subject"],
|
categories: ["categories", "dc:subject"],
|
||||||
cloud: ["cloud"],
|
cloud: ["cloud"],
|
||||||
|
@ -389,6 +348,9 @@ Feed.prototype = {
|
||||||
// Assign Atom link if needed
|
// Assign Atom link if needed
|
||||||
if (bagHasKey(this.fields, "links"))
|
if (bagHasKey(this.fields, "links"))
|
||||||
this._atomLinksToURI();
|
this._atomLinksToURI();
|
||||||
|
|
||||||
|
this._resetBagMembersToRawText([this.searchLists.subtitle,
|
||||||
|
this.searchLists.title]);
|
||||||
},
|
},
|
||||||
|
|
||||||
_atomLinksToURI: function Feed_linkToURI() {
|
_atomLinksToURI: function Feed_linkToURI() {
|
||||||
|
@ -410,7 +372,20 @@ Feed.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// reset the bag to raw contents, not text constructs
|
||||||
|
_resetBagMembersToRawText: function Feed_resetBagMembers(fieldLists) {
|
||||||
|
for (var i=0; i<fieldLists.length; i++) {
|
||||||
|
for (var j=0; j<fieldLists[i].length; j++) {
|
||||||
|
if (bagHasKey(this.fields, fieldLists[i][j])) {
|
||||||
|
var textConstruct = this.fields.getProperty(fieldLists[i][j]);
|
||||||
|
this.fields.setPropertyAsAString(fieldLists[i][j],
|
||||||
|
textConstruct.text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
QueryInterface: function Feed_QI(iid) {
|
QueryInterface: function Feed_QI(iid) {
|
||||||
if (iid.equals(Ci.nsIFeed) ||
|
if (iid.equals(Ci.nsIFeed) ||
|
||||||
iid.equals(Ci.nsIFeedContainer) ||
|
iid.equals(Ci.nsIFeedContainer) ||
|
||||||
|
@ -421,88 +396,68 @@ Feed.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
function Entry() {
|
function Entry() {
|
||||||
this._summary = null;
|
this.summary = null;
|
||||||
this._content = null;
|
this.content = null;
|
||||||
this._title = null;
|
this.title = null;
|
||||||
this.fields = Cc["@mozilla.org/hash-property-bag;1"].
|
this.fields = Cc["@mozilla.org/hash-property-bag;1"].
|
||||||
createInstance(Ci.nsIWritablePropertyBag2);
|
createInstance(Ci.nsIWritablePropertyBag2);
|
||||||
this.link = null;
|
this.link = null;
|
||||||
this.id = null;
|
this.id = null;
|
||||||
this.baseURI = null;
|
this.baseURI = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry.prototype = {
|
Entry.prototype = {
|
||||||
fields: null,
|
fields: null,
|
||||||
get title() {
|
|
||||||
return plainTextFromTextConstruct(this._title);
|
|
||||||
},
|
|
||||||
summary: function Entry_summary(doStripTags) {
|
|
||||||
if (this._summary == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (doStripTags)
|
|
||||||
return plainTextFromTextConstruct(this._summary);
|
|
||||||
|
|
||||||
if (isIID(this._summary, Ci.nsIFeedTextConstruct))
|
|
||||||
return this._summary.text;
|
|
||||||
|
|
||||||
return this._summary;
|
|
||||||
},
|
|
||||||
content: function Entry_content(doStripTags) {
|
|
||||||
|
|
||||||
if (this._content == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (doStripTags)
|
|
||||||
return plainTextFromTextConstruct(this._content);
|
|
||||||
|
|
||||||
if (isIID(this._content, Ci.nsIFeedTextConstruct))
|
|
||||||
return this._content.text;
|
|
||||||
|
|
||||||
return this._content;
|
|
||||||
},
|
|
||||||
enclosures: null,
|
enclosures: null,
|
||||||
mediaContent: null,
|
mediaContent: null,
|
||||||
|
|
||||||
searchLists: {
|
searchLists: {
|
||||||
_title: ["title", "rss1:title", "atom03:title", "atom:title"],
|
title: ["title", "rss1:title", "atom03:title", "atom:title"],
|
||||||
link: [["link",strToURI],["rss1:link",strToURI]],
|
link: [["link",strToURI],["rss1:link",strToURI]],
|
||||||
id: [["guid", makePropGetter("guid")], "rdf:about",
|
id: [["guid", makePropGetter("guid")], "rdf:about",
|
||||||
"atom03:id", "atom:id"],
|
"atom03:id", "atom:id"],
|
||||||
_summary: ["description", "rss1:description", "dc:description",
|
summary: ["description", "rss1:description", "dc:description",
|
||||||
"atom03:summary", "atom:summary"],
|
"atom03:summary", "atom:summary"],
|
||||||
_content: ["content:encoded","atom03:content","atom:content"]
|
content: ["content:encoded","atom03:content","atom:content"]
|
||||||
},
|
},
|
||||||
|
|
||||||
normalize: function Entry_normalize() {
|
normalize: function Entry_normalize() {
|
||||||
fieldsToObj(this, this.searchLists);
|
fieldsToObj(this, this.searchLists);
|
||||||
|
|
||||||
// Assign Atom link if needed
|
// Assign Atom link if needed
|
||||||
if (bagHasKey(this.fields, "links"))
|
if (bagHasKey(this.fields, "links"))
|
||||||
this._atomLinksToURI();
|
this._atomLinksToURI();
|
||||||
|
|
||||||
// The link might be a guid w/ permalink=true
|
// The link might be a guid w/ permalink=true
|
||||||
if (!this.link && bagHasKey(this.fields, "guid")) {
|
if (!this.link && bagHasKey(this.fields, "guid")) {
|
||||||
var guid = this.fields.getProperty("guid");
|
var guid = this.fields.getProperty("guid");
|
||||||
if (bagHasKey(guid, "isPermaLink")) {
|
var isPermaLink = true;
|
||||||
var isPermaLink = new Boolean(guid.getProperty("isPermaLink"));
|
|
||||||
if (isPermaLink)
|
if (bagHasKey(guid, "isPermaLink"))
|
||||||
this.link = strToURI(guid.getProperty("guid"));
|
isPermaLink = new Boolean(guid.getProperty("isPermaLink"));
|
||||||
}
|
|
||||||
|
if (guid && isPermaLink)
|
||||||
|
this.link = strToURI(guid.getProperty("guid"));
|
||||||
}
|
}
|
||||||
},
|
|
||||||
|
|
||||||
|
this._resetBagMembersToRawText([this.searchLists.content,
|
||||||
|
this.searchLists.summary,
|
||||||
|
this.searchLists.title]);
|
||||||
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIFeedEntry) ||
|
if (iid.equals(Ci.nsIFeedEntry) ||
|
||||||
iid.equals(Ci.nsIFeedContainer) ||
|
iid.equals(Ci.nsIFeedContainer) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
throw Cr.NS_ERROR_NOINTERFACE;
|
throw Cr.NS_ERROR_NOINTERFACE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Entry.prototype._atomLinksToURI = Feed.prototype._atomLinksToURI;
|
Entry.prototype._atomLinksToURI = Feed.prototype._atomLinksToURI;
|
||||||
|
Entry.prototype._resetBagMembersToRawText =
|
||||||
|
Feed.prototype._resetBagMembersToRawText;
|
||||||
|
|
||||||
// TextConstruct represents and element that could contain (X)HTML
|
// TextConstruct represents and element that could contain (X)HTML
|
||||||
function TextConstruct() {
|
function TextConstruct() {
|
||||||
|
@ -513,6 +468,13 @@ function TextConstruct() {
|
||||||
}
|
}
|
||||||
|
|
||||||
TextConstruct.prototype = {
|
TextConstruct.prototype = {
|
||||||
|
plainText: function TC_plainText() {
|
||||||
|
if (this.type != "text") {
|
||||||
|
return gUnescapeHTML.unescape(stripTags(this.text));
|
||||||
|
}
|
||||||
|
return this.text;
|
||||||
|
},
|
||||||
|
|
||||||
QueryInterface: function(iid) {
|
QueryInterface: function(iid) {
|
||||||
if (iid.equals(Ci.nsIFeedTextConstruct) ||
|
if (iid.equals(Ci.nsIFeedTextConstruct) ||
|
||||||
iid.equals(Ci.nsISupports))
|
iid.equals(Ci.nsISupports))
|
||||||
|
@ -875,7 +837,10 @@ function FeedProcessor() {
|
||||||
"atom:subtitle":"text",
|
"atom:subtitle":"text",
|
||||||
"description":"html",
|
"description":"html",
|
||||||
"rss1:description":"html",
|
"rss1:description":"html",
|
||||||
|
"dc:description":"html",
|
||||||
"content:encoded":"html",
|
"content:encoded":"html",
|
||||||
|
"title":"text",
|
||||||
|
"rss1:title":"text",
|
||||||
"atom03:title":"text",
|
"atom03:title":"text",
|
||||||
"atom03:tagline":"text",
|
"atom03:tagline":"text",
|
||||||
"atom03:summary":"text",
|
"atom03:summary":"text",
|
||||||
|
@ -1374,9 +1339,8 @@ FeedProcessor.prototype = {
|
||||||
|
|
||||||
// But, it could be something containing HTML. If so,
|
// But, it could be something containing HTML. If so,
|
||||||
// we need to know about that.
|
// we need to know about that.
|
||||||
if (this._textConstructs[propName] != null &&
|
if (this._textConstructs[propName] != null &&
|
||||||
(this._result.version.indexOf("rss") == -1 ||
|
this._handlerStack[this._depth].containerClass !== null) {
|
||||||
this._handlerStack[this._depth].containerClass != null)) {
|
|
||||||
var newProp = Cc[TEXTCONSTRUCT_CONTRACTID].
|
var newProp = Cc[TEXTCONSTRUCT_CONTRACTID].
|
||||||
createInstance(Ci.nsIFeedTextConstruct);
|
createInstance(Ci.nsIFeedTextConstruct);
|
||||||
newProp.text = chars;
|
newProp.text = chars;
|
||||||
|
@ -1398,6 +1362,12 @@ FeedProcessor.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If it's rss feed-level description, it's not supposed to have html
|
||||||
|
if (this._result.version.indexOf("rss") >= 0 &&
|
||||||
|
this._handlerStack[this._depth].containerClass != ENTRY_CONTRACTID) {
|
||||||
|
type = "text";
|
||||||
|
}
|
||||||
|
|
||||||
newProp.type = type;
|
newProp.type = type;
|
||||||
container.setPropertyAsInterface(propName, newProp);
|
container.setPropertyAsInterface(propName, newProp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ TestListener.prototype = {
|
||||||
var feed = result.doc;
|
var feed = result.doc;
|
||||||
// QI to something
|
// QI to something
|
||||||
(isIID(feed, Components.interfaces.nsIFeed));
|
(isIID(feed, Components.interfaces.nsIFeed));
|
||||||
try {
|
try {
|
||||||
if(!eval(testcase.expect)){
|
if(!eval(testcase.expect)){
|
||||||
print(testcase.path + ": \n");
|
print(testcase.path + ": \n");
|
||||||
print("FAILED! Test was: \"" + testcase.desc + "\" |\n" + testcase.expect + '|\n');
|
print("FAILED! Test was: \"" + testcase.desc + "\" |\n" + testcase.expect + '|\n');
|
||||||
|
@ -64,8 +64,10 @@ TestListener.prototype = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(e) {
|
catch(e) {
|
||||||
|
print(testcase.path + ": \n");
|
||||||
print("FAILED! Test was: " + testcase.expect + "\nex: " + e.message + "\n");
|
print("FAILED! Test was: " + testcase.expect + "\nex: " + e.message + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ran += 1;
|
ran += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -74,7 +76,6 @@ var startDate = new Date();
|
||||||
|
|
||||||
for(var i=0; i<tests.length; i++){
|
for(var i=0; i<tests.length; i++){
|
||||||
var testcase = tests[i];
|
var testcase = tests[i];
|
||||||
|
|
||||||
var uri;
|
var uri;
|
||||||
if (testcase.base == null)
|
if (testcase.base == null)
|
||||||
uri = ioService.newURI('http://example.org/'+testcase.path, null,null);
|
uri = ioService.newURI('http://example.org/'+testcase.path, null,null);
|
||||||
|
@ -87,7 +88,6 @@ for(var i=0; i<tests.length; i++){
|
||||||
.createInstance(Components.interfaces.nsIFileInputStream);
|
.createInstance(Components.interfaces.nsIFileInputStream);
|
||||||
var listener = new TestListener();
|
var listener = new TestListener();
|
||||||
try{
|
try{
|
||||||
//print('Start: ' + testcase.path);
|
|
||||||
stream.init(testcase.file, 0x01, 0444, 0);
|
stream.init(testcase.file, 0x01, 0444, 0);
|
||||||
parser.listener = listener;
|
parser.listener = listener;
|
||||||
parser.parseFromStream(stream, uri);
|
parser.parseFromStream(stream, uri);
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry summary works
|
Description: atom entry summary works
|
||||||
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(false) == "test content";
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.plainText() == "test content";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -32,4 +32,4 @@ Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content
|
||||||
<content>test content</content>
|
<content>test content</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry content:encoded and xhtml works
|
Description: atom entry content:encoded and xhtml works
|
||||||
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(true); content == "should appear";
|
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.plainText(); content == "should appear";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -40,4 +40,4 @@ Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeed
|
||||||
</content:encoded>
|
</content:encoded>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry content html works
|
Description: atom entry content html works
|
||||||
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(true); content == "test content";
|
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.plainText(); content == "test content";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -32,4 +32,4 @@ Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeed
|
||||||
<content type="html"><b>test</b> content</content>
|
<content type="html"><b>test</b> content</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry content xhtml works
|
Description: atom entry content xhtml works
|
||||||
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(true); content == "test content";
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.plainText() == "test content";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -36,4 +36,4 @@ Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeed
|
||||||
</content>
|
</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry content xhtml works
|
Description: atom entry content xhtml works
|
||||||
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(false); content == "<b>test</b> content";
|
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.text; content == "<b>test</b> content";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -36,4 +36,4 @@ Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeed
|
||||||
</content>
|
</content>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: HTML title w/ CDATA
|
Description: HTML title w/ CDATA
|
||||||
Expect: var title = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title; title == "<title>";
|
Expect: var title = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title.plainText(); title == "<title>";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
|
|
|
@ -1,35 +0,0 @@
|
||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Description: atom feed and entry with random attributes works
|
|
||||||
Expect: var parent = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).parent; parent.title == "hmm";
|
|
||||||
|
|
||||||
-->
|
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
|
||||||
xmlns:foo="http://www.example.org"
|
|
||||||
foo:quux="quuux">
|
|
||||||
|
|
||||||
<title>hmm</title>
|
|
||||||
|
|
||||||
<author>
|
|
||||||
<email>hmm@example.com</email>
|
|
||||||
<name>foo</name>
|
|
||||||
</author>
|
|
||||||
<generator version="1.1" uri="http://example.org">Hmm</generator>
|
|
||||||
<author>
|
|
||||||
<email>bar@example.com</email>
|
|
||||||
<name>foo</name>
|
|
||||||
</author>
|
|
||||||
<rights type="xhtml">
|
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml"><i>test</i> rights</div>
|
|
||||||
</rights>
|
|
||||||
|
|
||||||
|
|
||||||
<entry></entry>
|
|
||||||
|
|
||||||
<entry foo:bar="baz">
|
|
||||||
<title>test</title>
|
|
||||||
|
|
||||||
</entry>
|
|
||||||
|
|
||||||
</feed>
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry summary xhtml works
|
Description: atom entry summary xhtml works
|
||||||
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary(true) == "test summary";
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary.plainText() == "test summary";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -37,4 +37,4 @@ Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary
|
||||||
</summary>
|
</summary>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom feed and entry with random attributes works
|
Description: atom feed and entry with random attributes works
|
||||||
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title == "test";
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title.text == "test";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -32,4 +32,4 @@ Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title =
|
||||||
|
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry title normalized
|
Description: atom entry title normalized
|
||||||
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title == "test";
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title.text == "test";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -32,4 +32,4 @@ Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title =
|
||||||
|
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom entry content:encoded and xhtml works
|
Description: atom entry content:encoded and xhtml works
|
||||||
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content(false); content == "<b>test</b> content";
|
Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).content.text; content == "<b>test</b> content";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -40,4 +40,4 @@ Expect: var content = feed.items.queryElementAt(1, Components.interfaces.nsIFeed
|
||||||
</content:encoded>
|
</content:encoded>
|
||||||
</entry>
|
</entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom feed and entry with random attributes works
|
Description: atom feed and entry with random attributes works
|
||||||
Expect: feed.title == "hmm" && feed.items.length == 2
|
Expect: feed.title.text == "hmm" && feed.items.length == 2
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom"
|
<feed xmlns="http://www.w3.org/2005/Atom"
|
||||||
|
@ -27,4 +27,4 @@ Expect: feed.title == "hmm" && feed.items.length == 2
|
||||||
<entry foo:bar="baz"></entry>
|
<entry foo:bar="baz"></entry>
|
||||||
<entry></entry>
|
<entry></entry>
|
||||||
|
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom subtitle works
|
Description: atom subtitle works
|
||||||
Expect: var sub = feed.subtitle(false); sub == '<b>test</b> subtitle';
|
Expect: var sub = feed.subtitle.text; sub == '<b>test</b> subtitle';
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<subtitle type="xhtml">
|
<subtitle type="xhtml">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml"><b>test</b> subtitle</div>
|
<div xmlns="http://www.w3.org/1999/xhtml"><b>test</b> subtitle</div>
|
||||||
</subtitle>
|
</subtitle>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!--
|
<!--
|
||||||
Description: XHTML title with apos
|
Description: XHTML title with apos
|
||||||
Expect: feed.title == "Tantek's Updates"
|
Expect: feed.title.plainText() == "Tantek's Updates"
|
||||||
-->
|
-->
|
||||||
<feed xml:lang="en-US"
|
<feed xml:lang="en-US"
|
||||||
xmlns="http://www.w3.org/2005/Atom">
|
xmlns="http://www.w3.org/2005/Atom">
|
||||||
|
@ -43,4 +43,4 @@ Expect: feed.title == "Tantek's Updates"
|
||||||
</div>
|
</div>
|
||||||
</content>
|
</content>
|
||||||
</entry>
|
</entry>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,9 +2,9 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom title works
|
Description: atom title works
|
||||||
Expect: feed.title == 'test title'
|
Expect: feed.title.text == 'test title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<title>test title</title>
|
<title>test title</title>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<?xml version='1.0' encoding='UTF-8'?>
|
<?xml version='1.0' encoding='UTF-8'?>
|
||||||
<!--
|
<!--
|
||||||
Description: Feed title works with full entry
|
Description: Feed title works with full entry
|
||||||
Expect: feed.title == 'ongoing'
|
Expect: feed.title.text == 'ongoing'
|
||||||
-->
|
-->
|
||||||
<feed xmlns='http://www.w3.org/2005/Atom'
|
<feed xmlns='http://www.w3.org/2005/Atom'
|
||||||
xml:base='http://www.tbray.org/ongoing/ongoing.atom'
|
xml:base='http://www.tbray.org/ongoing/ongoing.atom'
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom title works
|
Description: atom title works
|
||||||
Expect: feed.title == 'test title'
|
Expect: feed.title.plainText() == 'test title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
<title type="xhtml">
|
<title type="xhtml">
|
||||||
<div xmlns="http://www.w3.org/1999/xhtml"><b>test</b> title</div>
|
<div xmlns="http://www.w3.org/1999/xhtml"><b>test</b> title</div>
|
||||||
</title>
|
</title>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: atom summary with entities works
|
Description: atom summary with entities works
|
||||||
Expect: feed.subtitle(false) == '"test" & 'title' & <ok>'
|
Expect: feed.subtitle.text == '"test" & 'title' & <ok>'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||||
|
@ -11,4 +11,4 @@ Expect: feed.subtitle(false) == '"test" & 'title' &
|
||||||
"test" & 'title' & <ok>
|
"test" & 'title' & <ok>
|
||||||
</div>
|
</div>
|
||||||
</subtitle>
|
</subtitle>
|
||||||
</feed>
|
</feed>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed w/ bogus title element
|
Description: RSS1 feed w/ bogus title element
|
||||||
Expect: feed.fields.getProperty('rss1:title') == 'Correct Title'
|
Expect: feed.title.text == 'Correct Title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -42,4 +42,4 @@ Expect: feed.fields.getProperty('rss1:title') == 'Correct Title'
|
||||||
</dc:description>
|
</dc:description>
|
||||||
<title>XML: A Disruptive Technology</title>
|
<title>XML: A Disruptive Technology</title>
|
||||||
</item>
|
</item>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed description works normalized
|
Description: RSS1 feed description works normalized
|
||||||
Expect: feed.subtitle(true) == 'a description'
|
Expect: feed.subtitle.text == 'a description'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -14,4 +14,4 @@ Expect: feed.subtitle(true) == 'a description'
|
||||||
<link>http://xml.com/pub</link>
|
<link>http://xml.com/pub</link>
|
||||||
<description>a description</description>
|
<description>a description</description>
|
||||||
</channel>
|
</channel>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed description works normalized
|
Description: RSS1 feed description works normalized
|
||||||
Expect: feed.subtitle(true) == 'a description'
|
Expect: feed.subtitle.text == 'a description'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -16,4 +16,4 @@ Expect: feed.subtitle(true) == 'a description'
|
||||||
<dc:description>another description</dc:description>
|
<dc:description>another description</dc:description>
|
||||||
<description>a description</description>
|
<description>a description</description>
|
||||||
</channel>
|
</channel>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed description works normalized
|
Description: RSS1 feed description works normalized
|
||||||
Expect: feed.subtitle(true) == 'another description'
|
Expect: feed.subtitle.plainText() == 'another description'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -14,4 +14,4 @@ Expect: feed.subtitle(true) == 'another description'
|
||||||
<link>http://xml.com/pub</link>
|
<link>http://xml.com/pub</link>
|
||||||
<dc:description>another description</dc:description>
|
<dc:description>another description</dc:description>
|
||||||
</channel>
|
</channel>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed title works normalized
|
Description: RSS1 feed title works normalized
|
||||||
Expect: feed.title == 'Test'
|
Expect: feed.title.plainText() == 'Test'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -12,4 +12,4 @@ Expect: feed.title == 'Test'
|
||||||
<channel rdf:about="http://www.xml.com/xml/news.rss">
|
<channel rdf:about="http://www.xml.com/xml/news.rss">
|
||||||
<title>Test</title>
|
<title>Test</title>
|
||||||
</channel>
|
</channel>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed w/ item dc:description
|
Description: RSS1 feed w/ item dc:description
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(true) == 'XML is...'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.plainText() == 'XML is...'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -34,4 +34,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
</dc:description>
|
</dc:description>
|
||||||
<title>XML: A Disruptive Technology</title>
|
<title>XML: A Disruptive Technology</title>
|
||||||
</item>
|
</item>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed w/ item desc normalized
|
Description: RSS1 feed w/ item desc normalized
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(true) == 'XML is placing increasingly heavy loads on the existing technical infrastructure of the Internet.'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.plainText() == 'XML is placing increasingly heavy loads on the existing technical infrastructure of the Internet.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -28,4 +28,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
<item>
|
<item>
|
||||||
|
|
||||||
</item>
|
</item>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: RSS1 feed w/ item title normalized
|
Description: RSS1 feed w/ item title normalized
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title == 'XML: A Disruptive Technology'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title.text == 'XML: A Disruptive Technology'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rdf:RDF
|
<rdf:RDF
|
||||||
|
@ -29,4 +29,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title =
|
||||||
<item>
|
<item>
|
||||||
|
|
||||||
</item>
|
</item>
|
||||||
</rdf:RDF>
|
</rdf:RDF>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel description works
|
Description: channel description works
|
||||||
Expect: feed.subtitle(true) == 'test'
|
Expect: feed.subtitle.text == 'test'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
<channel>
|
<channel>
|
||||||
<description>test</description>
|
<description>test</description>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel description works
|
Description: channel description works
|
||||||
Expect: feed.subtitle(false) == '<i><b>test</b></i>'
|
Expect: feed.subtitle.plainText() == '<i><b>test</b></i>'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
<channel>
|
<channel>
|
||||||
<description><![CDATA[<i><b>test</b></i>]]></description>
|
<description><![CDATA[<i><b>test</b></i>]]></description>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel description markup is not HTML
|
Description: channel description markup is not HTML
|
||||||
Expect: feed.subtitle(true) == '<i><b>test</b></i>'
|
Expect: feed.subtitle.plainText() == '<i><b>test</b></i>'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
<channel>
|
<channel>
|
||||||
<description><![CDATA[<i><b>test</b></i>]]></description>
|
<description><![CDATA[<i><b>test</b></i>]]></description>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel title works
|
Description: channel title works
|
||||||
Expect: feed.title == 'test title'
|
Expect: feed.title.plainText() == 'test title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
<channel>
|
<channel>
|
||||||
<title>test title</title>
|
<title>test title</title>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel title works w/ funky CDATA title
|
Description: channel title works w/ funky CDATA title
|
||||||
Expect: feed.title == 'test title'
|
Expect: feed.title.plainText() == 'test title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
<channel>
|
<channel>
|
||||||
<title>test t<![CDATA[it]]>le</title>
|
<title>test t<![CDATA[it]]>le</title>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: channel title works w/ nested title
|
Description: channel title works w/ nested title
|
||||||
Expect: feed.title == 'test title'
|
Expect: feed.title.text == 'test title'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -10,4 +10,4 @@ Expect: feed.title == 'test title'
|
||||||
<title>test title</title>
|
<title>test title</title>
|
||||||
<bogus><title>bogus title</title></bogus>
|
<bogus><title>bogus title</title></bogus>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item title works
|
Description: item title works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).content(true) == 'foobar'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).content.plainText() == 'foobar'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc encoded works
|
Description: item desc encoded works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(false) == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.text == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -15,4 +15,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
|
|
||||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc encoded works
|
Description: item desc encoded works
|
||||||
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary(false) == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary.text == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -18,4 +18,4 @@ Expect: feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).summary
|
||||||
|
|
||||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc CDATA works
|
Description: item desc CDATA works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(false) == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.text == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -17,4 +17,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
<description><![CDATA[I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.]]></description>
|
<description><![CDATA[I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.]]></description>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc encoded, double-escaped entity
|
Description: item desc encoded, double-escaped entity
|
||||||
Expect: var summary = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(true); summary == "test D\u00e9sol\u00e9e";
|
Expect: var summary = feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary; summary.plainText() == "test D\u00e9sol\u00e9e";
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -18,4 +18,4 @@ Expect: var summary = feed.items.queryElementAt(0, Components.interfaces.nsIFeed
|
||||||
</description>
|
</description>
|
||||||
</item>
|
</item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc encoded, normalied works
|
Description: item desc encoded, normalied works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(false) == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.text == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -15,4 +15,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
|
|
||||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc encoded, normalized works
|
Description: item desc encoded, normalized works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(true) == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week Valley Girl came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.plainText() == 'I\'m headed for France. I wasn\'t gonna go this year, but then last week Valley Girl came out and I said to myself, Joe Bob, you gotta get out of the country for a while.'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -15,4 +15,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
|
|
||||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
<description>I'm headed for France. I wasn't gonna go this year, but then last week <a href="http://www.imdb.com/title/tt0086525/">Valley Girl</a> came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item desc plain text works
|
Description: item desc plain text works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary(false) == "I'm headed for France. I wasn't gonna go this year, but then last week \"Valley Girl\" came out and I said to myself, Joe Bob, you gotta get out of the country for a while."
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary.text == "I'm headed for France. I wasn't gonna go this year, but then last week \"Valley Girl\" came out and I said to myself, Joe Bob, you gotta get out of the country for a while."
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
@ -16,4 +16,4 @@ Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).summary
|
||||||
<category domain="foo">bar</category>
|
<category domain="foo">bar</category>
|
||||||
<description>I'm headed for France. I wasn't gonna go this year, but then last week "Valley Girl" came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
<description>I'm headed for France. I wasn't gonna go this year, but then last week "Valley Girl" came out and I said to myself, Joe Bob, you gotta get out of the country for a while.</description></item>
|
||||||
</channel>
|
</channel>
|
||||||
</rss>
|
</rss>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: item title works
|
Description: item title works
|
||||||
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title == 'test'
|
Expect: feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title.text == 'test'
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
|
|
||||||
Description: 2 items title works
|
Description: 2 items title works
|
||||||
Expect: ((feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).fields.getProperty('title') == 'test') && (feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).fields.getProperty('title') == 'test #2'))
|
Expect: ((feed.items.queryElementAt(0, Components.interfaces.nsIFeedEntry).title.text == 'test') && (feed.items.queryElementAt(1, Components.interfaces.nsIFeedEntry).title.text == 'test #2'))
|
||||||
|
|
||||||
-->
|
-->
|
||||||
<rss version="2.0" >
|
<rss version="2.0" >
|
||||||
|
|
Загрузка…
Ссылка в новой задаче