Bug 273417 - Use the app id/version/buildid from nsXULAppAPI instead of using prefs r=darin a=ben
git-svn-id: svn://10.0.0.236/trunk@166377 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
513ab98ef6
commit
ea24d7cee7
@ -48,11 +48,12 @@ static const nsXREAppData kAppData = {
|
||||
"Firefox",
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
// ec8030f7-c20a-464f-9b0e-13a3a9e97384
|
||||
{ 0xec8030f7, 0xc20a, 0x464f, { 0x9b, 0x0e, 0x13, 0xa3, 0xa9, 0xe9, 0x73, 0x84 } },
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
NS_XRE_ENABLE_PROFILE_MIGRATOR |
|
||||
NS_XRE_ENABLE_EXTENSION_MANAGER
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
@ -54,9 +54,6 @@ pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager-extensions");
|
||||
// This is this application's unique identifier used by the Extension System to identify
|
||||
// this application as an extension target, and by the SmartUpdate system to identify
|
||||
// this application to the Update server.
|
||||
pref("app.id", "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}");
|
||||
pref("app.version", @APP_VERSION@);
|
||||
pref("app.build_id", @BUILD_ID@);
|
||||
pref("app.extensions.version", "1.0");
|
||||
|
||||
pref("update.app.enabled", true); // Whether or not app updates are enabled
|
||||
|
||||
@ -50,10 +50,11 @@ static const nsXREAppData kAppData = {
|
||||
"Sunbird",
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
// {718e30fb-e89b-41dd-9da7-e25a45638b28}
|
||||
{ 0x718e30fb, 0xe89b, 0x41dd, { 0x9d, 0xa7, 0xe2, 0x5a, 0x45, 0x63, 0x8b, 0x28 } },
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
NS_XRE_ENABLE_EXTENSION_MANAGER
|
||||
};
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
@ -47,16 +47,6 @@ pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallCo
|
||||
pref("xpinstall.dialog.progress", "chrome://mozapps/content/downloads/downloads.xul");
|
||||
pref("xpinstall.dialog.progress.type", "Download:Manager");
|
||||
|
||||
// This is this application's unique identifier used by the Extension System to identify
|
||||
// this application as an extension target, and by the SmartUpdate system to identify
|
||||
// this application to the Update server.
|
||||
pref("app.id", "{718e30fb-e89b-41dd-9da7-e25a45638b28}");
|
||||
pref("app.version",
|
||||
#expand __APP_VERSION__
|
||||
);
|
||||
pref("app.build_id",
|
||||
#expand __BUILD_ID__
|
||||
);
|
||||
pref("app.extensions.version",
|
||||
#expand __APP_VERSION__
|
||||
);
|
||||
|
||||
@ -49,6 +49,8 @@ static const nsXREAppData kAppData = {
|
||||
"Thunderbird",
|
||||
APP_VERSION,
|
||||
BUILD_ID,
|
||||
// {3550f703-e582-4d05-9a08-453d09bdfdc6}
|
||||
{ 0x3550f703, 0xe582, 0x4d05, { 0x9a, 0x08, 0x45, 0x3d, 0x09, 0xbd, 0xfd, 0xc6 } },
|
||||
"Copyright (c) 2004 mozilla.org",
|
||||
NS_XRE_ENABLE_PROFILE_MIGRATOR |
|
||||
NS_XRE_ENABLE_EXTENSION_MANAGER
|
||||
|
||||
@ -42,16 +42,6 @@ pref("general.useragent.vendorSub",
|
||||
pref("general.useragent.locale", "en-US");
|
||||
pref("general.skins.selectedSkin", "classic/1.0");
|
||||
|
||||
// This is this application's unique identifier used by the Extension System to identify
|
||||
// this application as an extension target, and by the SmartUpdate system to identify
|
||||
// this application to the Update server.
|
||||
pref("app.id", "{3550f703-e582-4d05-9a08-453d09bdfdc6}");
|
||||
pref("app.version",
|
||||
#expand __APP_VERSION__
|
||||
);
|
||||
pref("app.build_id",
|
||||
#expand __BUILD_ID__
|
||||
);
|
||||
pref("app.extensions.version", "0.6");
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
|
||||
@ -15,7 +15,6 @@ var gDownloadManager = null;
|
||||
var gObserverIndex = -1;
|
||||
var gItemType = -1;
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_EXTENSIONS_GETMORETHEMESURL = "extensions.getMoreThemesURL";
|
||||
const PREF_EXTENSIONS_GETMOREEXTENSIONSURL = "extensions.getMoreExtensionsURL";
|
||||
const PREF_EXTENSIONS_DSS_ENABLED = "extensions.dss.enabled";
|
||||
@ -178,7 +177,9 @@ function Startup()
|
||||
gGetMoreURL = pref.getComplexValue(isExtensions ? PREF_EXTENSIONS_GETMOREEXTENSIONSURL
|
||||
: PREF_EXTENSIONS_GETMORETHEMESURL,
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, pref.getCharPref(PREF_APP_ID));
|
||||
var app = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Components.interfaces.nsIXULAppInfo);
|
||||
gGetMoreURL = gGetMoreURL.replace(/%APPID%/g, app.ID);
|
||||
// Update various pieces of state-dependant UI
|
||||
var getMore = document.getElementById("getMore");
|
||||
getMore.setAttribute("value", getMore.getAttribute(isExtensions ? "valueextensions" : "valuethemes"));
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ben Goodger <ben@bengoodger.com>
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* 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
|
||||
@ -39,10 +40,7 @@ const nsIExtensionManager = Components.interfaces.nsIExtensionManage
|
||||
const nsIUpdateService = Components.interfaces.nsIUpdateService;
|
||||
const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
|
||||
|
||||
const PREF_EM_APP_ID = "app.id";
|
||||
const PREF_EM_APP_VERSION = "app.version";
|
||||
const PREF_EM_APP_EXTENSIONS_VERSION = "app.extensions.version";
|
||||
const PREF_EM_APP_BUILDID = "app.build_id";
|
||||
const PREF_EM_LAST_APP_VERSION = "extensions.lastAppVersion";
|
||||
const PREF_UPDATE_COUNT = "extensions.update.count";
|
||||
const PREF_UPDATE_DEFAULT_URL = "extensions.update.url";
|
||||
@ -87,6 +85,7 @@ const ERROR_INVALID_VERSION = -1;
|
||||
const ERROR_PHONED_HOME = -2;
|
||||
const ERROR_EXTENSION_IS_THEME = -3;
|
||||
|
||||
var gApp = null;
|
||||
var gPref = null;
|
||||
var gRDF = null;
|
||||
var gOS = null;
|
||||
@ -528,7 +527,7 @@ function getItemMetadata(aDS, aResult)
|
||||
}
|
||||
|
||||
// Target App Name and Version
|
||||
var appID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var appID = gApp.ID;
|
||||
|
||||
var targets = aDS.GetTargets(manifestRoot, gRDF.GetResource(EM_NS("targetApplication")), true);
|
||||
var idRes = gRDF.GetResource(EM_NS("id"));
|
||||
@ -1522,6 +1521,8 @@ nsThemeUninstaller.prototype = {
|
||||
//
|
||||
function nsExtensionManager()
|
||||
{
|
||||
gApp = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Components.interfaces.nsIXULAppInfo);
|
||||
gPref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gRDF = Components.classes["@mozilla.org/rdf/rdf-service;1"]
|
||||
@ -2022,7 +2023,7 @@ nsExtensionManager.prototype = {
|
||||
// and do version checking. Time hit here doesn't matter since this
|
||||
// doesn't happen all that often.
|
||||
this._ensureDS();
|
||||
var currAppID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var currAppID = gApp.ID;
|
||||
var items = this._ds.getIncompatibleItemList(currAppID, currAppVersion,
|
||||
nsIUpdateItem.TYPE_ADDON);
|
||||
if (items.length > 0) {
|
||||
@ -2186,7 +2187,7 @@ nsExtensionManager.prototype = {
|
||||
var compat = getFile(KEY_PROFILEDIR, [FILE_COMPAT_MANIFEST]);
|
||||
fos.init(compat, MODE_WRONLY | MODE_CREATE | MODE_TRUNCATE, 0644, 0);
|
||||
|
||||
var currAppBuildID = gPref.getCharPref(PREF_EM_APP_BUILDID);
|
||||
var currAppBuildID = gApp.appBuildID;
|
||||
|
||||
var val = aComponentListUpdated ? 1 : 0;
|
||||
var lines = ["[Compatibility]\r\n",
|
||||
@ -2633,7 +2634,7 @@ nsExtensionManager.prototype = {
|
||||
|
||||
update: function nsExtensionManager_update (aItems, aItemCount, aVersionUpdateOnly)
|
||||
{
|
||||
var appID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var appID = gApp.ID;
|
||||
var appVersion = gPref.getCharPref(PREF_EM_APP_EXTENSIONS_VERSION);
|
||||
|
||||
if (aItems.length == 0) {
|
||||
@ -3429,7 +3430,7 @@ nsExtensionsDataSource.prototype = {
|
||||
return true;
|
||||
|
||||
var appVersion = gPref.getCharPref(PREF_EM_APP_EXTENSIONS_VERSION);
|
||||
var appID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var appID = gApp.ID;
|
||||
|
||||
var targets = aDS.GetTargets(aSource, this._emR("targetApplication"), true);
|
||||
var idRes = this._emR("id");
|
||||
@ -3606,7 +3607,7 @@ nsExtensionsDataSource.prototype = {
|
||||
return { minVersion: ver, maxVersion: ver };
|
||||
}
|
||||
|
||||
var appID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var appID = gApp.ID;
|
||||
var r = gRDF.GetResource(getItemPrefix(aType) + aExtensionID);
|
||||
var targetApps = aDataSource.GetTargets(r, this._emR("targetApplication"), true);
|
||||
if (!targetApps.hasMoreElements()) {
|
||||
@ -3639,7 +3640,7 @@ nsExtensionsDataSource.prototype = {
|
||||
if (!targetDataSource)
|
||||
targetDataSource = this;
|
||||
|
||||
var appID = gPref.getCharPref(PREF_EM_APP_ID);
|
||||
var appID = gApp.ID;
|
||||
var r = gRDF.GetResource(getItemPrefix(aType) + aExtensionID);
|
||||
var targetApps = targetDataSource.GetTargets(r, this._emR("targetApplication"), true);
|
||||
if (!targetApps.hasMoreElements()) {
|
||||
|
||||
@ -7,12 +7,16 @@ function nsRDFItemUpdater(aClientOS, aChromeLocale){
|
||||
this._os = Components.classes["@mozilla.org/observer-service;1"]
|
||||
.getService(Components.interfaces.nsIObserverService);
|
||||
|
||||
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
this.appID = prefBranch.getCharPref("app.id");
|
||||
this.buildID = prefBranch.getCharPref("app.build_id");
|
||||
var app = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Components.interfaces.nsIXULAppInfo);
|
||||
this.appID = app.ID;
|
||||
this.buildID = app.geckoBuildID;
|
||||
|
||||
this.clientOS = aClientOS;
|
||||
this.chromeLocale = aChromeLocale;
|
||||
|
||||
var prefBranch = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
this.dsURI = prefBranch.getComplexValue("pfs.datasource.url",
|
||||
Components.interfaces.nsIPrefLocalizedString).data;
|
||||
}
|
||||
|
||||
@ -478,10 +478,13 @@ nsPluginInstallerWizard.prototype.showPluginResults = function (){
|
||||
|
||||
document.getElementById("pluginSummaryRestartNeeded").hidden = !needsRestart;
|
||||
|
||||
var app = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Components.interfaces.nsIXULAppInfo);
|
||||
|
||||
// set the get more info link to contain the mimetypes we couldn't install.
|
||||
notInstalledList +=
|
||||
"&appID=" + this.getPrefBranch().getCharPref("app.id") +
|
||||
"&appVersion=" + this.getPrefBranch().getCharPref("app.build_id") +
|
||||
"&appID=" + app.ID +
|
||||
"&appVersion=" + app.geckoBuildID +
|
||||
"&clientOS=" + this.getOS() +
|
||||
"&chromeLocale=" + this.getChromeLocale();
|
||||
|
||||
|
||||
@ -43,7 +43,6 @@ const nsIUpdateItem = Components.interfaces.nsIUpdateItem;
|
||||
const nsIUpdateService = Components.interfaces.nsIUpdateService;
|
||||
const nsIExtensionManager = Components.interfaces.nsIExtensionManager;
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_UPDATE_APP_UPDATESAVAILABLE = "app.update.updatesAvailable";
|
||||
const PREF_UPDATE_APP_PERFORMED = "app.update.performed";
|
||||
|
||||
|
||||
@ -35,8 +35,6 @@
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const PREF_APP_ID = "app.id";
|
||||
const PREF_APP_VERSION = "app.version";
|
||||
const PREF_UPDATE_APP_ENABLED = "app.update.enabled";
|
||||
const PREF_UPDATE_APP_AUTOUPDATEENABLED = "app.update.autoUpdateEnabled";
|
||||
const PREF_UPDATE_APP_URI = "app.update.url";
|
||||
@ -109,12 +107,15 @@ function stackTrace(aArguments, aMaxCount)
|
||||
dump("==================================================================\n");
|
||||
}
|
||||
|
||||
var gApp = null;
|
||||
var gPref = null;
|
||||
var gOS = null;
|
||||
var gRDF = null;
|
||||
|
||||
function nsUpdateService()
|
||||
{
|
||||
gApp = Components.classes["@mozilla.org/xre/app-info;1"]
|
||||
.getService(Components.interfaces.nsIXULAppInfo);
|
||||
gPref = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gOS = Components.classes["@mozilla.org/observer-service;1"]
|
||||
@ -755,8 +756,8 @@ nsAppUpdater.prototype = {
|
||||
//
|
||||
onDatasourceLoaded: function nsAppUpdater_onDatasourceLoaded (aDataSource)
|
||||
{
|
||||
var appID = gPref.getCharPref(PREF_APP_ID);
|
||||
var appVersion = gPref.getCharPref(PREF_APP_VERSION);
|
||||
var appID = gApp.ID;
|
||||
var appVersion = gApp.version;
|
||||
|
||||
var appResource = gRDF.GetResource("urn:mozilla:app:" + appID);
|
||||
var updatesArc = gRDF.GetResource(APP_NS("updates"));
|
||||
|
||||
@ -382,7 +382,7 @@ CheckArg(const char* aArg, const char **aParam = nsnull)
|
||||
static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
{
|
||||
static char vendor[256], name[256], version[32], buildID[32], copyright[512];
|
||||
static nsXREAppData data = { vendor, name, version, buildID, copyright, 0 };
|
||||
static nsXREAppData data = { vendor, name, version, buildID, {0,0,0,{0,0,0,0,0,0,0,0}}, copyright, 0 };
|
||||
|
||||
nsCOMPtr<nsILocalFile> lf;
|
||||
NS_GetFileFromPath(appDataFile, getter_AddRefs(lf));
|
||||
@ -401,6 +401,15 @@ static const nsXREAppData* LoadAppData(const char* appDataFile)
|
||||
return nsnull;
|
||||
}
|
||||
|
||||
// Read the app ID, if specified
|
||||
char id[38] = "";
|
||||
rv = parser.GetString("App", "ID", id, sizeof(id));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
if(!data.id.Parse(id)) {
|
||||
memset(&data.id, 0, sizeof(data.id));
|
||||
}
|
||||
}
|
||||
|
||||
PRUint32 i;
|
||||
|
||||
// Read string-valued fields
|
||||
@ -886,6 +895,18 @@ nsXULAppInfo::GetName(nsACString& aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetID(nsID** aResult)
|
||||
{
|
||||
*aResult = (nsID*) NS_Alloc(sizeof(nsID));
|
||||
if (!*aResult)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
**aResult = gAppData->id;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsXULAppInfo::GetVersion(nsACString& aResult)
|
||||
{
|
||||
|
||||
@ -65,6 +65,11 @@ interface nsIXULAppInfo : nsISupports
|
||||
*/
|
||||
readonly attribute ACString version;
|
||||
|
||||
/**
|
||||
* The application GUID.
|
||||
*/
|
||||
readonly attribute nsIDPtr ID;
|
||||
|
||||
/**
|
||||
* The build ID/date of the application. For xulrunner applications,
|
||||
* this will be different than the build ID of gecko. Be careful
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
#define _nsXULAppAPI_h__
|
||||
|
||||
#include "prtypes.h"
|
||||
#include "nsID.h"
|
||||
|
||||
/**
|
||||
* This API is "not even kinda frozen yet"
|
||||
@ -91,6 +92,12 @@ struct nsXREAppData
|
||||
*/
|
||||
const char *appBuildID;
|
||||
|
||||
/**
|
||||
* The application's UUID. Used by the extension manager to determine
|
||||
* compatible extensions.
|
||||
*/
|
||||
nsID id;
|
||||
|
||||
/**
|
||||
* The copyright information to print for the -h commandline flag,
|
||||
* e.g. "Copyright (c) 2003 mozilla.org".
|
||||
|
||||
@ -4,6 +4,11 @@ Name=Simple
|
||||
Version=0.1.0
|
||||
BuildID=BUILD_ID
|
||||
Copyright=Copyright (c) 2004 Mozilla.org
|
||||
# This ID is just an example. Every XUL app ought to have
|
||||
# it's own unique ID. You can use the microsoft "guidgen"
|
||||
# or "uuidgen" tools, or go on irc.mozilla.org and
|
||||
# /msg botbot uuid
|
||||
ID={3aea3f07-ffe3-4060-bb03-bff3a5365e90}
|
||||
|
||||
[XRE]
|
||||
Version=0.1
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user