170006 - various updates to support pre-configured extensions

This commit is contained in:
ben%bengoodger.com 2004-05-10 23:30:11 +00:00
Родитель 4f1eacb647
Коммит eec34308af
4 изменённых файлов: 37 добавлений и 34 удалений

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

@ -34,7 +34,9 @@ function init()
// Home Page URL
var homepageArc = rdfs.GetResource(EM_NS("homepageURL"));
var homepage = gExtensionDB.GetTarget(extension, homepageArc, true);
homepage = homepage.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
if (homepage)
homepage = homepage.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
// Creator
var creatorArc = rdfs.GetResource(EM_NS("creator"));
var creator = gExtensionDB.GetTarget(extension, creatorArc, true);
@ -53,9 +55,13 @@ function init()
extensionCreator.setAttribute("value", creator);
var extensionHomepage = document.getElementById("extensionHomepage");
extensionHomepage.setAttribute("href", homepage);
extensionHomepage.setAttribute("tooltiptext", homepage);
if (homepage) {
extensionHomepage.setAttribute("href", homepage);
extensionHomepage.setAttribute("tooltiptext", homepage);
}
else
extensionHomepage.hidden = true;
var contributorsBox = document.getElementById("contributorsBox");
var contributorsArc = rdfs.GetResource(EM_NS("contributor"));
var contributors = gExtensionDB.GetTargets(extension, contributorsArc, true);

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

@ -60,8 +60,8 @@ const FILE_AUTOREG = ".autoreg";
const FILE_INSTALL_MANIFEST = "install.rdf";
const FILE_CHROME_MANIFEST = "contents.rdf";
const FILE_WASINSAFEMODE = "Safe Mode";
const FILE_INSTALLED_EXTENSIONS = "Installed Extensions"
const FILE_INSTALLED_EXTENSIONS_PROCESSED = "Installed Extensions (Processed)"
const FILE_INSTALLED_EXTENSIONS = "installed-extensions.txt"
const FILE_INSTALLED_EXTENSIONS_PROCESSED = "installed-extensions-processed.txt"
///////////////////////////////////////////////////////////////////////////////
//
@ -362,8 +362,8 @@ nsInstalledExtensionReader.prototype = {
for (var i = 0; i < lines.length; ++i)
this._parseLine(lines[i]);
this._installedExtensons.moveTo(getDir("XCurProcD", [DIR_EXTENSIONS]),
FILE_INSTALLED_EXTENSIONS_PROCESSED);
this._installedExtensions.moveTo(getDir("XCurProcD", [DIR_EXTENSIONS]),
FILE_INSTALLED_EXTENSIONS_PROCESSED);
},
TOKEN_EXTENSION : "extension",
@ -371,21 +371,16 @@ nsInstalledExtensionReader.prototype = {
_parseLine: function (aLine)
{
// extension\t{GUID} or theme\tpersistentDescriptor
var parts = aLine.split("\t");
// extension,{GUID} or theme,{GUID}
var parts = aLine.split(",");
var manifest = getFile("XCurProcD",
[DIR_EXTENSIONS, parts[1], FILE_INSTALL_MANIFEST]);
switch (parts[0]) {
case this.TOKEN_EXTENSION:
this._manager.installExtensionInternal(manifest, false);
this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_EXTENSION, manifest);
break;
case this.TOKEN_THEME:
var prefix = parts[0] + "\t";
var filePD = aLine.substr(prefix.length, aLine.length);
var lf = Components.classes["@mozilla.org/file/local;1"]
.createInstance(Components.interfaces.nsILocalFile);
lf.persistentDescriptor = filePD;
this._manager.installTheme(lf, nsIExtensionManager.INSTALL_GLOBAL);
this._manager.ensurePreConfiguredItem(parts[1], nsIUpdateItem.TYPE_THEME, manifest);
break;
}
}
@ -941,9 +936,6 @@ nsExtensionManager.prototype = {
// selection... this means we need to verify that all the services
// invoked by these operations are globally available.
// Install any pre-configured items
(new nsInstalledExtensionReader(this)).read();
var globalExtension = cmdLineSvc.getCmdLineValue("-install-global-extension");
if (globalExtension)
this._checkForGlobalInstalls(globalExtension, nsIUpdateItem.TYPE_EXTENSION);
@ -1138,6 +1130,15 @@ nsExtensionManager.prototype = {
}
},
ensurePreConfiguredItem: function (aItemID, aItemType, aManifest)
{
this._ds.insertForthcomingItem(aItemID, aItemType, false);
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var metadataDS = rdf.GetDataSourceBlocking(getURLSpecFromFile(aManifest));
this._ds.addItemMetadata(aItemID, aItemType, metadataDS, false);
},
checkForMismatches: function ()
{
var rv = false;
@ -1529,6 +1530,9 @@ nsExtensionManager.prototype = {
this._ds.loadExtensions(false);
this._ds.loadExtensions(true);
}
// Ensure any pre-configured items are initialized.
(new nsInstalledExtensionReader(this)).read();
}
},

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

