Bug 392419 - Cleanup preprocessing of files (part 1). r=bsmedberg

This commit is contained in:
rob_strong@exchangecode.com 2007-08-16 14:17:45 -07:00
Родитель ad03cfd5df
Коммит 6b1b4ee2af
2 изменённых файлов: 201 добавлений и 199 удалений

Просмотреть файл

@ -1,43 +1,43 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* /*
# ***** BEGIN LICENSE BLOCK ***** # ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1 # Version: MPL 1.1/GPL 2.0/LGPL 2.1
# #
# The contents of this file are subject to the Mozilla Public License Version # The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with # 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at # the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/ # http://www.mozilla.org/MPL/
# #
# Software distributed under the License is distributed on an "AS IS" basis, # Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the # for the specific language governing rights and limitations under the
# License. # License.
# #
# The Original Code is the Blocklist Service. # The Original Code is the Blocklist Service.
# #
# The Initial Developer of the Original Code is # The Initial Developer of the Original Code is
# Mozilla Corporation. # Mozilla Corporation.
# Portions created by the Initial Developer are Copyright (C) 2007 # Portions created by the Initial Developer are Copyright (C) 2007
# the Initial Developer. All Rights Reserved. # the Initial Developer. All Rights Reserved.
# #
# Contributor(s): # Contributor(s):
# Robert Strong <robert.bugzilla@gmail.com> # Robert Strong <robert.bugzilla@gmail.com>
# Michael Wu <flamingice@sourmilk.net> # Michael Wu <flamingice@sourmilk.net>
# #
# Alternatively, the contents of this file may be used under the terms of # Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or # either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead # in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only # of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to # under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your # use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice # decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete # and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under # the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL. # the terms of any one of the MPL, the GPL or the LGPL.
# #
# ***** END LICENSE BLOCK ***** # ***** END LICENSE BLOCK *****
*/ */
const Cc = Components.classes; const Cc = Components.classes;
const Ci = Components.interfaces; const Ci = Components.interfaces;
@ -375,55 +375,55 @@ Blocklist.prototype = {
}, },
/** /**
# The blocklist XML file looks something like this: # The blocklist XML file looks something like this:
# #
# <blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist"> # <blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist">
# <emItems> # <emItems>
# <emItem id="item_1@domain"> # <emItem id="item_1@domain">
# <versionRange minVersion="1.0" maxVersion="2.0.*"> # <versionRange minVersion="1.0" maxVersion="2.0.*">
# <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> # <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
# <versionRange minVersion="1.5" maxVersion="1.5.*"/> # <versionRange minVersion="1.5" maxVersion="1.5.*"/>
# <versionRange minVersion="1.7" maxVersion="1.7.*"/> # <versionRange minVersion="1.7" maxVersion="1.7.*"/>
# </targetApplication> # </targetApplication>
# <targetApplication id="toolkit@mozilla.org"> # <targetApplication id="toolkit@mozilla.org">
# <versionRange minVersion="1.8" maxVersion="1.8.*"/> # <versionRange minVersion="1.8" maxVersion="1.8.*"/>
# </targetApplication> # </targetApplication>
# </versionRange> # </versionRange>
# <versionRange minVersion="3.0" maxVersion="3.0.*"> # <versionRange minVersion="3.0" maxVersion="3.0.*">
# <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> # <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
# <versionRange minVersion="1.5" maxVersion="1.5.*"/> # <versionRange minVersion="1.5" maxVersion="1.5.*"/>
# </targetApplication> # </targetApplication>
# <targetApplication id="toolkit@mozilla.org"> # <targetApplication id="toolkit@mozilla.org">
# <versionRange minVersion="1.8" maxVersion="1.8.*"/> # <versionRange minVersion="1.8" maxVersion="1.8.*"/>
# </targetApplication> # </targetApplication>
# </versionRange> # </versionRange>
# </emItem> # </emItem>
# <emItem id="item_2@domain"> # <emItem id="item_2@domain">
# <versionRange minVersion="3.1" maxVersion="4.*"/> # <versionRange minVersion="3.1" maxVersion="4.*"/>
# </emItem> # </emItem>
# <emItem id="item_3@domain"> # <emItem id="item_3@domain">
# <versionRange> # <versionRange>
# <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"> # <targetApplication id="{ec8030f7-c20a-464f-9b0e-13a3a9e97384}">
# <versionRange minVersion="1.5" maxVersion="1.5.*"/> # <versionRange minVersion="1.5" maxVersion="1.5.*"/>
# </targetApplication> # </targetApplication>
# </versionRange> # </versionRange>
# </emItem> # </emItem>
# <emItem id="item_4@domain"> # <emItem id="item_4@domain">
# <versionRange> # <versionRange>
# <targetApplication> # <targetApplication>
# <versionRange minVersion="1.5" maxVersion="1.5.*"/> # <versionRange minVersion="1.5" maxVersion="1.5.*"/>
# </targetApplication> # </targetApplication>
# </versionRange> # </versionRange>
# <emItem id="item_5@domain"/> # <emItem id="item_5@domain"/>
# </emItems> # </emItems>
# <pluginItems> # <pluginItems>
# <pluginItem> # <pluginItem>
# <!-- All match tags must match a plugin to blocklist a plugin --> # <!-- All match tags must match a plugin to blocklist a plugin -->
# <match name="name" exp="some plugin"/> # <match name="name" exp="some plugin"/>
# <match name="description" exp="1[.]2[.]3"/> # <match name="description" exp="1[.]2[.]3"/>
# </pluginItem> # </pluginItem>
# </pluginItems> # </pluginItems>
# </blocklist> # </blocklist>
*/ */
_loadBlocklistFromFile: function(file) { _loadBlocklistFromFile: function(file) {

Просмотреть файл

@ -1,44 +1,46 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK ***** /*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 # ***** BEGIN LICENSE BLOCK *****
* # Version: MPL 1.1/GPL 2.0/LGPL 2.1
* The contents of this file are subject to the Mozilla Public License Version #
* 1.1 (the "License"); you may not use this file except in compliance with # The contents of this file are subject to the Mozilla Public License Version
* the License. You may obtain a copy of the License at # 1.1 (the "License"); you may not use this file except in compliance with
* http://www.mozilla.org/MPL/ # the License. You may obtain a copy of the License at
* # http://www.mozilla.org/MPL/
* Software distributed under the License is distributed on an "AS IS" basis, #
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License # Software distributed under the License is distributed on an "AS IS" basis,
* for the specific language governing rights and limitations under the # WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* License. # for the specific language governing rights and limitations under the
* # License.
* The Original Code is the Extension Manager. #
* # The Original Code is the Extension Manager.
* The Initial Developer of the Original Code is Ben Goodger. #
* Portions created by the Initial Developer are Copyright (C) 2004 # The Initial Developer of the Original Code is Ben Goodger.
* the Initial Developer. All Rights Reserved. # Portions created by the Initial Developer are Copyright (C) 2004
* # the Initial Developer. All Rights Reserved.
* Contributor(s): #
* Ben Goodger <ben@mozilla.org> (Google Inc.) # Contributor(s):
* Benjamin Smedberg <benjamin@smedbergs.us> # Ben Goodger <ben@mozilla.org> (Google Inc.)
* Jens Bannmann <jens.b@web.de> # Benjamin Smedberg <benjamin@smedbergs.us>
* Robert Strong <robert.bugzilla@gmail.com> # Jens Bannmann <jens.b@web.de>
* Dave Townsend <dave.townsend@blueprintit.co.uk> # Robert Strong <robert.bugzilla@gmail.com>
* Daniel Veditz <dveditz@mozilla.com> # Dave Townsend <dave.townsend@blueprintit.co.uk>
* # Daniel Veditz <dveditz@mozilla.com>
* Alternatively, the contents of this file may be used under the terms of #
* either the GNU General Public License Version 2 or later (the "GPL"), or # Alternatively, the contents of this file may be used under the terms of
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), # either the GNU General Public License Version 2 or later (the "GPL"), or
* in which case the provisions of the GPL or the LGPL are applicable instead # the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* of those above. If you wish to allow use of your version of this file only # in which case the provisions of the GPL or the LGPL are applicable instead
* under the terms of either the GPL or the LGPL, and not to allow others to # of those above. If you wish to allow use of your version of this file only
* use your version of this file under the terms of the MPL, indicate your # under the terms of either the GPL or the LGPL, and not to allow others to
* decision by deleting the provisions above and replace them with the notice # use your version of this file under the terms of the MPL, indicate your
* and other provisions required by the GPL or the LGPL. If you do not delete # decision by deleting the provisions above and replace them with the notice
* the provisions above, a recipient may use your version of this file under # and other provisions required by the GPL or the LGPL. If you do not delete
* the terms of any one of the MPL, the GPL or the LGPL. # the provisions above, a recipient may use your version of this file under
* # the terms of any one of the MPL, the GPL or the LGPL.
* ***** END LICENSE BLOCK ***** */ #
# ***** END LICENSE BLOCK *****
*/
// //
// TODO: // TODO:
@ -5642,36 +5644,35 @@ ExtensionItemUpdater.prototype = {
_items : [], _items : [],
_listener : null, _listener : null,
_background : false, _background : false,
///////////////////////////////////////////////////////////////////////////// /* ExtensionItemUpdater
// ExtensionItemUpdater #
// # When we check for updates to an item, there are two pieces of information
// When we check for updates to an item, there are two pieces of information # that are returned - 1) info about the newest available version, if any,
// that are returned - 1) info about the newest available version, if any, # and 2) info about the currently installed version. The latter is provided
// and 2) info about the currently installed version. The latter is provided # primarily to inform the client of changes to the application compatibility
// primarily to inform the client of changes to the application compatibility # metadata for the current item. Depending on the situation, either 2 or
// metadata for the current item. Depending on the situation, either 2 or # 1&2 may be what is required.
// 1&2 may be what is required. #
// # Callers:
// Callers: # 1 - nsUpdateService.js, user event
// 1 - nsUpdateService.js, user event # User clicked on the update icon to invoke an update check,
// User clicked on the update icon to invoke an update check, # user clicked on an Extension/Theme and clicked "Update". In this
// user clicked on an Extension/Theme and clicked "Update". In this # case we want to update compatibility metadata about the installed
// case we want to update compatibility metadata about the installed # version, and look for newer versions to offer.
// version, and look for newer versions to offer. # 2 - nsUpdateService.js, background event
// 2 - nsUpdateService.js, background event # Timer fired, background update is being performed. In this case
// Timer fired, background update is being performed. In this case # we also want to update compatibility metadata and look for newer
// we also want to update compatibility metadata and look for newer # versions.
// versions. # 3 - Mismatch
// 3 - Mismatch # User upgraded to a newer version of the app, update compatibility
// User upgraded to a newer version of the app, update compatibility # metadata and look for newer versions.
// metadata and look for newer versions. # 4 - Install Phone Home
// 4 - Install Phone Home # User installed an item that was deemed incompatible based only
// User installed an item that was deemed incompatible based only # on the information provided in the item's install.rdf manifest,
// on the information provided in the item's install.rdf manifest, # we look ONLY for compatibility updates in this case to determine
// we look ONLY for compatibility updates in this case to determine # whether or not the item can be installed.
// whether or not the item can be installed. */
//
checkForUpdates: function(aItems, aItemCount, aUpdateCheckType, checkForUpdates: function(aItems, aItemCount, aUpdateCheckType,
aListener) { aListener) {
this._listener = new AddonUpdateCheckListener(aListener, this._emDS); this._listener = new AddonUpdateCheckListener(aListener, this._emDS);
@ -6006,48 +6007,49 @@ RDFItemUpdater.prototype = {
}, },
onDatasourceLoaded: function(aDatasource, aLocalItem) { onDatasourceLoaded: function(aDatasource, aLocalItem) {
/////////////////////////////////////////////////////////////////////////// /*
// The extension update RDF file looks something like this: # The extension update RDF file looks something like this:
// #
// <RDF:Description about="urn:mozilla:extension:{GUID}"> # <RDF:Description about="urn:mozilla:extension:{GUID}">
// <em:updates> # <em:updates>
// <RDF:Seq> # <RDF:Seq>
// <RDF:li resource="urn:mozilla:extension:{GUID}:4.9"/> # <RDF:li resource="urn:mozilla:extension:{GUID}:4.9"/>
// <RDF:li resource="urn:mozilla:extension:{GUID}:5.0"/> # <RDF:li resource="urn:mozilla:extension:{GUID}:5.0"/>
// </RDF:Seq> # </RDF:Seq>
// </em:updates> # </em:updates>
// <!-- the version of the extension being offered --> # <!-- the version of the extension being offered -->
// <em:version>5.0</em:version> # <em:version>5.0</em:version>
// <em:updateLink>http://www.mysite.com/myext-50.xpi</em:updateLink> # <em:updateLink>http://www.mysite.com/myext-50.xpi</em:updateLink>
// </RDF:Description> # </RDF:Description>
// #
// <RDF:Description about="urn:mozilla:extension:{GUID}:4.9"> # <RDF:Description about="urn:mozilla:extension:{GUID}:4.9">
// <em:version>4.9</em:version> # <em:version>4.9</em:version>
// <em:targetApplication> # <em:targetApplication>
// <RDF:Description> # <RDF:Description>
// <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id> # <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
// <em:minVersion>0.9</em:minVersion> # <em:minVersion>0.9</em:minVersion>
// <em:maxVersion>1.0</em:maxVersion> # <em:maxVersion>1.0</em:maxVersion>
// <em:updateLink>http://www.mysite.com/myext-49.xpi</em:updateLink> # <em:updateLink>http://www.mysite.com/myext-49.xpi</em:updateLink>
// </RDF:Description> # </RDF:Description>
// </em:targetApplication> # </em:targetApplication>
// </RDF:Description> # </RDF:Description>
// #
// If we get here because the following happened: # If we get here because the following happened:
// 1) User was using Firefox 0.9 with ExtensionX 0.5 (minVersion 0.8, # 1) User was using Firefox 0.9 with ExtensionX 0.5 (minVersion 0.8,
// maxVersion 0.9 for Firefox) # maxVersion 0.9 for Firefox)
// 2) User upgraded Firefox to 1.0 # 2) User upgraded Firefox to 1.0
// 3) |checkForMismatches| deems ExtensionX 0.5 incompatible with this # 3) |checkForMismatches| deems ExtensionX 0.5 incompatible with this
// new version of Firefox on the basis of its maxVersion # new version of Firefox on the basis of its maxVersion
// 4) ** We reach this point ** # 4) ** We reach this point **
// #
// If the version of ExtensionX (0.5) matches that provided by the # If the version of ExtensionX (0.5) matches that provided by the
// server, then this is a cue that the author updated the rdf file # server, then this is a cue that the author updated the rdf file
// or central repository to say "0.5 is ALSO compatible with Firefox 1.0, # or central repository to say "0.5 is ALSO compatible with Firefox 1.0,
// no changes are necessary." In this event, the local metadata for # no changes are necessary." In this event, the local metadata for
// installed ExtensionX (0.5) is freshened with the new maxVersion, # installed ExtensionX (0.5) is freshened with the new maxVersion,
// and we advance to the next item WITHOUT any download/install # and we advance to the next item WITHOUT any download/install
// updates. # updates.
*/
if (!aDatasource.GetAllResources().hasMoreElements()) { if (!aDatasource.GetAllResources().hasMoreElements()) {
LOG("RDFItemUpdater:onDatasourceLoaded: Datasource empty.\r\n" + LOG("RDFItemUpdater:onDatasourceLoaded: Datasource empty.\r\n" +
"If you are an Extension developer and were expecting there to be\r\n" + "If you are an Extension developer and were expecting there to be\r\n" +