Bug 704230 - Use nsXREAppData instead of extracting and reading back in files. r=blassey
☠☠ backed out by 243515ec2ad3 ☠ ☠
authorDoug Turner <dougt@dougt.org>
Mon, 21 Nov 2011 11:40:20 -0800
changeset 80628 8ceaedf06a576d3f02365968aa5c3e2f86c38141
parent 80627 f67977dea071caf9ebd77bd32e9f3cb705e86755
child 80629 243515ec2ad3f24dfcebc7c319ee4505ded068d4
push id3536
push userbmo@edmorley.co.uk
push dateTue, 22 Nov 2011 15:06:25 +0000
treeherdermozilla-inbound@6f998cc964be [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersblassey
bugs704230
milestone11.0a1
first release with
nightly linux32
8ceaedf06a57 / 11.0a1 / 20111122030949 / files
nightly linux64
8ceaedf06a57 / 11.0a1 / 20111122030949 / files
nightly mac
8ceaedf06a57 / 11.0a1 / 20111122030949 / files
nightly win32
8ceaedf06a57 / 11.0a1 / 20111122030949 / files
nightly win64
8ceaedf06a57 / 11.0a1 / 20111122030949 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 704230 - Use nsXREAppData instead of extracting and reading back in files. r=blassey
toolkit/xre/Makefile.in
toolkit/xre/nsAndroidStartup.cpp
--- a/toolkit/xre/Makefile.in
+++ b/toolkit/xre/Makefile.in
@@ -246,20 +246,30 @@ endif
 endif
 
 # Solaris /usr/bin/diff doesn't have -n option
 GRE_MILESTONE := $(shell tail -n 1 $(topsrcdir)/config/milestone.txt 2>/dev/null || tail -1 $(topsrcdir)/config/milestone.txt)
 GRE_BUILDID := $(shell cat $(DEPTH)/config/buildid)
  
 DEFINES += -DGRE_MILESTONE=$(GRE_MILESTONE) -DGRE_BUILDID=$(GRE_BUILDID)
 
+ifdef MOZILLA_OFFICIAL
+DEFINES += -DMOZILLA_OFFICIAL
+endif
+
+DEFINES += -DAPP_VERSION=$(MOZ_APP_VERSION)
+
 DEFINES += -DAPP_ID=$(MOZ_APP_ID)
 
 $(srcdir)/nsAppRunner.cpp: $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
 
+ifeq ($(OS_TARGET),Android)
+nsAndroidStartup.o: $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
+endif
+
 platform.ini: FORCE
 	$(PYTHON) $(srcdir)/make-platformini.py --buildid=$(shell cat $(DEPTH)/config/buildid) $(INIARGS) $(topsrcdir)/config/milestone.txt > $@
 
 GARBAGE += platform.ini
 
 libs:: platform.ini
 	$(INSTALL) $^ $(DIST)/bin
 
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -52,16 +52,19 @@
 #include "nsILocalFile.h"
 #include "nsAppRunner.h"
 #include "AndroidBridge.h"
 #include "APKOpen.h"
 #include "nsExceptionHandler.h"
 
 #define LOG(args...) __android_log_print(ANDROID_LOG_INFO, MOZ_APP_NAME, args)
 
+#define _STR(s) # s
+#define STR(s) _STR(s)
+
 struct AutoAttachJavaThread {
     AutoAttachJavaThread() {
         attached = mozilla_AndroidBridge_SetMainThread((void*)pthread_self());
     }
     ~AutoAttachJavaThread() {
         mozilla_AndroidBridge_SetMainThread(nsnull);
         attached = false;
     }
@@ -92,55 +95,57 @@ GeckoStart(void *data)
 
     nsresult rv;
     nsCOMPtr<nsILocalFile> appini;
     char* greHome = getenv("GRE_HOME");
     if (!greHome) {
         LOG("Failed to get GRE_HOME from the env vars");
         return 0;
     }
-    nsCAutoString appini_path(greHome);
-    appini_path.AppendLiteral("/application.ini");
-    rv = NS_NewNativeLocalFile(appini_path, false, getter_AddRefs(appini));
-    if (NS_FAILED(rv)) {
-        LOG("Failed to create nsILocalFile for appdata\n");
-        return 0;
-    }
-
-    nsXREAppData *appData;
-    rv = XRE_CreateAppData(appini, &appData);
-    if (NS_FAILED(rv)) {
-        LOG("Failed to load application.ini from %s\n", appini_path.get());
-        return 0;
-    }
 
     nsCOMPtr<nsILocalFile> xreDir;
     rv = NS_NewNativeLocalFile(nsDependentCString(greHome), false, getter_AddRefs(xreDir));
     if (NS_FAILED(rv)) {
         LOG("Failed to create nsIFile for xreDirectory");
         return 0;
     }
 
-    appData->xreDirectory = xreDir.get();
+    nsXREAppData appData = {
+        sizeof(nsXREAppData),
+        xreDir.get(),
+        "Mozilla",
+        "Fennec",
+        STR(APP_VERSION),
+        STR(GRE_BUILDID),
+        STR(APP_ID),
+        NULL,
+#ifdef MOZILLA_OFFICIAL
+        NS_XRE_ENABLE_EXTENSION_MANAGER | NS_XRE_ENABLE_CRASH_REPORTER,
+#else
+        NS_XRE_ENABLE_EXTENSION_MANAGER,
+#endif
+        xreDir.get(),
+        STR(GRE_MILESTONE),
+        STR(GRE_MILESTONE),
+        "https://crash-reports.mozilla.com/submit"
+    };
 
     nsTArray<char *> targs;
     char *arg = strtok(static_cast<char *>(data), " ");
     while (arg) {
         targs.AppendElement(arg);
         arg = strtok(NULL, " ");
     }
     targs.AppendElement(static_cast<char *>(nsnull));
 
-    int result = XRE_main(targs.Length() - 1, targs.Elements(), appData);
+    int result = XRE_main(targs.Length() - 1, targs.Elements(), &appData);
 
     if (result)
         LOG("XRE_main returned %d", result);
 
-    XRE_FreeAppData(appData);
-
     mozilla::AndroidBridge::Bridge()->NotifyXreExit();
 
     free(targs[0]);
     nsMemory::Free(data);
     return 0;
 }
 
 extern "C" NS_EXPORT void JNICALL