@ -75,7 +75,7 @@ nsUpdateService.prototype = {
updateEnded: function ()
{
this.updating = false;
// this.updating = false;
delete this._updateObserver;
},
@ -95,7 +95,7 @@ nsUpdateService.prototype = {
var lastUpdateTime = this._pref.getIntPref(PREF_UPDATE_LASTUPDATEDATE);
var timeSinceLastCheck = Date.UTC() - lastUpdateTime;
if (timeSinceLastCheck > interval) {
if (!this.updating)
// if (!this.updating)
this.checkForUpdatesInternal([], 0, nsIUpdateItem.TYPE_ANY,
nsIUpdateService.SOURCE_EVENT_BACKGROUND);
}
@ -105,7 +105,7 @@ nsUpdateService.prototype = {
checkForUpdates: function (aItems, aItemCount, aUpdateTypes, aSourceEvent, aParentWindow)
{
if (this.updating) return;
// if (this.updating) return;
switch (aSourceEvent) {
case nsIUpdateService.SOURCE_EVENT_MISMATCH:
@ -143,7 +143,7 @@ nsUpdateService.prototype = {
checkForUpdatesInternal: function (aItems, aItemCount, aUpdateTypes, aSourceEvent)
{
this.updating = true;
// this.updating = true;
// Listen for notifications sent out by the app updater (implemented here) and the
// extension updater (implemented in nsExtensionItemUpdater)
@ -282,7 +282,7 @@ nsUpdateService.prototype = {
// nsITimerCallback
notify: function (aTimer)
{
if (this.updating) return;
// if (this.updating) return;
this.checkForUpdatesInternal([], 0, nsIUpdateItem.TYPE_ANY,
nsIUpdateService.SOURCE_EVENT_BACKGROUND);

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

@ -10,13 +10,7 @@
<!-- classic Information -->
<RDF:Description about="urn:mozilla:skin:classic/1.0"
chrome:displayName="Firefox (default)"
chrome:accessKey="P"
chrome:author="mozilla.org"
chrome:authorURL="http://www.mozilla.org/products/firefox/"
chrome:description="This is the default Firefox theme. Select this theme to return to the original appearance."
chrome:name="classic/1.0"
chrome:image="Preview.png">
chrome:name="classic/1.0">
<chrome:packages>
<RDF:Seq about="urn:mozilla:skin:classic/1.0:packages">
<RDF:li resource="urn:mozilla:skin:classic/1.0:global"/>
@ -26,6 +20,5 @@
<!-- Version Information. State that we work only with major version 1 of this
package. -->
<RDF:Description about="urn:mozilla:skin:classic/1.0:global"
chrome:skinVersion="1.5"/>
<RDF:Description about="urn:mozilla:skin:classic/1.0:global"/>
</RDF:RDF>