diff options
Diffstat (limited to 'toolkit')
-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/thumbnails/test/test_thumbnails_interfaces.js | 6 | ||||
-rw-r--r-- | toolkit/content/widgets/browser.xml | 9 | ||||
-rw-r--r-- | toolkit/moz.configure | 14 | ||||
-rw-r--r-- | toolkit/mozapps/extensions/AddonManager.jsm | 223 | ||||
-rw-r--r-- | toolkit/mozapps/extensions/LightweightThemeManager.jsm | 30 | ||||
-rw-r--r-- | toolkit/mozapps/extensions/addonManager.js | 30 | ||||
-rw-r--r-- | toolkit/mozapps/extensions/amInstallTrigger.js | 2 | ||||
-rw-r--r-- | toolkit/mozapps/extensions/amWebInstallListener.js | 28 | ||||
-rw-r--r-- | toolkit/themes/osx/global/notification.css | 4 |
14 files changed, 336 insertions, 261 deletions
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/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"); } diff --git a/toolkit/content/widgets/browser.xml b/toolkit/content/widgets/browser.xml index e595c847d..a30ff1c43 100644 --- a/toolkit/content/widgets/browser.xml +++ b/toolkit/content/widgets/browser.xml @@ -389,10 +389,11 @@ <method name="getTabBrowser"> <body> <![CDATA[ - var tabBrowser = this.parentNode; - while (tabBrowser && tabBrowser.localName != "tabbrowser") - tabBrowser = tabBrowser.parentNode; - return tabBrowser; + for (let node = this.parentNode; node instanceof Element; node = node.parentNode) { + if (node.localName == "tabbrowser") + return node; + } + return null; ]]> </body> </method> diff --git a/toolkit/moz.configure b/toolkit/moz.configure index 7d3065f53..792fb113d 100644 --- a/toolkit/moz.configure +++ b/toolkit/moz.configure @@ -358,6 +358,20 @@ set_config('MOZ_FMP4', fmp4) set_define('MOZ_FMP4', fmp4) add_old_configure_assignment('MOZ_FMP4', fmp4) +# Libaom AV1 Video Codec Support +# ============================================================== +option('--enable-av1', + help='Enable libaom for av1 video support') + +@depends('--enable-av1') +def av1(value): + enabled = bool(value) + if enabled: + return True + +set_config('MOZ_AV1', av1) +set_define('MOZ_AV1', av1) + # Miscellaneous # ============================================================== option(name='--enable-chrome-format', diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm index d453a8981..4cd2c3d0a 100644 --- a/toolkit/mozapps/extensions/AddonManager.jsm +++ b/toolkit/mozapps/extensions/AddonManager.jsm @@ -123,13 +123,13 @@ function providerName(aProvider) { * parent 'addons' level logger accordingly. */ var PrefObserver = { - init: function PrefObserver_init() { + init: function() { Services.prefs.addObserver(PREF_LOGGING_ENABLED, this, false); Services.obs.addObserver(this, "xpcom-shutdown", false); this.observe(null, NS_PREFBRANCH_PREFCHANGE_TOPIC_ID, PREF_LOGGING_ENABLED); }, - observe: function PrefObserver_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "xpcom-shutdown") { Services.prefs.removeObserver(PREF_LOGGING_ENABLED, this); Services.obs.removeObserver(this, "xpcom-shutdown"); @@ -323,7 +323,7 @@ AsyncObjectCaller.prototype = { * Passes the next object to the listener or calls noMoreObjects if there * are none left. */ - callNext: function AOC_callNext() { + callNext: function() { if (this.objects.length == 0) { this.listener.noMoreObjects(this); return; @@ -449,7 +449,7 @@ AddonAuthor.prototype = { url: null, // Returns the author's name, defaulting to the empty string - toString: function AddonAuthor_toString() { + toString: function() { return this.name || ""; } } @@ -493,7 +493,7 @@ AddonScreenshot.prototype = { caption: null, // Returns the screenshot URL, defaulting to the empty string - toString: function AddonScreenshot_toString() { + toString: function() { return this.url || ""; } } @@ -640,11 +640,11 @@ var AddonManagerInternal = { // Store telemetry details per addon provider telemetryDetails: {}, - recordTimestamp: function AMI_recordTimestamp(name, value) { + recordTimestamp: function(name, value) { this.TelemetryTimestamps.add(name, value); }, - validateBlocklist: function AMI_validateBlocklist() { + validateBlocklist: function() { let appBlocklist = FileUtils.getFile(KEY_APPDIR, [FILE_BLOCKLIST]); // If there is no application shipped blocklist then there is nothing to do @@ -771,7 +771,7 @@ var AddonManagerInternal = { * Initializes the AddonManager, loading any known providers and initializing * them. */ - startup: function AMI_startup() { + startup: function() { try { if (gStarted) return; @@ -925,7 +925,7 @@ var AddonManagerInternal = { * @param aTypes * An optional array of add-on types */ - registerProvider: function AMI_registerProvider(aProvider, aTypes) { + registerProvider: function(aProvider, aTypes) { if (!aProvider || typeof aProvider != "object") throw Components.Exception("aProvider must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -977,7 +977,7 @@ var AddonManagerInternal = { * For providers that have async shutdown methods returning Promises, * the caller should wait for that Promise to resolve. */ - unregisterProvider: function AMI_unregisterProvider(aProvider) { + unregisterProvider: function(aProvider) { if (!aProvider || typeof aProvider != "object") throw Components.Exception("aProvider must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -1032,7 +1032,7 @@ var AddonManagerInternal = { * * @param aProvider Provider object to mark safe */ - markProviderSafe: function AMI_markProviderSafe(aProvider) { + markProviderSafe: function(aProvider) { if (!gStarted) { throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1062,7 +1062,7 @@ var AddonManagerInternal = { * The method name to call * @see callProvider */ - callProviders: function AMI_callProviders(aMethod, ...aArgs) { + callProviders: function(aMethod, ...aArgs) { if (!aMethod || typeof aMethod != "string") throw Components.Exception("aMethod must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1163,7 +1163,7 @@ var AddonManagerInternal = { * * @see nsIObserver */ - observe: function AMI_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { switch (aData) { case PREF_EM_CHECK_COMPATIBILITY: { let oldValue = gCheckCompatibility; @@ -1247,7 +1247,7 @@ var AddonManagerInternal = { * The optional application version to use for %APP_VERSION% * @return The appropriately escaped URI. */ - escapeAddonURI: function AMI_escapeAddonURI(aAddon, aUri, aAppVersion) + escapeAddonURI: function(aAddon, aUri, aAppVersion) { if (!aAddon || typeof aAddon != "object") throw Components.Exception("aAddon must be an Addon object", @@ -1318,7 +1318,7 @@ var AddonManagerInternal = { * @return Promise{null} Resolves when the background update check is complete * (the resulting addon installations may still be in progress). */ - backgroundUpdateCheck: function AMI_backgroundUpdateCheck() { + backgroundUpdateCheck: function() { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1347,7 +1347,7 @@ var AddonManagerInternal = { // be applied updates.push(new Promise((resolve, reject) => { addon.findUpdates({ - onUpdateAvailable: function BUC_onUpdateAvailable(aAddon, aInstall) { + onUpdateAvailable: function(aAddon, aInstall) { // Start installing updates when the add-on can be updated and // background updates should be applied. logger.debug("Found update for add-on ${id}", aAddon); @@ -1389,7 +1389,7 @@ var AddonManagerInternal = { * @param aID * The ID of the add-on */ - addStartupChange: function AMI_addStartupChange(aType, aID) { + addStartupChange: function(aType, aID) { if (!aType || typeof aType != "string") throw Components.Exception("aType must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1418,7 +1418,7 @@ var AddonManagerInternal = { * @param aID * The ID of the add-on */ - removeStartupChange: function AMI_removeStartupChange(aType, aID) { + removeStartupChange: function(aType, aID) { if (!aType || typeof aType != "string") throw Components.Exception("aType must be a non-empty string", Cr.NS_ERROR_INVALID_ARG); @@ -1444,7 +1444,7 @@ var AddonManagerInternal = { * @param aMethod * The method on the listeners to call */ - callManagerListeners: function AMI_callManagerListeners(aMethod, ...aArgs) { + callManagerListeners: function(aMethod, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1475,7 +1475,7 @@ var AddonManagerInternal = { * An optional array of extra InstallListeners to also call * @return false if any of the listeners returned false, true otherwise */ - callInstallListeners: function AMI_callInstallListeners(aMethod, + callInstallListeners: function(aMethod, aExtraListeners, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", @@ -1517,7 +1517,7 @@ var AddonManagerInternal = { * @param aMethod * The method on the listeners to call */ - callAddonListeners: function AMI_callAddonListeners(aMethod, ...aArgs) { + callAddonListeners: function(aMethod, ...aArgs) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1551,7 +1551,7 @@ var AddonManagerInternal = { * A boolean indicating if the change will only take place the next * time the application is restarted */ - notifyAddonChanged: function AMI_notifyAddonChanged(aID, aType, aPendingRestart) { + notifyAddonChanged: function(aID, aType, aPendingRestart) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1588,7 +1588,7 @@ var AddonManagerInternal = { * their add-ons in response to an application change such as a blocklist * update. */ - updateAddonAppDisabledStates: function AMI_updateAddonAppDisabledStates() { + updateAddonAppDisabledStates: function() { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1603,7 +1603,7 @@ var AddonManagerInternal = { * @param aCallback * Function to call when operation is complete. */ - updateAddonRepositoryData: function AMI_updateAddonRepositoryData(aCallback) { + updateAddonRepositoryData: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1613,11 +1613,11 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "updateAddonRepositoryData", { - nextObject: function updateAddonRepositoryData_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "updateAddonRepositoryData", aCaller.callNext.bind(aCaller)); }, - noMoreObjects: function updateAddonRepositoryData_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback); // only tests should care about this Services.obs.notifyObservers(null, "TEST:addon-repository-data-updated", null); @@ -1646,7 +1646,7 @@ var AddonManagerInternal = { * An optional nsILoadGroup to associate any network requests with * @throws if the aUrl, aCallback or aMimetype arguments are not specified */ - getInstallForURL: function AMI_getInstallForURL(aUrl, aCallback, aMimetype, + getInstallForURL: function(aUrl, aCallback, aMimetype, aHash, aName, aIcons, aVersion, aBrowser) { if (!gStarted) @@ -1716,7 +1716,7 @@ var AddonManagerInternal = { * An optional mimetype hint for the add-on * @throws if the aFile or aCallback arguments are not specified */ - getInstallForFile: function AMI_getInstallForFile(aFile, aCallback, aMimetype) { + getInstallForFile: function(aFile, aCallback, aMimetype) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1734,7 +1734,7 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "getInstallForFile", { - nextObject: function getInstallForFile_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getInstallForFile", aFile, function getInstallForFile_safeCall(aInstall) { if (aInstall) @@ -1744,7 +1744,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getInstallForFile_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, null); } }); @@ -1760,7 +1760,7 @@ var AddonManagerInternal = { * A callback which will be passed an array of AddonInstalls * @throws If the aCallback argument is not specified */ - getInstallsByTypes: function AMI_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1776,7 +1776,7 @@ var AddonManagerInternal = { let installs = []; new AsyncObjectCaller(this.providers, "getInstallsByTypes", { - nextObject: function getInstallsByTypes_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getInstallsByTypes", aTypes, function getInstallsByTypes_safeCall(aProviderInstalls) { if (aProviderInstalls) { @@ -1786,7 +1786,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getInstallsByTypes_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, installs); } }); @@ -1798,7 +1798,7 @@ var AddonManagerInternal = { * @param aCallback * A callback which will be passed an array of AddonInstalls */ - getAllInstalls: function AMI_getAllInstalls(aCallback) { + getAllInstalls: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1818,7 +1818,7 @@ var AddonManagerInternal = { * @return string containing the Addon ID or null * @see amIAddonManager.mapURIToAddonID */ - mapURIToAddonID: function AMI_mapURIToAddonID(aURI) { + mapURIToAddonID: function(aURI) { if (!(aURI instanceof Ci.nsIURI)) { throw Components.Exception("aURI is not a nsIURI", Cr.NS_ERROR_INVALID_ARG); @@ -1843,7 +1843,7 @@ var AddonManagerInternal = { * The mimetype to check * @return true if installation is enabled for the mimetype */ - isInstallEnabled: function AMI_isInstallEnabled(aMimetype) { + isInstallEnabled: function(aMimetype) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1871,7 +1871,7 @@ var AddonManagerInternal = { * The nsIPrincipal that initiated the install * @return true if the source is allowed to install this mimetype */ - isInstallAllowed: function AMI_isInstallAllowed(aMimetype, aInstallingPrincipal) { + isInstallAllowed: function(aMimetype, aInstallingPrincipal) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -1906,10 +1906,7 @@ var AddonManagerInternal = { * @param aInstalls * The array of AddonInstalls to be installed */ - installAddonsFromWebpage: function AMI_installAddonsFromWebpage(aMimetype, - aBrowser, - aInstallingPrincipal, - aInstalls) { + installAddonsFromWebpage: function(aMimetype, aBrowser, aInstallingPrincipal, aInstalls) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2011,7 +2008,7 @@ var AddonManagerInternal = { * @param aListener * The InstallListener to add */ - addInstallListener: function AMI_addInstallListener(aListener) { + addInstallListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a InstallListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2027,7 +2024,7 @@ var AddonManagerInternal = { * @param aListener * The InstallListener to remove */ - removeInstallListener: function AMI_removeInstallListener(aListener) { + removeInstallListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a InstallListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2050,7 +2047,7 @@ var AddonManagerInternal = { * The callback to pass the retrieved add-on to * @throws if the aID or aCallback arguments are not specified */ - getAddonByID: function AMI_getAddonByID(aID, aCallback) { + getAddonByID: function(aID, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2064,7 +2061,7 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "getAddonByID", { - nextObject: function getAddonByID_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonByID", aID, function getAddonByID_safeCall(aAddon) { if (aAddon) @@ -2074,7 +2071,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonByID_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, null); } }); @@ -2089,7 +2086,7 @@ var AddonManagerInternal = { * The callback to pass the retrieved add-on to. * @throws if the aGUID or aCallback arguments are not specified */ - getAddonBySyncGUID: function AMI_getAddonBySyncGUID(aGUID, aCallback) { + getAddonBySyncGUID: function(aGUID, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2103,7 +2100,7 @@ var AddonManagerInternal = { Cr.NS_ERROR_INVALID_ARG); new AsyncObjectCaller(this.providers, "getAddonBySyncGUID", { - nextObject: function getAddonBySyncGUID_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonBySyncGUID", aGUID, function getAddonBySyncGUID_safeCall(aAddon) { if (aAddon) { @@ -2114,7 +2111,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonBySyncGUID_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, null); } }); @@ -2129,7 +2126,7 @@ var AddonManagerInternal = { * The callback to pass an array of Addons to * @throws if the aID or aCallback arguments are not specified */ - getAddonsByIDs: function AMI_getAddonsByIDs(aIDs, aCallback) { + getAddonsByIDs: function(aIDs, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2145,7 +2142,7 @@ var AddonManagerInternal = { let addons = []; new AsyncObjectCaller(aIDs, null, { - nextObject: function getAddonsByIDs_nextObject(aCaller, aID) { + nextObject: function(aCaller, aID) { AddonManagerInternal.getAddonByID(aID, function getAddonsByIDs_getAddonByID(aAddon) { addons.push(aAddon); @@ -2153,7 +2150,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonsByIDs_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, addons); } }); @@ -2168,7 +2165,7 @@ var AddonManagerInternal = { * The callback to pass an array of Addons to. * @throws if the aCallback argument is not specified */ - getAddonsByTypes: function AMI_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2184,7 +2181,7 @@ var AddonManagerInternal = { let addons = []; new AsyncObjectCaller(this.providers, "getAddonsByTypes", { - nextObject: function getAddonsByTypes_nextObject(aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonsByTypes", aTypes, function getAddonsByTypes_concatAddons(aProviderAddons) { if (aProviderAddons) { @@ -2194,7 +2191,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonsByTypes_noMoreObjects(aCaller) { + noMoreObjects: function(aCaller) { safeCall(aCallback, addons); } }); @@ -2206,7 +2203,7 @@ var AddonManagerInternal = { * @param aCallback * A callback which will be passed an array of Addons */ - getAllAddons: function AMI_getAllAddons(aCallback) { + getAllAddons: function(aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2228,8 +2225,7 @@ var AddonManagerInternal = { * The callback to pass the array of Addons to * @throws if the aCallback argument is not specified */ - getAddonsWithOperationsByTypes: - function AMI_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { if (!gStarted) throw Components.Exception("AddonManager is not initialized", Cr.NS_ERROR_NOT_INITIALIZED); @@ -2245,8 +2241,7 @@ var AddonManagerInternal = { let addons = []; new AsyncObjectCaller(this.providers, "getAddonsWithOperationsByTypes", { - nextObject: function getAddonsWithOperationsByTypes_nextObject - (aCaller, aProvider) { + nextObject: function(aCaller, aProvider) { callProviderAsync(aProvider, "getAddonsWithOperationsByTypes", aTypes, function getAddonsWithOperationsByTypes_concatAddons (aProviderAddons) { @@ -2257,7 +2252,7 @@ var AddonManagerInternal = { }); }, - noMoreObjects: function getAddonsWithOperationsByTypes_noMoreObjects(caller) { + noMoreObjects: function(caller) { safeCall(aCallback, addons); } }); @@ -2269,7 +2264,7 @@ var AddonManagerInternal = { * @param aListener * The listener to add */ - addManagerListener: function AMI_addManagerListener(aListener) { + addManagerListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonManagerListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2285,7 +2280,7 @@ var AddonManagerInternal = { * @param aListener * The listener to remove */ - removeManagerListener: function AMI_removeManagerListener(aListener) { + removeManagerListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonManagerListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2305,7 +2300,7 @@ var AddonManagerInternal = { * @param aListener * The AddonListener to add */ - addAddonListener: function AMI_addAddonListener(aListener) { + addAddonListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2321,7 +2316,7 @@ var AddonManagerInternal = { * @param aListener * The AddonListener to remove */ - removeAddonListener: function AMI_removeAddonListener(aListener) { + removeAddonListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be an AddonListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2341,7 +2336,7 @@ var AddonManagerInternal = { * @param aListener * The TypeListener to add */ - addTypeListener: function AMI_addTypeListener(aListener) { + addTypeListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a TypeListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2357,7 +2352,7 @@ var AddonManagerInternal = { * @param aListener * The TypeListener to remove */ - removeTypeListener: function AMI_removeTypeListener(aListener) { + removeTypeListener: function(aListener) { if (!aListener || typeof aListener != "object") throw Components.Exception("aListener must be a TypeListener object", Cr.NS_ERROR_INVALID_ARG); @@ -2496,23 +2491,23 @@ var AddonManagerInternal = { * subject to change at any time. */ this.AddonManagerPrivate = { - startup: function AMP_startup() { + startup: function() { AddonManagerInternal.startup(); }, - registerProvider: function AMP_registerProvider(aProvider, aTypes) { + registerProvider: function(aProvider, aTypes) { AddonManagerInternal.registerProvider(aProvider, aTypes); }, - unregisterProvider: function AMP_unregisterProvider(aProvider) { + unregisterProvider: function(aProvider) { AddonManagerInternal.unregisterProvider(aProvider); }, - markProviderSafe: function AMP_markProviderSafe(aProvider) { + markProviderSafe: function(aProvider) { AddonManagerInternal.markProviderSafe(aProvider); }, - backgroundUpdateCheck: function AMP_backgroundUpdateCheck() { + backgroundUpdateCheck: function() { return AddonManagerInternal.backgroundUpdateCheck(); }, @@ -2526,32 +2521,32 @@ this.AddonManagerPrivate = { AddonManagerInternal.backgroundUpdateCheck(); }, - addStartupChange: function AMP_addStartupChange(aType, aID) { + addStartupChange: function(aType, aID) { AddonManagerInternal.addStartupChange(aType, aID); }, - removeStartupChange: function AMP_removeStartupChange(aType, aID) { + removeStartupChange: function(aType, aID) { AddonManagerInternal.removeStartupChange(aType, aID); }, - notifyAddonChanged: function AMP_notifyAddonChanged(aID, aType, aPendingRestart) { + notifyAddonChanged: function(aID, aType, aPendingRestart) { AddonManagerInternal.notifyAddonChanged(aID, aType, aPendingRestart); }, - updateAddonAppDisabledStates: function AMP_updateAddonAppDisabledStates() { + updateAddonAppDisabledStates: function() { AddonManagerInternal.updateAddonAppDisabledStates(); }, - updateAddonRepositoryData: function AMP_updateAddonRepositoryData(aCallback) { + updateAddonRepositoryData: function(aCallback) { AddonManagerInternal.updateAddonRepositoryData(aCallback); }, - callInstallListeners: function AMP_callInstallListeners(...aArgs) { + callInstallListeners: function(...aArgs) { return AddonManagerInternal.callInstallListeners.apply(AddonManagerInternal, aArgs); }, - callAddonListeners: function AMP_callAddonListeners(...aArgs) { + callAddonListeners: function(...aArgs) { AddonManagerInternal.callAddonListeners.apply(AddonManagerInternal, aArgs); }, @@ -2563,16 +2558,16 @@ this.AddonManagerPrivate = { AddonType: AddonType, - recordTimestamp: function AMP_recordTimestamp(name, value) { + recordTimestamp: function(name, value) { AddonManagerInternal.recordTimestamp(name, value); }, _simpleMeasures: {}, - recordSimpleMeasure: function AMP_recordSimpleMeasure(name, value) { + recordSimpleMeasure: function(name, value) { this._simpleMeasures[name] = value; }, - recordException: function AMP_recordException(aModule, aContext, aException) { + recordException: function(aModule, aContext, aException) { let report = { module: aModule, context: aContext @@ -2592,15 +2587,15 @@ this.AddonManagerPrivate = { this._simpleMeasures.exception = report; }, - getSimpleMeasures: function AMP_getSimpleMeasures() { + getSimpleMeasures: function() { return this._simpleMeasures; }, - getTelemetryDetails: function AMP_getTelemetryDetails() { + getTelemetryDetails: function() { return AddonManagerInternal.telemetryDetails; }, - setTelemetryDetails: function AMP_setTelemetryDetails(aProvider, aDetails) { + setTelemetryDetails: function(aProvider, aDetails) { AddonManagerInternal.telemetryDetails[aProvider] = aDetails; }, @@ -2619,7 +2614,7 @@ this.AddonManagerPrivate = { * This can be used as an implementation for Addon.findUpdates() when * no update mechanism is available. */ - callNoUpdateListeners: function (addon, listener, reason, appVersion, platformVersion) { + callNoUpdateListeners: function(addon, listener, reason, appVersion, platformVersion) { if ("onNoCompatibilityUpdateAvailable" in listener) { safeCall(listener.onNoCompatibilityUpdateAvailable.bind(listener), addon); } @@ -2830,14 +2825,13 @@ this.AddonManager = { return gStartupComplete && !gShutdownInProgress; }, - getInstallForURL: function AM_getInstallForURL(aUrl, aCallback, aMimetype, - aHash, aName, aIcons, - aVersion, aBrowser) { + getInstallForURL: function(aUrl, aCallback, aMimetype, aHash, aName, aIcons, + aVersion, aBrowser) { AddonManagerInternal.getInstallForURL(aUrl, aCallback, aMimetype, aHash, aName, aIcons, aVersion, aBrowser); }, - getInstallForFile: function AM_getInstallForFile(aFile, aCallback, aMimetype) { + getInstallForFile: function(aFile, aCallback, aMimetype) { AddonManagerInternal.getInstallForFile(aFile, aCallback, aMimetype); }, @@ -2848,94 +2842,91 @@ this.AddonManager = { * The type of startup change to get * @return An array of add-on IDs */ - getStartupChanges: function AM_getStartupChanges(aType) { + getStartupChanges: function(aType) { if (!(aType in AddonManagerInternal.startupChanges)) return []; return AddonManagerInternal.startupChanges[aType].slice(0); }, - getAddonByID: function AM_getAddonByID(aID, aCallback) { + getAddonByID: function(aID, aCallback) { AddonManagerInternal.getAddonByID(aID, aCallback); }, - getAddonBySyncGUID: function AM_getAddonBySyncGUID(aGUID, aCallback) { + getAddonBySyncGUID: function(aGUID, aCallback) { AddonManagerInternal.getAddonBySyncGUID(aGUID, aCallback); }, - getAddonsByIDs: function AM_getAddonsByIDs(aIDs, aCallback) { + getAddonsByIDs: function(aIDs, aCallback) { AddonManagerInternal.getAddonsByIDs(aIDs, aCallback); }, - getAddonsWithOperationsByTypes: - function AM_getAddonsWithOperationsByTypes(aTypes, aCallback) { + getAddonsWithOperationsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getAddonsWithOperationsByTypes(aTypes, aCallback); }, - getAddonsByTypes: function AM_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getAddonsByTypes(aTypes, aCallback); }, - getAllAddons: function AM_getAllAddons(aCallback) { + getAllAddons: function(aCallback) { AddonManagerInternal.getAllAddons(aCallback); }, - getInstallsByTypes: function AM_getInstallsByTypes(aTypes, aCallback) { + getInstallsByTypes: function(aTypes, aCallback) { AddonManagerInternal.getInstallsByTypes(aTypes, aCallback); }, - getAllInstalls: function AM_getAllInstalls(aCallback) { + getAllInstalls: function(aCallback) { AddonManagerInternal.getAllInstalls(aCallback); }, - mapURIToAddonID: function AM_mapURIToAddonID(aURI) { + mapURIToAddonID: function(aURI) { return AddonManagerInternal.mapURIToAddonID(aURI); }, - isInstallEnabled: function AM_isInstallEnabled(aType) { + isInstallEnabled: function(aType) { return AddonManagerInternal.isInstallEnabled(aType); }, - isInstallAllowed: function AM_isInstallAllowed(aType, aInstallingPrincipal) { + isInstallAllowed: function(aType, aInstallingPrincipal) { return AddonManagerInternal.isInstallAllowed(aType, ensurePrincipal(aInstallingPrincipal)); }, - installAddonsFromWebpage: function AM_installAddonsFromWebpage(aType, aBrowser, - aInstallingPrincipal, - aInstalls) { + installAddonsFromWebpage: function(aType, aBrowser, aInstallingPrincipal, aInstalls) { AddonManagerInternal.installAddonsFromWebpage(aType, aBrowser, ensurePrincipal(aInstallingPrincipal), aInstalls); }, - addManagerListener: function AM_addManagerListener(aListener) { + addManagerListener: function(aListener) { AddonManagerInternal.addManagerListener(aListener); }, - removeManagerListener: function AM_removeManagerListener(aListener) { + removeManagerListener: function(aListener) { AddonManagerInternal.removeManagerListener(aListener); }, - addInstallListener: function AM_addInstallListener(aListener) { + addInstallListener: function(aListener) { AddonManagerInternal.addInstallListener(aListener); }, - removeInstallListener: function AM_removeInstallListener(aListener) { + removeInstallListener: function(aListener) { AddonManagerInternal.removeInstallListener(aListener); }, - addAddonListener: function AM_addAddonListener(aListener) { + addAddonListener: function(aListener) { AddonManagerInternal.addAddonListener(aListener); }, - removeAddonListener: function AM_removeAddonListener(aListener) { + removeAddonListener: function(aListener) { AddonManagerInternal.removeAddonListener(aListener); }, - addTypeListener: function AM_addTypeListener(aListener) { + addTypeListener: function(aListener) { AddonManagerInternal.addTypeListener(aListener); }, - removeTypeListener: function AM_removeTypeListener(aListener) { + removeTypeListener: function(aListener) { AddonManagerInternal.removeTypeListener(aListener); }, @@ -2950,7 +2941,7 @@ this.AddonManager = { * The Addon representing the add-on * @return true if the addon should auto-update, false otherwise. */ - shouldAutoUpdate: function AM_shouldAutoUpdate(aAddon) { + shouldAutoUpdate: function(aAddon) { if (!aAddon || typeof aAddon != "object") throw Components.Exception("aAddon must be specified", Cr.NS_ERROR_INVALID_ARG); @@ -3008,7 +2999,7 @@ this.AddonManager = { AddonManagerInternal.autoUpdateDefault = aValue; }, - escapeAddonURI: function AM_escapeAddonURI(aAddon, aUri, aAppVersion) { + escapeAddonURI: function(aAddon, aUri, aAppVersion) { return AddonManagerInternal.escapeAddonURI(aAddon, aUri, aAppVersion); }, diff --git a/toolkit/mozapps/extensions/LightweightThemeManager.jsm b/toolkit/mozapps/extensions/LightweightThemeManager.jsm index 5856bfa91..372a9f3b8 100644 --- a/toolkit/mozapps/extensions/LightweightThemeManager.jsm +++ b/toolkit/mozapps/extensions/LightweightThemeManager.jsm @@ -110,11 +110,11 @@ this.LightweightThemeManager = { return _setCurrentTheme(aData, false); }, - setLocalTheme: function LightweightThemeManager_setLocalTheme(aData) { + setLocalTheme: function(aData) { _setCurrentTheme(aData, true); }, - getUsedTheme: function LightweightThemeManager_getUsedTheme(aId) { + getUsedTheme: function(aId) { var usedThemes = this.usedThemes; for (let usedTheme of usedThemes) { if (usedTheme.id == aId) @@ -123,7 +123,7 @@ this.LightweightThemeManager = { return null; }, - forgetUsedTheme: function LightweightThemeManager_forgetUsedTheme(aId) { + forgetUsedTheme: function(aId) { let theme = this.getUsedTheme(aId); if (!theme) return; @@ -141,7 +141,7 @@ this.LightweightThemeManager = { AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper); }, - previewTheme: function LightweightThemeManager_previewTheme(aData) { + previewTheme: function(aData) { let cancel = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool); cancel.data = false; Services.obs.notifyObservers(cancel, "lightweight-theme-preview-requested", @@ -160,7 +160,7 @@ this.LightweightThemeManager = { _notifyWindows(aData); }, - resetPreview: function LightweightThemeManager_resetPreview() { + resetPreview: function() { if (_previewTimer) { _previewTimer.cancel(); _previewTimer = null; @@ -168,7 +168,7 @@ this.LightweightThemeManager = { } }, - parseTheme: function LightweightThemeManager_parseTheme(aString, aBaseURI) { + parseTheme: function(aString, aBaseURI) { try { return _sanitizeTheme(JSON.parse(aString), aBaseURI, false); } catch (e) { @@ -176,7 +176,7 @@ this.LightweightThemeManager = { } }, - updateCurrentTheme: function LightweightThemeManager_updateCurrentTheme() { + updateCurrentTheme: function() { try { if (!_prefs.getBoolPref("update.enabled")) return; @@ -224,7 +224,7 @@ this.LightweightThemeManager = { * @param aData * The lightweight theme to switch to */ - themeChanged: function LightweightThemeManager_themeChanged(aData) { + themeChanged: function(aData) { if (_previewTimer) { _previewTimer.cancel(); _previewTimer = null; @@ -251,7 +251,7 @@ this.LightweightThemeManager = { * Starts the Addons provider and enables the new lightweight theme if * necessary. */ - startup: function LightweightThemeManager_startup() { + startup: function() { if (Services.prefs.prefHasUserValue(PREF_LWTHEME_TO_SELECT)) { let id = Services.prefs.getCharPref(PREF_LWTHEME_TO_SELECT); if (id) @@ -267,7 +267,7 @@ this.LightweightThemeManager = { /** * Shuts down the provider. */ - shutdown: function LightweightThemeManager_shutdown() { + shutdown: function() { _prefs.removeObserver("", _prefObserver); }, @@ -283,7 +283,7 @@ this.LightweightThemeManager = { * true if the newly enabled add-on will only become enabled after a * restart */ - addonChanged: function LightweightThemeManager_addonChanged(aId, aType, aPendingRestart) { + addonChanged: function(aId, aType, aPendingRestart) { if (aType != ADDON_TYPE) return; @@ -356,7 +356,7 @@ this.LightweightThemeManager = { * @param aCallback * A callback to pass the Addon to */ - getAddonByID: function LightweightThemeManager_getAddonByID(aId, aCallback) { + getAddonByID: function(aId, aCallback) { let id = _getInternalID(aId); if (!id) { aCallback(null); @@ -380,7 +380,7 @@ this.LightweightThemeManager = { * @param aCallback * A callback to pass an array of Addons to */ - getAddonsByTypes: function LightweightThemeManager_getAddonsByTypes(aTypes, aCallback) { + getAddonsByTypes: function(aTypes, aCallback) { if (aTypes && aTypes.indexOf(ADDON_TYPE) == -1) { aCallback([]); return; @@ -541,7 +541,7 @@ AddonWrapper.prototype = { }, // Lightweight themes are always compatible - isCompatibleWith: function AddonWrapper_isCompatibleWith(appVersion, platformVersion) { + isCompatibleWith: function(appVersion, platformVersion) { return true; }, @@ -708,7 +708,7 @@ function _notifyWindows(aThemeData) { var _previewTimer; var _previewTimerCallback = { - notify: function _previewTimerCallback_notify() { + notify: function() { LightweightThemeManager.resetPreview(); } }; diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js index 731e70c6c..2628ea87b 100644 --- a/toolkit/mozapps/extensions/addonManager.js +++ b/toolkit/mozapps/extensions/addonManager.js @@ -53,7 +53,7 @@ function amManager() { } amManager.prototype = { - observe: function AMC_observe(aSubject, aTopic, aData) { + observe: function(aSubject, aTopic, aData) { if (aTopic == "addons-startup") AddonManagerPrivate.startup(); }, @@ -61,7 +61,7 @@ amManager.prototype = { /** * @see amIAddonManager.idl */ - mapURIToAddonID: function AMC_mapURIToAddonID(uri, id) { + mapURIToAddonID: function(uri, id) { id.value = AddonManager.mapURIToAddonID(uri); return !!id.value; }, @@ -69,19 +69,15 @@ amManager.prototype = { /** * @see amIWebInstaller.idl */ - isInstallEnabled: function AMC_isInstallEnabled(aMimetype, aReferer) { + isInstallEnabled: function(aMimetype, aReferer) { return AddonManager.isInstallEnabled(aMimetype); }, /** * @see amIWebInstaller.idl */ - installAddonsFromWebpage: function AMC_installAddonsFromWebpage(aMimetype, - aBrowser, - aInstallingPrincipal, - aUris, aHashes, - aNames, aIcons, - aCallback) { + installAddonsFromWebpage: function(aMimetype, aBrowser, aInstallingPrincipal, + aUris, aHashes, aNames, aIcons, aCallback) { if (aUris.length == 0) return false; @@ -112,22 +108,22 @@ amManager.prototype = { installs.push(aInstall); if (aCallback) { aInstall.addListener({ - onDownloadCancelled: function buildNextInstall_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { callCallback(uri, USER_CANCELLED); }, - onDownloadFailed: function buildNextInstall_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { if (aInstall.error == AddonManager.ERROR_CORRUPT_FILE) callCallback(uri, CANT_READ_ARCHIVE); else callCallback(uri, DOWNLOAD_ERROR); }, - onInstallFailed: function buildNextInstall_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { callCallback(uri, EXECUTION_ERROR); }, - onInstallEnded: function buildNextInstall_onInstallEnded(aInstall, aStatus) { + onInstallEnded: function(aInstall, aStatus) { callCallback(uri, SUCCESS); } }); @@ -144,7 +140,7 @@ amManager.prototype = { return retval; }, - notify: function AMC_notify(aTimer) { + notify: function(aTimer) { AddonManagerPrivate.backgroundUpdateTimerHandler(); }, @@ -154,7 +150,7 @@ amManager.prototype = { * Listens to requests from child processes for InstallTrigger * activity, and sends back callbacks. */ - receiveMessage: function AMC_receiveMessage(aMessage) { + receiveMessage: function(aMessage) { let payload = aMessage.data; switch (aMessage.name) { @@ -165,7 +161,7 @@ amManager.prototype = { let callback = null; if (payload.callbackID != -1) { callback = { - onInstallEnded: function ITP_callback(url, status) { + onInstallEnded: function(url, status) { gParentMM.broadcastAsyncMessage(MSG_INSTALL_CALLBACK, { callbackID: payload.callbackID, url: url, @@ -184,7 +180,7 @@ amManager.prototype = { classID: Components.ID("{4399533d-08d1-458c-a87a-235f74451cfa}"), _xpcom_factory: { - createInstance: function AMC_createInstance(aOuter, aIid) { + createInstance: function(aOuter, aIid) { if (aOuter != null) throw Components.Exception("Component does not support aggregation", Cr.NS_ERROR_NO_AGGREGATION); diff --git a/toolkit/mozapps/extensions/amInstallTrigger.js b/toolkit/mozapps/extensions/amInstallTrigger.js index a18fe84c4..5fc0e1717 100644 --- a/toolkit/mozapps/extensions/amInstallTrigger.js +++ b/toolkit/mozapps/extensions/amInstallTrigger.js @@ -203,7 +203,7 @@ InstallTrigger.prototype = { return this.startSoftwareUpdate(url); }, - _resolveURL: function (url) { + _resolveURL: function(url) { return Services.io.newURI(url, null, this._url); }, diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js index ac6e2495d..088f56640 100644 --- a/toolkit/mozapps/extensions/amWebInstallListener.js +++ b/toolkit/mozapps/extensions/amWebInstallListener.js @@ -89,7 +89,7 @@ Installer.prototype = { /** * Checks if all downloads are now complete and if so prompts to install. */ - checkAllDownloaded: function Installer_checkAllDownloaded() { + checkAllDownloaded: function() { // Prevent re-entrancy caused by the confirmation dialog cancelling unwanted // installs. if (!this.isDownloading) @@ -199,7 +199,7 @@ Installer.prototype = { /** * Checks if all installs are now complete and if so notifies observers. */ - checkAllInstalled: function Installer_checkAllInstalled() { + checkAllInstalled: function() { var failed = []; for (let install of this.downloads) { @@ -225,32 +225,32 @@ Installer.prototype = { this.installed = null; }, - onDownloadCancelled: function Installer_onDownloadCancelled(aInstall) { + onDownloadCancelled: function(aInstall) { aInstall.removeListener(this); this.checkAllDownloaded(); }, - onDownloadFailed: function Installer_onDownloadFailed(aInstall) { + onDownloadFailed: function(aInstall) { aInstall.removeListener(this); this.checkAllDownloaded(); }, - onDownloadEnded: function Installer_onDownloadEnded(aInstall) { + onDownloadEnded: function(aInstall) { this.checkAllDownloaded(); return false; }, - onInstallCancelled: function Installer_onInstallCancelled(aInstall) { + onInstallCancelled: function(aInstall) { aInstall.removeListener(this); this.checkAllInstalled(); }, - onInstallFailed: function Installer_onInstallFailed(aInstall) { + onInstallFailed: function(aInstall) { aInstall.removeListener(this); this.checkAllInstalled(); }, - onInstallEnded: function Installer_onInstallEnded(aInstall) { + onInstallEnded: function(aInstall) { aInstall.removeListener(this); this.installed.push(aInstall); @@ -272,7 +272,7 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallDisabled: function extWebInstallListener_onWebInstallDisabled(aBrowser, aUri, aInstalls) { + onWebInstallDisabled: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, @@ -286,13 +286,13 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallOriginBlocked: function extWebInstallListener_onWebInstallOriginBlocked(aBrowser, aUri, aInstalls) { + onWebInstallOriginBlocked: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, installs: aInstalls, - install: function onWebInstallBlocked_install() { + install: function() { }, QueryInterface: XPCOMUtils.generateQI([Ci.amIWebInstallInfo]) @@ -305,13 +305,13 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallBlocked: function extWebInstallListener_onWebInstallBlocked(aBrowser, aUri, aInstalls) { + onWebInstallBlocked: function(aBrowser, aUri, aInstalls) { let info = { browser: aBrowser, originatingURI: aUri, installs: aInstalls, - install: function onWebInstallBlocked_install() { + install: function() { new Installer(this.browser, this.originatingURI, this.installs); }, @@ -325,7 +325,7 @@ extWebInstallListener.prototype = { /** * @see amIWebInstallListener.idl */ - onWebInstallRequested: function extWebInstallListener_onWebInstallRequested(aBrowser, aUri, aInstalls) { + onWebInstallRequested: function(aBrowser, aUri, aInstalls) { new Installer(aBrowser, aUri, aInstalls); // We start the installs ourself diff --git a/toolkit/themes/osx/global/notification.css b/toolkit/themes/osx/global/notification.css index 24b3d3920..6d22cf9c8 100644 --- a/toolkit/themes/osx/global/notification.css +++ b/toolkit/themes/osx/global/notification.css @@ -81,12 +81,12 @@ notificationbox[notificationside="bottom"] > notification { Invert the close icon for @type=info since both are normally dark. It's unclear why !important is necessary here so remove it if it's no longer needed. */ -notification[type="info"]:not([value="translation"]) .close-icon:not(:hover) { +notification[type="info"] .close-icon:not(:hover) { -moz-image-region: rect(0, 64px, 16px, 48px) !important; } @media (min-resolution: 2dppx) { - notification[type="info"]:not([value="translation"]) .close-icon:not(:hover) { + notification[type="info"] .close-icon:not(:hover) { -moz-image-region: rect(0, 128px, 32px, 96px) !important; } } |