diff options
Diffstat (limited to 'toolkit/components')
-rw-r--r-- | toolkit/components/build/nsToolkitCompsModule.cpp | 10 | ||||
-rw-r--r-- | toolkit/components/reader/AboutReader.jsm | 1 | ||||
-rw-r--r-- | toolkit/components/reader/JSDOMParser.js | 32 | ||||
-rw-r--r-- | toolkit/components/reader/Readability.js | 214 | ||||
-rw-r--r-- | toolkit/components/reader/ReaderMode.jsm | 2 | ||||
-rw-r--r-- | toolkit/components/reader/ReaderWorker.js | 2 | ||||
-rw-r--r-- | toolkit/components/search/moz.build | 6 | ||||
-rw-r--r-- | toolkit/components/startup/moz.build | 21 | ||||
-rw-r--r-- | toolkit/components/startup/public/moz.build | 8 | ||||
-rw-r--r-- | toolkit/components/telemetry/Histograms.json | 103 | ||||
-rw-r--r-- | toolkit/components/telemetry/histogram-whitelists.json | 12 | ||||
-rw-r--r-- | toolkit/components/thumbnails/BackgroundPageThumbs.jsm | 6 | ||||
-rw-r--r-- | toolkit/components/thumbnails/test/test_thumbnails_interfaces.js | 6 |
13 files changed, 195 insertions, 228 deletions
diff --git a/toolkit/components/build/nsToolkitCompsModule.cpp b/toolkit/components/build/nsToolkitCompsModule.cpp index 190c4da06..33c604c4e 100644 --- a/toolkit/components/build/nsToolkitCompsModule.cpp +++ b/toolkit/components/build/nsToolkitCompsModule.cpp @@ -5,7 +5,9 @@ #include "mozilla/ModuleUtils.h" #include "nsAppStartup.h" #include "nsNetCID.h" +#ifdef MOZ_USERINFO #include "nsUserInfo.h" +#endif #include "nsToolkitCompsCID.h" #include "nsFindService.h" #if defined(MOZ_UPDATER) && !defined(MOZ_WIDGET_ANDROID) @@ -76,7 +78,9 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPerformanceStatsService, Init) NS_GENERIC_FACTORY_CONSTRUCTOR(nsTerminator) #endif +#if defined(MOZ_USERINFO) NS_GENERIC_FACTORY_CONSTRUCTOR(nsUserInfo) +#endif // defined (MOZ_USERINFO) NS_GENERIC_FACTORY_CONSTRUCTOR(nsFindService) #if !defined(MOZ_DISABLE_PARENTAL_CONTROLS) @@ -141,7 +145,9 @@ NS_DEFINE_NAMED_CID(NS_TOOLKIT_PERFORMANCESTATSSERVICE_CID); #if defined(MOZ_HAS_TERMINATOR) NS_DEFINE_NAMED_CID(NS_TOOLKIT_TERMINATOR_CID); #endif +#if defined(MOZ_USERINFO) NS_DEFINE_NAMED_CID(NS_USERINFO_CID); +#endif // defined (MOZ_USERINFO) NS_DEFINE_NAMED_CID(ALERT_NOTIFICATION_CID); NS_DEFINE_NAMED_CID(NS_ALERTSSERVICE_CID); #if !defined(MOZ_DISABLE_PARENTAL_CONTROLS) @@ -179,7 +185,9 @@ static const Module::CIDEntry kToolkitCIDs[] = { #if defined(MOZ_HAS_PERFSTATS) { &kNS_TOOLKIT_PERFORMANCESTATSSERVICE_CID, false, nullptr, nsPerformanceStatsServiceConstructor }, #endif // defined (MOZ_HAS_PERFSTATS) +#if defined(MOZ_USERINFO) { &kNS_USERINFO_CID, false, nullptr, nsUserInfoConstructor }, +#endif // defined (MOZ_USERINFO) { &kALERT_NOTIFICATION_CID, false, nullptr, AlertNotificationConstructor }, { &kNS_ALERTSSERVICE_CID, false, nullptr, nsAlertsServiceConstructor }, #if !defined(MOZ_DISABLE_PARENTAL_CONTROLS) @@ -219,7 +227,9 @@ static const Module::ContractIDEntry kToolkitContracts[] = { #if defined(MOZ_HAS_PERFSTATS) { NS_TOOLKIT_PERFORMANCESTATSSERVICE_CONTRACTID, &kNS_TOOLKIT_PERFORMANCESTATSSERVICE_CID }, #endif // defined (MOZ_HAS_PERFSTATS) +#if defined(MOZ_USERINFO) { NS_USERINFO_CONTRACTID, &kNS_USERINFO_CID }, +#endif // defined(MOZ_USERINFO) { ALERT_NOTIFICATION_CONTRACTID, &kALERT_NOTIFICATION_CID }, { NS_ALERTSERVICE_CONTRACTID, &kNS_ALERTSSERVICE_CID }, #if !defined(MOZ_DISABLE_PARENTAL_CONTROLS) diff --git a/toolkit/components/reader/AboutReader.jsm b/toolkit/components/reader/AboutReader.jsm index c5d04476d..6ec959eba 100644 --- a/toolkit/components/reader/AboutReader.jsm +++ b/toolkit/components/reader/AboutReader.jsm @@ -14,7 +14,6 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "AsyncPrefs", "resource://gre/modules/AsyncPrefs.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NarrateControls", "resource://gre/modules/narrate/NarrateControls.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "Rect", "resource://gre/modules/Geometry.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PluralForm", "resource://gre/modules/PluralForm.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"); diff --git a/toolkit/components/reader/JSDOMParser.js b/toolkit/components/reader/JSDOMParser.js index dd9d37230..debdb08eb 100644 --- a/toolkit/components/reader/JSDOMParser.js +++ b/toolkit/components/reader/JSDOMParser.js @@ -618,6 +618,13 @@ }; var Element = function (tag) { + // We use this to find the closing tag. + this._matchingTag = tag; + // We're explicitly a non-namespace aware parser, we just pretend it's all HTML. + var lastColonIndex = tag.lastIndexOf(":"); + if (lastColonIndex != -1) { + tag = tag.substring(lastColonIndex + 1); + } this.attributes = []; this.childNodes = []; this.children = []; @@ -785,7 +792,13 @@ break; } } - } + }, + + hasAttribute: function (name) { + return this.attributes.some(function (attr) { + return attr.name == name; + }); + }, }; var Style = function (node) { @@ -1062,9 +1075,10 @@ return null; // Read any text as Text node + var textNode; if (c !== "<") { --this.currentChar; - var textNode = new Text(); + textNode = new Text(); var n = this.html.indexOf("<", this.currentChar); if (n === -1) { textNode.innerHTML = this.html.substring(this.currentChar, this.html.length); @@ -1076,6 +1090,18 @@ return textNode; } + if (this.match("![CDATA[")) { + var endChar = this.html.indexOf("]]>", this.currentChar); + if (endChar === -1) { + this.error("unclosed CDATA section"); + return null; + } + textNode = new Text(); + textNode.textContent = this.html.substring(this.currentChar, endChar); + this.currentChar = endChar + ("]]>").length; + return textNode; + } + c = this.peekNext(); // Read Comment node. Normally, Comment nodes know their inner @@ -1107,7 +1133,7 @@ // If this isn't a void Element, read its child nodes if (!closed) { this.readChildren(node); - var closingTag = "</" + localName + ">"; + var closingTag = "</" + node._matchingTag + ">"; if (!this.match(closingTag)) { this.error("expected '" + closingTag + "' and got " + this.html.substr(this.currentChar, closingTag.length)); return null; diff --git a/toolkit/components/reader/Readability.js b/toolkit/components/reader/Readability.js index 064d2ae88..c2bba0cd3 100644 --- a/toolkit/components/reader/Readability.js +++ b/toolkit/components/reader/Readability.js @@ -29,14 +29,19 @@ /** * Public constructor. - * @param {Object} uri The URI descriptor object. * @param {HTMLDocument} doc The document to parse. * @param {Object} options The options object. */ -function Readability(uri, doc, options) { +function Readability(doc, options) { + // In some older versions, people passed a URI as the first argument. Cope: + if (options && options.documentElement) { + doc = options; + options = arguments[2]; + } else if (!doc || !doc.documentElement) { + throw new Error("First argument to Readability constructor should be a document object."); + } options = options || {}; - this._uri = uri; this._doc = doc; this._articleTitle = null; this._articleByline = null; @@ -47,7 +52,7 @@ function Readability(uri, doc, options) { this._debug = !!options.debug; this._maxElemsToParse = options.maxElemsToParse || this.DEFAULT_MAX_ELEMS_TO_PARSE; this._nbTopCandidates = options.nbTopCandidates || this.DEFAULT_N_TOP_CANDIDATES; - this._wordThreshold = options.wordThreshold || this.DEFAULT_WORD_THRESHOLD; + this._charThreshold = options.charThreshold || this.DEFAULT_CHAR_THRESHOLD; this._classesToPreserve = this.CLASSES_TO_PRESERVE.concat(options.classesToPreserve || []); // Start with all flags set @@ -93,6 +98,10 @@ Readability.prototype = { FLAG_WEIGHT_CLASSES: 0x2, FLAG_CLEAN_CONDITIONALLY: 0x4, + // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType + ELEMENT_NODE: 1, + TEXT_NODE: 3, + // Max number of nodes supported by this parser. Default: 0 (no limit) DEFAULT_MAX_ELEMS_TO_PARSE: 0, @@ -103,13 +112,13 @@ Readability.prototype = { // Element tags to score by default. DEFAULT_TAGS_TO_SCORE: "section,h2,h3,h4,h5,h6,p,td,pre".toUpperCase().split(","), - // The default number of words an article must have in order to return a result - DEFAULT_WORD_THRESHOLD: 500, + // The default number of chars an article must have in order to return a result + DEFAULT_CHAR_THRESHOLD: 500, // All of the regular expressions in use within readability. // Defined up here so we don't instantiate them repeatedly in loops. REGEXPS: { - unlikelyCandidates: /banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i, + unlikelyCandidates: /-ad-|banner|breadcrumbs|combx|comment|community|cover-wrap|disqus|extra|foot|header|legends|menu|related|remark|replies|rss|shoutbox|sidebar|skyscraper|social|sponsor|supplemental|ad-break|agegate|pagination|pager|popup|yom-remote/i, okMaybeItsACandidate: /and|article|body|column|main|shadow/i, positive: /article|body|content|entry|hentry|h-entry|main|page|pagination|post|text|blog|story/i, negative: /hidden|^hid$| hid$| hid |^hid |banner|combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|share|shoutbox|sidebar|skyscraper|sponsor|shopping|tags|tool|widget/i, @@ -132,8 +141,19 @@ Readability.prototype = { DEPRECATED_SIZE_ATTRIBUTE_ELEMS: [ "TABLE", "TH", "TD", "HR", "PRE" ], + // The commented out elements qualify as phrasing content but tend to be + // removed by readability when put into paragraphs, so we ignore them here. + PHRASING_ELEMS: [ + // "CANVAS", "IFRAME", "SVG", "VIDEO", + "ABBR", "AUDIO", "B", "BDO", "BR", "BUTTON", "CITE", "CODE", "DATA", + "DATALIST", "DFN", "EM", "EMBED", "I", "IMG", "INPUT", "KBD", "LABEL", + "MARK", "MATH", "METER", "NOSCRIPT", "OBJECT", "OUTPUT", "PROGRESS", "Q", + "RUBY", "SAMP", "SCRIPT", "SELECT", "SMALL", "SPAN", "STRONG", "SUB", + "SUP", "TEXTAREA", "TIME", "VAR", "WBR" + ], + // These are the classes that readability sets itself. - CLASSES_TO_PRESERVE: [ "readability-styled", "page" ], + CLASSES_TO_PRESERVE: [ "page" ], /** * Run any post-process modifications to article content as necessary. @@ -216,6 +236,21 @@ Readability.prototype = { }, /** + * Iterate over a NodeList, return true if all of the provided iterate + * function calls return true, false otherwise. + * + * For convenience, the current object context is applied to the + * provided iterate function. + * + * @param NodeList nodeList The NodeList. + * @param Function fn The iterate function. + * @return Boolean + */ + _everyNode: function(nodeList, fn) { + return Array.prototype.every.call(nodeList, fn, this); + }, + + /** * Concat all nodelists passed as arguments. * * @return ...NodeList @@ -327,7 +362,7 @@ Readability.prototype = { var origTitle = ""; try { - curTitle = origTitle = doc.title; + curTitle = origTitle = doc.title.trim(); // If they had an element with id "title" in their HTML if (typeof curTitle !== "string") @@ -355,8 +390,9 @@ Readability.prototype = { doc.getElementsByTagName('h1'), doc.getElementsByTagName('h2') ); + var trimmedTitle = curTitle.trim(); var match = this._someNode(headings, function(heading) { - return heading.textContent === curTitle; + return heading.textContent.trim() === trimmedTitle; }); // If we don't, let's extract the title out of the original title string. @@ -421,7 +457,7 @@ Readability.prototype = { _nextElement: function (node) { var next = node; while (next - && (next.nodeType != Node.ELEMENT_NODE) + && (next.nodeType != this.ELEMENT_NODE) && this.REGEXPS.whitespace.test(next.textContent)) { next = next.nextSibling; } @@ -464,16 +500,22 @@ Readability.prototype = { while (next) { // If we've hit another <br><br>, we're done adding children to this <p>. if (next.tagName == "BR") { - var nextElem = this._nextElement(next); + var nextElem = this._nextElement(next.nextSibling); if (nextElem && nextElem.tagName == "BR") break; } + if (!this._isPhrasingContent(next)) break; + // Otherwise, make this node a child of the new <p>. var sibling = next.nextSibling; p.appendChild(next); next = sibling; } + + while (p.lastChild && this._isWhitespace(p.lastChild)) p.removeChild(p.lastChild); + + if (p.parentNode.tagName === "P") this._setNodeTag(p.parentNode, "DIV"); } }); }, @@ -523,6 +565,7 @@ Readability.prototype = { this._clean(articleContent, "h1"); this._clean(articleContent, "footer"); this._clean(articleContent, "link"); + this._clean(articleContent, "aside"); // Clean out elements have "share" in their id/class combinations from final top candidates, // which means we don't remove the top candidates even they have "share". @@ -579,6 +622,19 @@ Readability.prototype = { if (next && next.tagName == "P") br.parentNode.removeChild(br); }); + + // Remove single-cell tables + this._forEachNode(this._getAllNodesWithTag(articleContent, ["table"]), function(table) { + var tbody = this._hasSingleTagInsideElement(table, "TBODY") ? table.firstElementChild : table; + if (this._hasSingleTagInsideElement(tbody, "TR")) { + var row = tbody.firstElementChild; + if (this._hasSingleTagInsideElement(row, "TD")) { + var cell = row.firstElementChild; + cell = this._setNodeTag(cell, this._everyNode(cell.childNodes, this._isPhrasingContent) ? "P" : "DIV"); + table.parentNode.replaceChild(cell, table); + } + } + }); }, /** @@ -658,37 +714,6 @@ Readability.prototype = { return node && node.nextElementSibling; }, - /** - * Like _getNextNode, but for DOM implementations with no - * firstElementChild/nextElementSibling functionality... - */ - _getNextNodeNoElementProperties: function(node, ignoreSelfAndKids) { - function nextSiblingEl(n) { - do { - n = n.nextSibling; - } while (n && n.nodeType !== n.ELEMENT_NODE); - return n; - } - // First check for kids if those aren't being ignored - if (!ignoreSelfAndKids && node.children[0]) { - return node.children[0]; - } - // Then for siblings... - var next = nextSiblingEl(node); - if (next) { - return next; - } - // And finally, move up the parent chain *and* find a sibling - // (because this is depth-first traversal, we will have already - // seen the parent nodes themselves). - do { - node = node.parentNode; - if (node) - next = nextSiblingEl(node); - } while (node && !next); - return node && next; - }, - _checkByline: function(node, matchString) { if (this._articleByline) { return false; @@ -751,6 +776,12 @@ Readability.prototype = { while (node) { var matchString = node.className + " " + node.id; + if (!this._isProbablyVisible(node)) { + this.log("Removing hidden node - " + matchString); + node = this._removeAndGetNext(node); + continue; + } + // Check to see if this node is a byline, and remove it if it is. if (this._checkByline(node, matchString)) { node = this._removeAndGetNext(node); @@ -784,11 +815,31 @@ Readability.prototype = { // Turn all divs that don't have children block level elements into p's if (node.tagName === "DIV") { + // Put phrasing content into paragraphs. + var p = null; + var childNode = node.firstChild; + while (childNode) { + var nextSibling = childNode.nextSibling; + if (this._isPhrasingContent(childNode)) { + if (p !== null) { + p.appendChild(childNode); + } else if (!this._isWhitespace(childNode)) { + p = doc.createElement('p'); + node.replaceChild(p, childNode); + p.appendChild(childNode); + } + } else if (p !== null) { + while (p.lastChild && this._isWhitespace(p.lastChild)) p.removeChild(p.lastChild); + p = null; + } + childNode = nextSibling; + } + // Sites like http://mobile.slate.com encloses each paragraph with a DIV // element. DIVs with only a P element inside and no text content can be // safely converted into plain P elements to avoid confusing the scoring // algorithm with DIVs with are, in practice, paragraphs. - if (this._hasSinglePInsideElement(node)) { + if (this._hasSingleTagInsideElement(node, "P") && this._getLinkDensity(node) < 0.25) { var newNode = node.children[0]; node.parentNode.replaceChild(newNode, node); node = newNode; @@ -796,17 +847,6 @@ Readability.prototype = { } else if (!this._hasChildBlockElement(node)) { node = this._setNodeTag(node, "P"); elementsToScore.push(node); - } else { - // EXPERIMENTAL - this._forEachNode(node.childNodes, function(childNode) { - if (childNode.nodeType === Node.TEXT_NODE && childNode.textContent.trim().length > 0) { - var p = doc.createElement('p'); - p.textContent = childNode.textContent; - p.style.display = 'inline'; - p.className = 'readability-styled'; - node.replaceChild(p, childNode); - } - }); } } node = this._getNextNode(node); @@ -846,7 +886,7 @@ Readability.prototype = { // Initialize and score ancestors. this._forEachNode(ancestors, function(ancestor, level) { - if (!ancestor.tagName) + if (!ancestor.tagName || !ancestor.parentNode || typeof(ancestor.parentNode.tagName) === 'undefined') return; if (typeof(ancestor.readability) === 'undefined') { @@ -1085,7 +1125,7 @@ Readability.prototype = { // finding the content, and the sieve approach gives us a higher likelihood of // finding the -right- content. var textLength = this._getInnerText(articleContent, true).length; - if (textLength < this._wordThreshold) { + if (textLength < this._charThreshold) { parseSuccessful = false; page.innerHTML = pageCacheHtml; @@ -1233,27 +1273,28 @@ Readability.prototype = { }, /** - * Check if this node has only whitespace and a single P element + * Check if this node has only whitespace and a single element with given tag * Returns false if the DIV node contains non-empty text nodes - * or if it contains no P or more than 1 element. + * or if it contains no element with given tag or more than 1 element. * * @param Element + * @param string tag of child element **/ - _hasSinglePInsideElement: function(element) { - // There should be exactly 1 element child which is a P: - if (element.children.length != 1 || element.children[0].tagName !== "P") { + _hasSingleTagInsideElement: function(element, tag) { + // There should be exactly 1 element child with given tag + if (element.children.length != 1 || element.children[0].tagName !== tag) { return false; } // And there should be no text nodes with real content return !this._someNode(element.childNodes, function(node) { - return node.nodeType === Node.TEXT_NODE && + return node.nodeType === this.TEXT_NODE && this.REGEXPS.hasContent.test(node.textContent); }); }, _isElementWithoutContent: function(node) { - return node.nodeType === Node.ELEMENT_NODE && + return node.nodeType === this.ELEMENT_NODE && node.textContent.trim().length == 0 && (node.children.length == 0 || node.children.length == node.getElementsByTagName("br").length + node.getElementsByTagName("hr").length); @@ -1271,6 +1312,21 @@ Readability.prototype = { }); }, + /*** + * Determine if a node qualifies as phrasing content. + * https://developer.mozilla.org/en-US/docs/Web/Guide/HTML/Content_categories#Phrasing_content + **/ + _isPhrasingContent: function(node) { + return node.nodeType === this.TEXT_NODE || this.PHRASING_ELEMS.indexOf(node.tagName) !== -1 || + ((node.tagName === "A" || node.tagName === "DEL" || node.tagName === "INS") && + this._everyNode(node.childNodes, this._isPhrasingContent)); + }, + + _isWhitespace: function(node) { + return (node.nodeType === this.TEXT_NODE && node.textContent.trim().length === 0) || + (node.nodeType === this.ELEMENT_NODE && node.tagName === "BR"); + }, + /** * Get the inner text of a node - cross browser compatibly. * This also strips out any excess whitespace to be found. @@ -1312,16 +1368,14 @@ Readability.prototype = { if (!e || e.tagName.toLowerCase() === 'svg') return; - if (e.className !== 'readability-styled') { - // Remove `style` and deprecated presentational attributes - for (var i = 0; i < this.PRESENTATIONAL_ATTRIBUTES.length; i++) { - e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[i]); - } + // Remove `style` and deprecated presentational attributes + for (var i = 0; i < this.PRESENTATIONAL_ATTRIBUTES.length; i++) { + e.removeAttribute(this.PRESENTATIONAL_ATTRIBUTES[i]); + } - if (this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName) !== -1) { - e.removeAttribute('width'); - e.removeAttribute('height'); - } + if (this.DEPRECATED_SIZE_ATTRIBUTE_ELEMS.indexOf(e.tagName) !== -1) { + e.removeAttribute('width'); + e.removeAttribute('height'); } var cur = e.firstElementChild; @@ -1639,6 +1693,10 @@ Readability.prototype = { this._flags = this._flags & ~flag; }, + _isProbablyVisible: function(node) { + return node.style.display != "none" && !node.hasAttribute("hidden"); + }, + /** * Decides whether or not the document is reader-able without parsing the whole thing. * @@ -1663,9 +1721,9 @@ Readability.prototype = { nodes = [].concat.apply(Array.from(set), nodes); } - // FIXME we should have a fallback for helperIsVisible, but this is - // problematic because of jsdom's elem.style handling - see - // https://github.com/mozilla/readability/pull/186 for context. + if (!helperIsVisible) { + helperIsVisible = this._isProbablyVisible; + } var score = 0; // This is a little cheeky, we use the accumulator 'score' to decide what to return from @@ -1719,9 +1777,6 @@ Readability.prototype = { } } - if (typeof this._doc.documentElement.firstElementChild === "undefined") { - this._getNextNode = this._getNextNodeNoElementProperties; - } // Remove script tags from the document. this._removeScripts(this._doc); @@ -1750,7 +1805,6 @@ Readability.prototype = { var textContent = articleContent.textContent; return { - uri: this._uri, title: this._articleTitle, byline: metadata.byline || this._articleByline, dir: this._articleDir, diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index e9eb83154..218e12d60 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -195,7 +195,7 @@ this.ReaderMode = { // We pass in a helper function to determine if a node is visible, because // it uses gecko APIs that the engine-agnostic readability code can't rely // upon. - return new Readability(uri, doc).isProbablyReaderable(this.isNodeVisible.bind(this, utils)); + return new Readability(doc).isProbablyReaderable(this.isNodeVisible.bind(this, utils)); }, isNodeVisible(utils, node) { diff --git a/toolkit/components/reader/ReaderWorker.js b/toolkit/components/reader/ReaderWorker.js index 69426788b..9cc684e9b 100644 --- a/toolkit/components/reader/ReaderWorker.js +++ b/toolkit/components/reader/ReaderWorker.js @@ -48,6 +48,6 @@ var Agent = { */ parseDocument(uri, serializedDoc, options) { let doc = new JSDOMParser().parse(serializedDoc, uri.spec); - return new Readability(uri, doc, options).parse(); + return new Readability(doc, options).parse(); }, }; diff --git a/toolkit/components/search/moz.build b/toolkit/components/search/moz.build index 4cc86ff9e..2accffd00 100644 --- a/toolkit/components/search/moz.build +++ b/toolkit/components/search/moz.build @@ -6,10 +6,10 @@ XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini'] -if CONFIG['MC_PALEMOON']: - DIRS += ['orginal'] -else: +if CONFIG['MC_BASILISK'] or CONFIG['HYPE_ICEWEASEL'] or CONFIG['HYPE_ICEDOVE']: DIRS += ['current'] +else: + DIRS += ['orginal'] with Files('**'): BUG_COMPONENT = ('Firefox', 'Search') diff --git a/toolkit/components/startup/moz.build b/toolkit/components/startup/moz.build index dbd580384..5f290b783 100644 --- a/toolkit/components/startup/moz.build +++ b/toolkit/components/startup/moz.build @@ -18,19 +18,14 @@ UNIFIED_SOURCES += [ 'StartupTimeline.cpp', ] -if CONFIG['OS_ARCH'] == 'WINNT': - # This file cannot be built in unified mode because of name clashes with Windows headers. - SOURCES += [ - 'nsUserInfoWin.cpp', - ] -elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': - UNIFIED_SOURCES += [ - 'nsUserInfoMac.mm', - ] -else: - UNIFIED_SOURCES += [ - 'nsUserInfoUnix.cpp', - ] +if CONFIG['MOZ_USERINFO']: + if CONFIG['OS_ARCH'] == 'WINNT': + # This file cannot be built in unified mode because of name clashes with Windows headers. + SOURCES += ['nsUserInfoWin.cpp'] + elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + UNIFIED_SOURCES += ['nsUserInfoMac.mm'] + else: + UNIFIED_SOURCES += ['nsUserInfoUnix.cpp'] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/startup/public/moz.build b/toolkit/components/startup/public/moz.build index 5894b6c51..948a7d7ee 100644 --- a/toolkit/components/startup/public/moz.build +++ b/toolkit/components/startup/public/moz.build @@ -4,10 +4,10 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -XPIDL_SOURCES += [ - 'nsIAppStartup.idl', - 'nsIUserInfo.idl', -] +XPIDL_SOURCES += ['nsIAppStartup.idl'] + +if CONFIG['MOZ_USERINFO']: + XPIDL_SOURCES += ['nsIUserInfo.idl'] XPIDL_MODULE = 'appstartup' diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 7132c07b0..f61a67efc 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -2560,78 +2560,6 @@ "kind": "boolean", "description": "Rate of page load from offline cache" }, - "HTTP_CACHE_IO_QUEUE_2_OPEN_PRIORITY": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_READ_PRIORITY": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_MANAGEMENT": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_OPEN": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_READ": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_WRITE": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_WRITE_PRIORITY": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_INDEX": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, - "HTTP_CACHE_IO_QUEUE_2_EVICT": { - "alert_emails": ["hbambas@mozilla.com"], - "bug_numbers": [1294183], - "expires_in_version": "55", - "kind": "enumerated", - "n_values": 10, - "description": "HTTP Cache IO queue length" - }, "CACHE_DEVICE_SEARCH_2": { "expires_in_version": "never", "kind": "exponential", @@ -8426,31 +8354,6 @@ "n_values": 7, "description": "Final status of the CacheFileInputStream (0=ok, 1=other error, 2=out of memory, 3=disk full, 4=file corrupted, 5=file not found, 6=binding aborted)" }, - "NETWORK_CACHE_FS_TYPE": { - "expires_in_version": "42", - "kind": "enumerated", - "n_values": 5, - "description": "Type of FS that the cache is stored on (0=NTFS (Win), 1=FAT32 (Win), 2=FAT (Win), 3=other FS (Win), 4=other OS)" - }, - "NETWORK_CACHE_SIZE_FULL_FAT": { - "expires_in_version": "42", - "kind": "linear", - "high": 500, - "n_buckets": 50, - "description": "Size (in MB) of a cache that reached a file count limit" - }, - "NETWORK_CACHE_HIT_MISS_STAT_PER_CACHE_SIZE": { - "expires_in_version": "never", - "kind": "enumerated", - "n_values": 40, - "description": "Hit/Miss count split by cache size in file count (0=Hit 0-5000, 1=Miss 0-5000, 2=Hit 5001-10000, ...)" - }, - "NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE": { - "expires_in_version": "never", - "kind": "enumerated", - "n_values": 400, - "description": "Hit rate for a specific cache size in file count. The hit rate is split into 20 buckets, the lower limit of the range in percents is 5*n/20. The cache size is divided into 20 ranges of length 5000, the lower limit of the range is 5000*(n%20)" - }, "NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS": { "expires_in_version": "never", "kind": "exponential", @@ -8479,12 +8382,6 @@ "n_buckets": 256, "description": "Actual size of the metadata parsed from the disk." }, - "NETWORK_CACHE_HASH_STATS": { - "expires_in_version": "46", - "kind": "enumerated", - "n_values": 160, - "description": "The longest hash match between a newly added entry and all the existing entries." - }, "DATABASE_LOCKED_EXCEPTION": { "expires_in_version": "42", "kind": "enumerated", diff --git a/toolkit/components/telemetry/histogram-whitelists.json b/toolkit/components/telemetry/histogram-whitelists.json index deb1bd5b3..529d9f4d5 100644 --- a/toolkit/components/telemetry/histogram-whitelists.json +++ b/toolkit/components/telemetry/histogram-whitelists.json @@ -429,15 +429,10 @@ "MOZ_SQLITE_WEBAPPS_WRITE_B", "MOZ_SQLITE_WEBAPPS_WRITE_MAIN_THREAD_MS", "MOZ_SQLITE_WEBAPPS_WRITE_MS", - "NETWORK_CACHE_FS_TYPE", - "NETWORK_CACHE_HASH_STATS", - "NETWORK_CACHE_HIT_MISS_STAT_PER_CACHE_SIZE", - "NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE", "NETWORK_CACHE_METADATA_FIRST_READ_SIZE", "NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS", "NETWORK_CACHE_METADATA_SECOND_READ_TIME_MS", "NETWORK_CACHE_METADATA_SIZE", - "NETWORK_CACHE_SIZE_FULL_FAT", "NETWORK_CACHE_V1_HIT_TIME_MS", "NETWORK_CACHE_V1_MISS_TIME_MS", "NETWORK_CACHE_V1_TRUNCATE_TIME_MS", @@ -1276,15 +1271,10 @@ "MOZ_SQLITE_WEBAPPS_WRITE_MS", "MOZ_STORAGE_ASYNC_REQUESTS_MS", "MOZ_STORAGE_ASYNC_REQUESTS_SUCCESS", - "NETWORK_CACHE_FS_TYPE", - "NETWORK_CACHE_HASH_STATS", - "NETWORK_CACHE_HIT_MISS_STAT_PER_CACHE_SIZE", - "NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE", "NETWORK_CACHE_METADATA_FIRST_READ_SIZE", "NETWORK_CACHE_METADATA_FIRST_READ_TIME_MS", "NETWORK_CACHE_METADATA_SECOND_READ_TIME_MS", "NETWORK_CACHE_METADATA_SIZE", - "NETWORK_CACHE_SIZE_FULL_FAT", "NETWORK_CACHE_V1_HIT_TIME_MS", "NETWORK_CACHE_V1_MISS_TIME_MS", "NETWORK_CACHE_V1_TRUNCATE_TIME_MS", @@ -1862,10 +1852,8 @@ "DEVTOOLS_READ_HEAP_SNAPSHOT_MS", "DEVTOOLS_HEAP_SNAPSHOT_NODE_COUNT", "DEVTOOLS_HEAP_SNAPSHOT_EDGE_COUNT", - "NETWORK_CACHE_HIT_RATE_PER_CACHE_SIZE", "NETWORK_CACHE_METADATA_FIRST_READ_SIZE", "NETWORK_CACHE_METADATA_SIZE", - "NETWORK_CACHE_HASH_STATS", "SSL_CIPHER_SUITE_FULL", "SSL_CIPHER_SUITE_RESUMED", "SSL_HANDSHAKE_RESULT", diff --git a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm index 7b86fa07c..3eec9827d 100644 --- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm +++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm @@ -206,9 +206,13 @@ const BackgroundPageThumbs = { let browser = this._parentWin.document.createElementNS(XUL_NS, "browser"); browser.setAttribute("type", "content"); - browser.setAttribute("remote", "true"); browser.setAttribute("disableglobalhistory", "true"); + if (Services.prefs.getPrefType("browser.tabs.remote") == Services.prefs.PREF_BOOL && + Services.prefs.getBoolPref("browser.tabs.remote")) { + browser.setAttribute("remote", "true"); + } + if (Services.prefs.getBoolPref(ABOUT_NEWTAB_SEGREGATION_PREF)) { // Use the private container for thumbnails. let privateIdentity = diff --git a/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js b/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js index 8272b2e06..a8fe51418 100644 --- a/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js +++ b/toolkit/components/thumbnails/test/test_thumbnails_interfaces.js @@ -22,10 +22,4 @@ function run_test() { null, null); ok(uri instanceof Ci.nsIFileURL, "moz-page-thumb:// is a FileURL"); ok(uri.file, "This moz-page-thumb:// object is backed by a file"); - - // and check that the error case works as specified - let bad = Services.io.newURI("moz-page-thumb://wronghost/?url=http%3A%2F%2Fwww.mozilla.org%2F", - null, null); - Assert.throws(() => handler.resolveURI(bad), /NS_ERROR_NOT_AVAILABLE/i, - "moz-page-thumb object with wrong host must not resolve to a file path"); } |