зеркало из https://github.com/mozilla/gecko-dev.git
fix for bug #341190
Software update should forward information about specific operating system version. r=darin
This commit is contained in:
Родитель
e064fc9e40
Коммит
7ce269136a
|
@ -101,7 +101,7 @@ pref("app.update.mode", 1);
|
|||
pref("app.update.silent", false);
|
||||
|
||||
// Update service URL:
|
||||
pref("app.update.url", "https://aus2.mozilla.org/update/1/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/update.xml");
|
||||
pref("app.update.url", "https://aus2.mozilla.org/update/2/%PRODUCT%/%VERSION%/%BUILD_ID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/update.xml");
|
||||
// URL user can browse to manually if for some reason all update installation
|
||||
// attempts fail. TODO: Change this URL
|
||||
pref("app.update.url.manual", "http://www.mozilla.org/products/firefox/");
|
||||
|
|
|
@ -119,6 +119,7 @@ const Node = Components.interfaces.nsIDOMNode;
|
|||
var gApp = null;
|
||||
var gPref = null;
|
||||
var gABI = null;
|
||||
var gOSVersion = null;
|
||||
var gConsole = null;
|
||||
var gLogEnabled = { };
|
||||
|
||||
|
@ -905,6 +906,18 @@ function UpdateService() {
|
|||
LOG("UpdateService", "XPCOM ABI unknown: updates are not possible.");
|
||||
}
|
||||
|
||||
try {
|
||||
var sysInfo =
|
||||
Components.classes["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2);
|
||||
|
||||
gOSVersion = encodeURIComponent(sysInfo.getProperty("name") + " " +
|
||||
sysInfo.getProperty("version"));
|
||||
}
|
||||
catch (e) {
|
||||
LOG("UpdateService", "OS Version unknown: updates are not possible.");
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
// Mac universal build should report a different ABI than either macppc
|
||||
// or mactel.
|
||||
|
@ -1368,6 +1381,10 @@ UpdateService.prototype = {
|
|||
if (!gABI)
|
||||
return false;
|
||||
|
||||
// If we don't know the OS version we're updating, we can't update.
|
||||
if (!gOSVersion)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -1749,6 +1766,7 @@ Checker.prototype = {
|
|||
url = url.replace(/%VERSION%/g, gApp.version);
|
||||
url = url.replace(/%BUILD_ID%/g, gApp.appBuildID);
|
||||
url = url.replace(/%BUILD_TARGET%/g, gApp.OS + "_" + gABI);
|
||||
url = url.replace(/%OS_VERSION%/g, gOSVersion);
|
||||
url = url.replace(/%LOCALE%/g, getLocale());
|
||||
url = url.replace(/%CHANNEL%/g, getUpdateChannel());
|
||||
url = url.replace(/\+/g, "%2B");
|
||||
|
|
|
@ -63,6 +63,7 @@ CPPSRCS = \
|
|||
nsTraceRefcntImpl.cpp \
|
||||
nsInterfaceRequestorAgg.cpp \
|
||||
nsUUIDGenerator.cpp \
|
||||
nsSystemInfo.cpp \
|
||||
$(NULL)
|
||||
|
||||
ifdef GC_LEAK_DETECTOR
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** 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 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
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@mozilla.org> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of 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"),
|
||||
* 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
|
||||
* 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
|
||||
* 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
|
||||
* 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 ***** */
|
||||
|
||||
#include "nsSystemInfo.h"
|
||||
#include "prsystem.h"
|
||||
#include "nsString.h"
|
||||
|
||||
nsSystemInfo::nsSystemInfo()
|
||||
{
|
||||
}
|
||||
|
||||
nsSystemInfo::~nsSystemInfo()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsSystemInfo::Init()
|
||||
{
|
||||
nsresult rv = nsHashPropertyBag::Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
static const struct {
|
||||
PRSysInfo cmd;
|
||||
const char *name;
|
||||
} items[] = {
|
||||
{ PR_SI_SYSNAME, "name" },
|
||||
{ PR_SI_HOSTNAME, "host" },
|
||||
{ PR_SI_ARCHITECTURE, "arch" },
|
||||
{ PR_SI_RELEASE, "version" }
|
||||
};
|
||||
|
||||
for (PRUint32 i = 0; i < (sizeof(items) / sizeof(items[0])); i++) {
|
||||
char buf[SYS_INFO_BUFFER_LENGTH];
|
||||
if (PR_GetSystemInfo(items[i].cmd, buf, sizeof(buf)) == PR_SUCCESS) {
|
||||
rv = SetPropertyAsACString(NS_ConvertASCIItoUTF16(items[i].name),
|
||||
nsDependentCString(buf));
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
}
|
||||
else
|
||||
NS_WARNING("PR_GetSystemInfo failed");
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* -*- Mode: C++; tab-width: 50; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
|
@ -15,12 +15,12 @@
|
|||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* mozilla.org
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Mike Shaver <shaver@mozilla.org>
|
||||
* Seth Spitzer <sspitzer@mozilla.org> (original author)
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
|
@ -36,27 +36,25 @@
|
|||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#ifndef _NSSYSTEMINFO_H_
|
||||
#define _NSSYSTEMINFO_H_
|
||||
|
||||
/**
|
||||
* System information service.
|
||||
*
|
||||
* At present, a thin wrapper around PR_GetSystemInfo.
|
||||
*/
|
||||
#include "nsHashPropertyBag.h"
|
||||
|
||||
[scriptable,uuid(4189b420-1dd2-11b2-bff7-daaf5c1f7b10)]
|
||||
interface nsISystemInfo : nsISupports
|
||||
{
|
||||
/** The system hostname. */
|
||||
readonly attribute string hostname;
|
||||
class nsSystemInfo : public nsHashPropertyBag {
|
||||
public:
|
||||
nsSystemInfo();
|
||||
|
||||
/** The operating system name. */
|
||||
readonly attribute string OSName;
|
||||
nsresult Init();
|
||||
|
||||
/** The operating system version. */
|
||||
readonly attribute string OSVersion;
|
||||
|
||||
/** The processor architecture of the machine. */
|
||||
readonly attribute string architecture;
|
||||
private:
|
||||
~nsSystemInfo();
|
||||
};
|
||||
|
||||
#define NS_SYSTEMINFO_CONTRACTID "@mozilla.org/system-info;1"
|
||||
#define NS_SYSTEMINFO_CLASSNAME "System Info Service"
|
||||
#define NS_SYSTEMINFO_CID \
|
||||
{ 0xd962398a, 0x99e5, 0x49b2, \
|
||||
{ 0x85, 0x7a, 0xc1, 0x59, 0x04, 0x9c, 0x7f, 0x6c } }
|
||||
|
||||
#endif /* _NSSYSTEMINFO_H_ */
|
|
@ -136,6 +136,8 @@ NS_DECL_CLASSINFO(nsStringInputStream)
|
|||
#include "nsMacUtilsImpl.h"
|
||||
#endif
|
||||
|
||||
#include "nsSystemInfo.h"
|
||||
|
||||
#include <locale.h>
|
||||
|
||||
// Registry Factory creation function defined in nsRegistry.cpp
|
||||
|
@ -225,6 +227,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsUUIDGenerator, Init)
|
|||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacUtilsImpl)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSystemInfo, Init)
|
||||
|
||||
static NS_METHOD
|
||||
nsThreadManagerGetSingleton(nsISupports* outer,
|
||||
const nsIID& aIID,
|
||||
|
@ -438,6 +442,8 @@ static const nsModuleComponentInfo components[] = {
|
|||
#ifdef XP_MACOSX
|
||||
COMPONENT(MACUTILSIMPL, nsMacUtilsImplConstructor),
|
||||
#endif
|
||||
|
||||
COMPONENT(SYSTEMINFO, nsSystemInfoConstructor),
|
||||
};
|
||||
|
||||
#undef COMPONENT
|
||||
|
|
Загрузка…
Ссылка в новой задаче