зеркало из 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.
|
||||
*/
|
||||
[scriptable, uuid(29884967-afaa-43ce-ad10-8234deebea15)]
|
||||
[scriptable, uuid(9472ff5b-10dc-4aed-a861-7619d7a4b5bf)]
|
||||
interface nsIFeed : nsIFeedContainer
|
||||
{
|
||||
/**
|
||||
* Uses description, subtitle, and extensions
|
||||
* 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.
|
||||
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
|
||||
* SOAP service.
|
||||
*/
|
||||
attribute nsIPropertyBag2 cloud;
|
||||
attribute nsIWritablePropertyBag2 cloud;
|
||||
|
||||
/**
|
||||
* An image url and some metadata (as defined by RSS2).
|
||||
*
|
||||
*/
|
||||
attribute nsIPropertyBag2 image;
|
||||
attribute nsIWritablePropertyBag2 image;
|
||||
|
||||
/**
|
||||
* 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>
|
||||
* for more details.
|
||||
*/
|
||||
attribute nsIPropertyBag2 textInput;
|
||||
attribute nsIWritablePropertyBag2 textInput;
|
||||
|
||||
/**
|
||||
* Days to skip fetching. This field was supposed to designate
|
||||
|
|
|
@ -37,15 +37,16 @@
|
|||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIURI;
|
||||
interface nsIPropertyBag2;
|
||||
interface nsIWritablePropertyBag2;
|
||||
interface nsIArray;
|
||||
interface nsIFeedTextConstruct;
|
||||
|
||||
/**
|
||||
* A shared base for feeds and items, which are pretty similar,
|
||||
* but they have some divergent attributes and require
|
||||
* different convenience methods.
|
||||
*/
|
||||
[scriptable, uuid(b7e7b6b9-a461-4817-9003-3e6b9005945f)]
|
||||
[scriptable, uuid(56877da5-598b-41dd-bf3e-72fe713c7820)]
|
||||
interface nsIFeedContainer : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -69,16 +70,13 @@ interface nsIFeedContainer : nsISupports
|
|||
* Common namespaces are accessed using prefixes, like get("dc:subject");.
|
||||
* See nsIFeedResult::registerExtensionPrefix.
|
||||
*/
|
||||
attribute nsIPropertyBag2 fields;
|
||||
attribute nsIWritablePropertyBag2 fields;
|
||||
|
||||
/**
|
||||
* Sometimes there's no title, or the title contains markup.
|
||||
*
|
||||
* @returns A plain text title string gleaned from whatever
|
||||
* the publisher has included in the feed. In most
|
||||
* cases, this is the contents of the <title>.
|
||||
* Sometimes there's no title, or the title contains markup, so take
|
||||
* care in decoding the attribute.
|
||||
*/
|
||||
attribute AString title;
|
||||
attribute nsIFeedTextConstruct title;
|
||||
|
||||
/**
|
||||
* Returns the primary link for the feed or entry.
|
||||
|
|
|
@ -40,9 +40,11 @@
|
|||
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 {
|
||||
|
||||
/**
|
||||
|
@ -54,17 +56,15 @@ interface nsIFeedEntry : nsIFeedContainer {
|
|||
* Uses description, subtitle, summary, content and extensions
|
||||
* 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.
|
||||
*
|
||||
* @param stripTags If true, remove HTML markup.
|
||||
*/
|
||||
AString content(in boolean stripTags);
|
||||
attribute nsIFeedTextConstruct content;
|
||||
|
||||
/**
|
||||
* Enclosures are podcasts, photocasts, etc.
|
||||
|
|
|
@ -70,5 +70,12 @@ interface nsIFeedTextConstruct : nsISupports
|
|||
* The content of the text construct.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
function isIFeedTextConstruct(a) {
|
||||
var rv = false;
|
||||
try {
|
||||
a.QueryInterface(Ci.nsIFeedTextConstruct);
|
||||
rv = true;
|
||||
}
|
||||
catch(e) {
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
function isIArray(a) {
|
||||
return isIID(a, Ci.nsIArray);
|
||||
}
|
||||
|
@ -113,20 +102,6 @@ function stripTags(someHTML) {
|
|||
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
|
||||
* of matching property bags.
|
||||
|
@ -339,37 +314,21 @@ FeedResult.prototype = {
|
|||
}
|
||||
|
||||
function Feed() {
|
||||
this._sub = null;
|
||||
this._title = null;
|
||||
this.subtitle = null;
|
||||
this.title = null;
|
||||
this.items = [];
|
||||
this.link = null;
|
||||
this.id = null;
|
||||
this.baseURI = null;
|
||||
}
|
||||
|
||||
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: {
|
||||
_sub: ["description","dc:description","rss1:description",
|
||||
subtitle: ["description","dc:description","rss1:description",
|
||||
"atom03:tagline","atom:subtitle"],
|
||||
items: ["items","atom03_entries","entries"],
|
||||
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]],
|
||||
categories: ["categories", "dc:subject"],
|
||||
cloud: ["cloud"],
|
||||
|
@ -389,6 +348,9 @@ Feed.prototype = {
|
|||
// Assign Atom link if needed
|
||||
if (bagHasKey(this.fields, "links"))
|
||||
this._atomLinksToURI();
|
||||
|
||||
this._resetBagMembersToRawText([this.searchLists.subtitle,
|
||||
this.searchLists.title]);
|
||||
},
|
||||
|
||||
_atomLinksToURI: function Feed_linkToURI() {
|
||||
|
@ -411,6 +373,19 @@ 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) {
|
||||
if (iid.equals(Ci.nsIFeed) ||
|
||||
iid.equals(Ci.nsIFeedContainer) ||
|
||||
|
@ -421,9 +396,9 @@ Feed.prototype = {
|
|||
}
|
||||
|
||||
function Entry() {
|
||||
this._summary = null;
|
||||
this._content = null;
|
||||
this._title = null;
|
||||
this.summary = null;
|
||||
this.content = null;
|
||||
this.title = null;
|
||||
this.fields = Cc["@mozilla.org/hash-property-bag;1"].
|
||||
createInstance(Ci.nsIWritablePropertyBag2);
|
||||
this.link = null;
|
||||
|
@ -433,45 +408,17 @@ function Entry() {
|
|||
|
||||
Entry.prototype = {
|
||||
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,
|
||||
mediaContent: null,
|
||||
|
||||
searchLists: {
|
||||
_title: ["title", "rss1:title", "atom03:title", "atom:title"],
|
||||
title: ["title", "rss1:title", "atom03:title", "atom:title"],
|
||||
link: [["link",strToURI],["rss1:link",strToURI]],
|
||||
id: [["guid", makePropGetter("guid")], "rdf:about",
|
||||
"atom03:id", "atom:id"],
|
||||
_summary: ["description", "rss1:description", "dc:description",
|
||||
summary: ["description", "rss1:description", "dc:description",
|
||||
"atom03:summary", "atom:summary"],
|
||||
_content: ["content:encoded","atom03:content","atom:content"]
|
||||
content: ["content:encoded","atom03:content","atom:content"]
|
||||
},
|
||||
|
||||
normalize: function Entry_normalize() {
|
||||
|
@ -484,12 +431,18 @@ Entry.prototype = {
|
|||
// The link might be a guid w/ permalink=true
|
||||
if (!this.link && bagHasKey(this.fields, "guid")) {
|
||||
var guid = this.fields.getProperty("guid");
|
||||
if (bagHasKey(guid, "isPermaLink")) {
|
||||
var isPermaLink = new Boolean(guid.getProperty("isPermaLink"));
|
||||
if (isPermaLink)
|
||||
var isPermaLink = true;
|
||||
|
||||
if (bagHasKey(guid, "isPermaLink"))
|
||||
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) {
|
||||
|
@ -503,6 +456,8 @@ Entry.prototype = {
|
|||
}
|
||||
|
||||
Entry.prototype._atomLinksToURI = Feed.prototype._atomLinksToURI;
|
||||
Entry.prototype._resetBagMembersToRawText =
|
||||
Feed.prototype._resetBagMembersToRawText;
|
||||
|
||||
// TextConstruct represents and element that could contain (X)HTML
|
||||
function TextConstruct() {
|
||||
|
@ -513,6 +468,13 @@ function TextConstruct() {
|
|||
}
|
||||
|
||||
TextConstruct.prototype = {
|
||||
plainText: function TC_plainText() {
|
||||
if (this.type != "text") {
|
||||
return gUnescapeHTML.unescape(stripTags(this.text));
|
||||
}
|
||||
return this.text;
|
||||
},
|
||||
|
||||
QueryInterface: function(iid) {
|
||||
if (iid.equals(Ci.nsIFeedTextConstruct) ||
|
||||
iid.equals(Ci.nsISupports))
|
||||
|
@ -875,7 +837,10 @@ function FeedProcessor() {
|
|||
"atom:subtitle":"text",
|
||||
"description":"html",
|
||||
"rss1:description":"html",
|
||||
"dc:description":"html",
|
||||
"content:encoded":"html",
|
||||
"title":"text",
|
||||
"rss1:title":"text",
|
||||
"atom03:title":"text",
|
||||
"atom03:tagline":"text",
|
||||
"atom03:summary":"text",
|
||||
|
@ -1375,8 +1340,7 @@ FeedProcessor.prototype = {
|
|||
// But, it could be something containing HTML. If so,
|
||||
// we need to know about that.
|
||||
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].
|
||||
createInstance(Ci.nsIFeedTextConstruct);
|
||||
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;
|
||||
container.setPropertyAsInterface(propName, newProp);
|
||||
}
|
||||
|
|
|
@ -64,8 +64,10 @@ TestListener.prototype = {
|
|||
}
|
||||
}
|
||||
catch(e) {
|
||||
print(testcase.path + ": \n");
|
||||
print("FAILED! Test was: " + testcase.expect + "\nex: " + e.message + "\n");
|
||||
}
|
||||
|
||||
ran += 1;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +76,6 @@ var startDate = new Date();
|
|||
|
||||
for(var i=0; i<tests.length; i++){
|
||||
var testcase = tests[i];
|
||||
|
||||
var uri;
|
||||
if (testcase.base == 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);
|
||||
var listener = new TestListener();
|
||||
try{
|
||||
//print('Start: ' + testcase.path);
|
||||
stream.init(testcase.file, 0x01, 0444, 0);
|
||||
parser.listener = listener;
|
||||
parser.parseFromStream(stream, uri);
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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">
|
||||
|
|
|
@ -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
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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"
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Description: XHTML title with apos
|
||||
Expect: feed.title == "Tantek's Updates"
|
||||
Expect: feed.title.plainText() == "Tantek's Updates"
|
||||
-->
|
||||
<feed xml:lang="en-US"
|
||||
xmlns="http://www.w3.org/2005/Atom">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: atom title works
|
||||
Expect: feed.title == 'test title'
|
||||
Expect: feed.title.text == 'test title'
|
||||
|
||||
-->
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!--
|
||||
Description: Feed title works with full entry
|
||||
Expect: feed.title == 'ongoing'
|
||||
Expect: feed.title.text == 'ongoing'
|
||||
-->
|
||||
<feed xmlns='http://www.w3.org/2005/Atom'
|
||||
xml:base='http://www.tbray.org/ongoing/ongoing.atom'
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: atom title works
|
||||
Expect: feed.title == 'test title'
|
||||
Expect: feed.title.plainText() == 'test title'
|
||||
|
||||
-->
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: RSS1 feed w/ bogus title element
|
||||
Expect: feed.fields.getProperty('rss1:title') == 'Correct Title'
|
||||
Expect: feed.title.text == 'Correct Title'
|
||||
|
||||
-->
|
||||
<rdf:RDF
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: RSS1 feed description works normalized
|
||||
Expect: feed.subtitle(true) == 'a description'
|
||||
Expect: feed.subtitle.text == 'a description'
|
||||
|
||||
-->
|
||||
<rdf:RDF
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: RSS1 feed description works normalized
|
||||
Expect: feed.subtitle(true) == 'a description'
|
||||
Expect: feed.subtitle.text == 'a description'
|
||||
|
||||
-->
|
||||
<rdf:RDF
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: RSS1 feed description works normalized
|
||||
Expect: feed.subtitle(true) == 'another description'
|
||||
Expect: feed.subtitle.plainText() == 'another description'
|
||||
|
||||
-->
|
||||
<rdf:RDF
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: RSS1 feed title works normalized
|
||||
Expect: feed.title == 'Test'
|
||||
Expect: feed.title.plainText() == 'Test'
|
||||
|
||||
-->
|
||||
<rdf:RDF
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: channel description works
|
||||
Expect: feed.subtitle(true) == 'test'
|
||||
Expect: feed.subtitle.text == 'test'
|
||||
|
||||
-->
|
||||
<rss version="2.0" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: channel title works
|
||||
Expect: feed.title == 'test title'
|
||||
Expect: feed.title.plainText() == 'test title'
|
||||
|
||||
-->
|
||||
<rss version="2.0" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: channel title works w/ funky CDATA title
|
||||
Expect: feed.title == 'test title'
|
||||
Expect: feed.title.plainText() == 'test title'
|
||||
|
||||
-->
|
||||
<rss version="2.0" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
Description: channel title works w/ nested title
|
||||
Expect: feed.title == 'test title'
|
||||
Expect: feed.title.text == 'test title'
|
||||
|
||||
-->
|
||||
<rss version="2.0" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<!--
|
||||
|
||||
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" >
|
||||
|
|
Загрузка…
Ссылка в новой задаче