Bug 1067229 - allow nsIXULAppInfo::ID and ::Vendor to work in a content process. r=jdm
authorMark Hammond <mhammond@skippinet.com.au>
Wed, 24 Sep 2014 16:14:55 +1000
changeset 230083 7792d7f25f1e3d9388db85edf84fae398e0b3e51
parent 230082 3f2617daac82b98147351978cd85f2e278f88e96
child 230084 b9a5f66e33acd64706ac8a6807f4fab4043cc6d7
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdm
bugs1067229
milestone35.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 1067229 - allow nsIXULAppInfo::ID and ::Vendor to work in a content process. r=jdm
dom/ipc/ContentChild.cpp
dom/ipc/ContentChild.h
dom/ipc/ContentParent.cpp
dom/ipc/PContent.ipdl
toolkit/xre/nsAppRunner.cpp
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -1822,22 +1822,25 @@ PreloadSlowThings()
     nsLayoutStylesheetCache::UserContentSheet();
 
     TabChild::PreloadSlowThings();
 
 }
 
 bool
 ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
-                          const nsCString& name, const nsCString& UAName)
+                          const nsCString& name, const nsCString& UAName,
+                          const nsCString& ID, const nsCString& vendor)
 {
     mAppInfo.version.Assign(version);
     mAppInfo.buildID.Assign(buildID);
     mAppInfo.name.Assign(name);
     mAppInfo.UAName.Assign(UAName);
+    mAppInfo.ID.Assign(ID);
+    mAppInfo.vendor.Assign(vendor);
 
     if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
         return true;
     }
 
     // If we're part of the mozbrowser machinery, go ahead and start
     // preloading things.  We can only do this for mozbrowser because
     // PreloadSlowThings() may set the docshell of the first TabChild
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -65,16 +65,18 @@ public:
     NS_IMETHOD_(MozExternalRefCountType) Release(void) { return 1; }
 
     struct AppInfo
     {
         nsCString version;
         nsCString buildID;
         nsCString name;
         nsCString UAName;
+        nsCString ID;
+        nsCString vendor;
     };
 
     bool Init(MessageLoop* aIOLoop,
               base::ProcessHandle aParentHandle,
               IPC::Channel* aChannel);
     void InitProcessAttributes();
     void InitXPCOM();
 
@@ -292,17 +294,18 @@ public:
     virtual bool RecvFlushMemory(const nsString& reason) MOZ_OVERRIDE;
 
     virtual bool RecvActivateA11y() MOZ_OVERRIDE;
 
     virtual bool RecvGarbageCollect() MOZ_OVERRIDE;
     virtual bool RecvCycleCollect() MOZ_OVERRIDE;
 
     virtual bool RecvAppInfo(const nsCString& version, const nsCString& buildID,
-                             const nsCString& name, const nsCString& UAName) MOZ_OVERRIDE;
+                             const nsCString& name, const nsCString& UAName,
+                             const nsCString& ID, const nsCString& vendor) MOZ_OVERRIDE;
 
     virtual bool RecvLastPrivateDocShellDestroyed() MOZ_OVERRIDE;
 
     virtual bool RecvFilePathUpdate(const nsString& aStorageType,
                                     const nsString& aStorageName,
                                     const nsString& aPath,
                                     const nsCString& aReason) MOZ_OVERRIDE;
     virtual bool RecvFileSystemUpdate(const nsString& aFsName,
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -2039,19 +2039,21 @@ ContentParent::InitInternal(ProcessPrior
         chromeRegistry->SendRegisteredChrome(this);
     }
 
     if (gAppData) {
         nsCString version(gAppData->version);
         nsCString buildID(gAppData->buildID);
         nsCString name(gAppData->name);
         nsCString UAName(gAppData->UAName);
+        nsCString ID(gAppData->ID);
+        nsCString vendor(gAppData->vendor);
 
         // Sending all information to content process.
-        unused << SendAppInfo(version, buildID, name, UAName);
+        unused << SendAppInfo(version, buildID, name, UAName, ID, vendor);
     }
 
     nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
     if (sheetService) {
         // This looks like a lot of work, but in a normal browser session we just
         // send two loads.
 
         nsCOMArray<nsIStyleSheet>& agentSheets = *sheetService->AgentStyleSheets();
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -433,17 +433,18 @@ child:
     GarbageCollect();
     CycleCollect();
     
     /**
      * Start accessibility engine in content process.
      */
     ActivateA11y();
 
-    AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName);
+    AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
+            nsCString ID, nsCString vendor);
 
     // Notify child that last-pb-context-exited notification was observed
     LastPrivateDocShellDestroyed();
 
     FilePathUpdate(nsString storageType, nsString storageName, nsString filepath,
                    nsCString reasons);
 
     // Note: Any changes to this structure should also be changed in
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -664,17 +664,19 @@ nsXULAppInfo::Release()
 {
   return 1;
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetVendor(nsACString& aResult)
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
-    return NS_ERROR_NOT_AVAILABLE;
+    ContentChild* cc = ContentChild::GetSingleton();
+    aResult = cc->GetAppInfo().vendor;
+    return NS_OK;
   }
   aResult.Assign(gAppData->vendor);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetName(nsACString& aResult)
@@ -688,17 +690,19 @@ nsXULAppInfo::GetName(nsACString& aResul
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetID(nsACString& aResult)
 {
   if (XRE_GetProcessType() == GeckoProcessType_Content) {
-    return NS_ERROR_NOT_AVAILABLE;
+    ContentChild* cc = ContentChild::GetSingleton();
+    aResult = cc->GetAppInfo().ID;
+    return NS_OK;
   }
   aResult.Assign(gAppData->ID);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULAppInfo::GetVersion(nsACString& aResult)
@@ -4588,17 +4592,17 @@ mozilla::BrowserTabsRemoteAutostart()
   // If for any reason we suspect acceleration will be disabled, disabled
   // e10s auto start. (bug 1068199) THIS IS A TEMPORARY WORKAROUND.
   if (gBrowserTabsRemoteAutostart) {
     // Check prefs
     bool accelDisabled = Preferences::GetBool("layers.acceleration.disabled", false) &&
                          !Preferences::GetBool("layers.acceleration.force-enabled", false);
     // Check env flags
     if (!accelDisabled) {
-      const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
+      const char *acceleratedEnv = PR_GetEnv("MOZ_ACCELERATED");
       if (acceleratedEnv && (*acceleratedEnv != '0')) {
         accelDisabled = false;
       }
     }
 
 #if defined(XP_MACOSX)
     accelDisabled = !nsCocoaFeatures::AccelerateByDefault();
 #endif