Bug 1153978 - Part 0: Separate nsIPlatformInfo from nsIXULAppInfo. r=jst,gps
authorTooru Fujisawa <arai_a@mac.com>
Thu, 04 Feb 2016 06:12:45 +0900
changeset 289777 89d44b4257f1896af77af5940f6cb4787f7b8252
parent 289776 0fedfd441a069e78ec363115d94b7da4c4547346
child 289778 f22eed4b7a39beeff05a30670e8339c3e29c8146
push id30110
push userkwierso@gmail.com
push dateTue, 22 Mar 2016 23:45:51 +0000
treeherdermozilla-central@3381aa98edf7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst, gps
bugs1153978
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1153978 - Part 0: Separate nsIPlatformInfo from nsIXULAppInfo. r=jst,gps
testing/modules/AppInfo.jsm
toolkit/xre/nsAppRunner.cpp
xpcom/system/moz.build
xpcom/system/nsIPlatformInfo.idl
xpcom/system/nsIXULAppInfo.idl
--- a/testing/modules/AppInfo.jsm
+++ b/testing/modules/AppInfo.jsm
@@ -10,16 +10,19 @@ this.EXPORTED_SYMBOLS = [
   "updateAppInfo",
 ];
 
 
 const {classes: Cc, interfaces: Ci, results: Cr, utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
+let origPlatformInfo = Cc["@mozilla.org/xre/app-info;1"]
+    .getService(Ci.nsIPlatformInfo);
+
 /**
  * Create new XULAppInfo instance with specified options.
  *
  * options is a object with following keys:
  *   ID:              nsIXULAppInfo.ID
  *   name:            nsIXULAppInfo.name
  *   version:         nsIXULAppInfo.version
  *   platformVersion: nsIXULAppInfo.platformVersion
@@ -39,33 +42,36 @@ this.newAppInfo = function (options={}) 
 
   let appInfo = {
     // nsIXULAppInfo
     vendor: "Mozilla",
     name: name,
     ID: ID,
     version: version,
     appBuildID: "20160315",
+
+    // nsIPlatformInfo
     platformVersion: platformVersion,
-    platformBuildID: "20160316",
+    platformBuildID: origPlatformInfo.platformBuildID,
 
     // nsIXULRuntime
     inSafeMode: false,
     logConsoleErrors: true,
     OS: OS,
     XPCOMABI: "noarch-spidermonkey",
     invalidateCachesOnRestart() {},
 
     // nsIWinAppHelper
     get userCanElevate() {
       return false;
     },
   };
 
   let interfaces = [Ci.nsIXULAppInfo,
+                    Ci.nsIPlatformInfo,
                     Ci.nsIXULRuntime];
   if ("nsIWinAppHelper" in Ci) {
     interfaces.push(Ci.nsIWinAppHelper);
   }
 
   if ("crashReporter" in options && options.crashReporter) {
     // nsICrashReporter
     appInfo.annotations = {};
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -63,16 +63,17 @@
 #include "nsIConsoleService.h"
 #include "nsIContentHandler.h"
 #include "nsIDialogParamBlock.h"
 #include "nsIDOMWindow.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsIIOService2.h"
 #include "nsIObserverService.h"
 #include "nsINativeAppSupport.h"
+#include "nsIPlatformInfo.h"
 #include "nsIProcess.h"
 #include "nsIProfileUnlocker.h"
 #include "nsIPromptService.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIToolkitChromeRegistry.h"
 #include "nsIToolkitProfile.h"
@@ -741,16 +742,17 @@ class nsXULAppInfo : public nsIXULAppInf
                      public nsIFinishDumpingCallback,
 #endif
                      public nsIXULRuntime
 
 {
 public:
   MOZ_CONSTEXPR nsXULAppInfo() {}
   NS_DECL_ISUPPORTS_INHERITED
+  NS_DECL_NSIPLATFORMINFO
   NS_DECL_NSIXULAPPINFO
   NS_DECL_NSIXULRUNTIME
   NS_DECL_NSIOBSERVER
 #ifdef MOZ_CRASHREPORTER
   NS_DECL_NSICRASHREPORTER
   NS_DECL_NSIFINISHDUMPINGCALLBACK
 #endif
 #ifdef XP_WIN
@@ -764,17 +766,18 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
 #ifdef XP_WIN
   NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
 #endif
 #ifdef MOZ_CRASHREPORTER
   NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
   NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback)
 #endif
-  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData || 
+  NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo)
+  NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData ||
                                      XRE_IsContentProcess())
 NS_INTERFACE_MAP_END
 
 NS_IMETHODIMP_(MozExternalRefCountType)
 nsXULAppInfo::AddRef()
 {
   return 1;
 }
--- a/xpcom/system/moz.build
+++ b/xpcom/system/moz.build
@@ -9,16 +9,17 @@ XPIDL_SOURCES += [
     'nsIDeviceSensors.idl',
     'nsIExternalApplication.idl',
     'nsIGConfService.idl',
     'nsIGeolocationProvider.idl',
     'nsIGIOService.idl',
     'nsIGSettingsService.idl',
     'nsIHapticFeedback.idl',
     'nsIPackageKitService.idl',
+    'nsIPlatformInfo.idl',
     'nsIXULAppInfo.idl',
     'nsIXULRuntime.idl',
 ]
 
 if CONFIG['MOZ_CRASHREPORTER']:
     XPIDL_SOURCES += [
         'nsICrashReporter.idl',
     ]
new file mode 100644
--- /dev/null
+++ b/xpcom/system/nsIPlatformInfo.idl
@@ -0,0 +1,19 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(ab6650cf-0806-4aea-b8f2-40fdae74f1cc)]
+interface nsIPlatformInfo : nsISupports
+{
+  /**
+   * The version of the XULRunner platform.
+   */
+  readonly attribute ACString platformVersion;
+
+  /**
+   * The build ID/date of gecko and the XULRunner platform.
+   */
+  readonly attribute ACString platformBuildID;
+};
--- a/xpcom/system/nsIXULAppInfo.idl
+++ b/xpcom/system/nsIXULAppInfo.idl
@@ -1,21 +1,21 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "nsISupports.idl"
+#include "nsIPlatformInfo.idl"
 
 /**
  * A scriptable interface to the nsXULAppAPI structure. See nsXULAppAPI.h for
  * a detailed description of each attribute.
  */
 
-[scriptable, uuid(1518e7d2-022a-4dae-b02e-bbe7ffcf2145)]
-interface nsIXULAppInfo : nsISupports
+[scriptable, uuid(ddea4f31-3c5e-4769-ac68-21ab4b3d7845)]
+interface nsIXULAppInfo : nsIPlatformInfo
 {
   /**
    * @see nsXREAppData.vendor
    * @returns an empty string if nsXREAppData.vendor is not set.
    */
   readonly attribute ACString vendor;
 
   /**
@@ -41,23 +41,13 @@ interface nsIXULAppInfo : nsISupports
   /**
    * The build ID/date of the application. For xulrunner applications,
    * this will be different than the build ID of the platform. Be careful
    * about which one you want.
    */
   readonly attribute ACString appBuildID;
 
   /**
-   * The version of the XULRunner platform.
-   */
-  readonly attribute ACString platformVersion;
-
-  /**
-   * The build ID/date of gecko and the XULRunner platform.
-   */
-  readonly attribute ACString platformBuildID;
-  
-  /**
    * @see nsXREAppData.UAName
    * @returns an empty string if nsXREAppData.UAName is not set.
    */
   readonly attribute ACString UAName;
 };