Bug 620931 part 7 - Make startup cache generation work better with new omni.jar handling. r=mwu
authorMike Hommey <mh+mozilla@glandium.org>
Fri, 06 May 2011 11:26:30 +0200
changeset 69656 dec16a247230a9117fcbc4c8b5ada8bf2677643b
parent 69655 5a4b358de96f0fd0d62de0af56eade1747159eed
child 69665 4aad8ef5c011f47e9443ea9dba548fc2ba3c2b3c
push id20059
push usermh@glandium.org
push dateWed, 18 May 2011 05:33:55 +0000
treeherdermozilla-central@dec16a247230 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmwu
bugs620931
milestone6.0a1
first release with
nightly linux32
dec16a247230 / 6.0a1 / 20110518030622 / files
nightly linux64
dec16a247230 / 6.0a1 / 20110518030622 / files
nightly mac
dec16a247230 / 6.0a1 / 20110518030622 / files
nightly win32
dec16a247230 / 6.0a1 / 20110518030622 / files
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 620931 part 7 - Make startup cache generation work better with new omni.jar handling. r=mwu
browser/installer/Makefile.in
browser/installer/precompile_cache.js
--- a/browser/installer/Makefile.in
+++ b/browser/installer/Makefile.in
@@ -118,17 +118,17 @@ INSTALL_SDK = 1
 endif
 
 ifneq (1_,$(if $(CROSS_COMPILE),1,0)_$(UNIVERSAL_BINARY))
 ifdef RUN_TEST_PROGRAM
 _ABS_RUN_TEST_PROGRAM = $(call core_abspath,$(RUN_TEST_PROGRAM))
 endif
 
 GENERATE_CACHE = \
-  $(_ABS_RUN_TEST_PROGRAM) $(LIBXUL_DIST)/bin/xpcshell$(BIN_SUFFIX) -g "$$PWD" -f $(topsrcdir)/browser/installer/precompile_cache.js -e 'populate_startupcache("omni.jar", "startupCache.zip");' && \
+  $(_ABS_RUN_TEST_PROGRAM) $(LIBXUL_DIST)/bin/xpcshell$(BIN_SUFFIX) -g "$$PWD" -a "$$PWD" -f $(topsrcdir)/browser/installer/precompile_cache.js -e 'populate_startupcache("omni.jar", "startupCache.zip");' && \
   rm -rf jsloader && \
   $(UNZIP) startupCache.zip && \
   rm startupCache.zip && \
   find jsloader | xargs touch -t 201001010000 && \
   $(ZIP) -r9mX omni.jar jsloader
 endif
 
 include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
--- a/browser/installer/precompile_cache.js
+++ b/browser/installer/precompile_cache.js
@@ -60,33 +60,20 @@ function load(url) {
   } catch(e) {
     dump("Failed to import " + url + ":" + e + "\n");
   }
 }
 
 function load_entries(entries, prefix) {
   while (entries.hasMore()) {
     var c = entries.getNext();
-    // Required to ensure sync js is only loaded in load_custom_entries.
-    // That function loads the sync js with the right URIs.
-    if (c.indexOf("services-sync") >= 0)
-      continue;
-    if (c.indexOf("services-crypto") >= 0)
-      continue;
     load(prefix + c);
   }
 }
 
-function load_custom_entries(entries, subst) {
-  while (entries.hasMore()) {
-    var c = entries.getNext();
-    load("resource://" + subst + "/" + c.replace("modules/" + subst + "/", ""));
-  }
-}
-
 function getGreDir() {
   return Cc["@mozilla.org/file/directory_service;1"].
     getService(Ci.nsIProperties).get("GreD", Ci.nsIFile);
 }
 
 function openJar(file) {
   var zipreader = Cc["@mozilla.org/libjar/zip-reader;1"].
     createInstance(Ci.nsIZipReader);
@@ -98,32 +85,15 @@ function populate_startupcache(omnijarNa
   var file = getGreDir();
   file.append(omnijarName);
   zipreader = openJar(file);
 
   var scFile = getGreDir();
   scFile.append(startupcacheName);
   setenv("MOZ_STARTUP_CACHE", scFile.path);
 
-  // the sync part below doesn't work as smoothly
-  let ioService = Cc["@mozilla.org/network/io-service;1"].
-    getService(Ci.nsIIOService);
-  let uri = ioService.newURI("resource:///modules/services-sync/",
-                             null, null);
-  let resProt = ioService.getProtocolHandler("resource")
-    .QueryInterface(Ci.nsIResProtocolHandler);
-  resProt.setSubstitution("services-sync", uri);
+  let prefix = "resource:///";
 
-  uri = ioService.newURI("resource:///modules/services-crypto/",
-                         null, null);
-  resProt.setSubstitution("services-crypto", uri);
-
-  load_entries(zipreader.findEntries("components/*js"), "resource://gre/");
-
-  load_custom_entries(zipreader.findEntries("modules/services-sync/*js"),
-                      "services-sync");
-  load_custom_entries(zipreader.findEntries("modules/services-crypto/*js"),
-                      "services-crypto");
-
-  load_entries(zipreader.findEntries("modules/*js"), "resource://gre/");
-  load_entries(zipreader.findEntries("modules/*jsm"), "resource://gre/");
+  load_entries(zipreader.findEntries("components/*js"), prefix);
+  load_entries(zipreader.findEntries("modules/*js"), prefix);
+  load_entries(zipreader.findEntries("modules/*jsm"), prefix);
   zipreader.close();
 }