Bug 972555 - Add more things to nsIXULRuntime so we can avoid preprocessing some tests. r=bsmedberg
authorTed Mielczarek <ted@mielczarek.org>
Wed, 19 Feb 2014 09:20:02 -0500
changeset 170796 a34e6d5519efea358caaf9daf8555b04443539eb
parent 170795 758c586cde7ab578857d1ec8ee5ca8ec74fdbc56
child 170797 c3b332620bb61c4d30eb53175e5149c5ac02cddb
push id270
push userpvanderbeken@mozilla.com
push dateThu, 06 Mar 2014 09:24:21 +0000
reviewersbsmedberg
bugs972555
milestone30.0a1
Bug 972555 - Add more things to nsIXULRuntime so we can avoid preprocessing some tests. r=bsmedberg
toolkit/xre/nsAppRunner.cpp
xpcom/system/nsIXULRuntime.idl
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -861,16 +861,52 @@ nsXULAppInfo::GetLastRunCrashID(nsAStrin
 #ifdef MOZ_CRASHREPORTER
   CrashReporter::GetLastRunCrashID(aLastRunCrashID);
   return NS_OK;
 #else
   return NS_ERROR_NOT_IMPLEMENTED;
 #endif
 }
 
+NS_IMETHODIMP
+nsXULAppInfo::GetIsReleaseBuild(bool* aResult)
+{
+#ifdef RELEASE_BUILD
+  *aResult = true;
+#else
+  *aResult = false;
+#endif
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsXULAppInfo::GetIsOfficialBranding(bool* aResult)
+{
+#ifdef MOZ_OFFICIAL_BRANDING
+  *aResult = true;
+#else
+  *aResult = false;
+#endif
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsXULAppInfo::GetDefaultUpdateChannel(nsACString& aResult)
+{
+  aResult.AssignLiteral(NS_STRINGIFY(MOZ_UPDATE_CHANNEL));
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsXULAppInfo::GetDistributionID(nsACString& aResult)
+{
+  aResult.AssignLiteral(MOZ_DISTRIBUTION_ID);
+  return NS_OK;
+}
+
 #ifdef XP_WIN
 // Matches the enum in WinNT.h for the Vista SDK but renamed so that we can
 // safely build with the Vista SDK and without it.
 typedef enum 
 {
   VistaTokenElevationTypeDefault = 1,
   VistaTokenElevationTypeFull,
   VistaTokenElevationTypeLimited
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -15,17 +15,17 @@ bool BrowserTabsRemote();
 
 /**
  * Provides information about the XUL runtime.
  * @status UNSTABLE - This interface is not frozen and will probably change in
  *                    future releases. If you need this functionality to be
  *                    stable/frozen, please contact Benjamin Smedberg.
  */
 
-[scriptable, uuid(33bd1630-611e-11e3-949a-0800200c9a66)]
+[scriptable, uuid(ef6df588-f0bf-4e38-949e-9de838c228ea)]
 interface nsIXULRuntime : nsISupports
 {
   /**
    * Whether the application was launched in safe mode.
    */
   readonly attribute boolean inSafeMode;
 
   /**
@@ -105,9 +105,29 @@ interface nsIXULRuntime : nsISupports
    */
   readonly attribute PRTime replacedLockTime;
 
   /**
    * Local ID of the minidump generated when the process crashed
    * on the previous run. Can be passed directly to CrashSubmit.submit.
    */
   readonly attribute DOMString lastRunCrashID;
+
+  /**
+   * True if this is a RELEASE_BUILD.
+   */
+  readonly attribute boolean isReleaseBuild;
+
+  /**
+   * True if this build uses official branding (MOZ_OFFICIAL_BRANDING).
+   */
+  readonly attribute boolean isOfficialBranding;
+
+  /**
+   * The default update channel (MOZ_UPDATE_CHANNEL).
+   */
+  readonly attribute AUTF8String defaultUpdateChannel;
+
+  /**
+   * The distribution ID for this build (MOZ_DISTRIBUTION_ID).
+   */
+  readonly attribute AUTF8String distributionID;
 };