Bug 889696 - Catch exception occuring while updating 3rd party apps on booting. r=fabrice
authorChangbin Park <changbin.park@lge.com>
Mon, 15 Jul 2013 09:53:41 +0900
changeset 151515 2245d28611d679608519d9a18740737a8e84d2d6
parent 151514 e7938a3a8acca76fd32eb7a2da28efa7ccfa849b
child 151516 424edce8ad29ac522af2301c2c7ed94b80b435bf
push id2859
push userakeybl@mozilla.com
push dateMon, 16 Sep 2013 19:14:59 +0000
treeherdermozilla-beta@87d3c51cd2bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfabrice
bugs889696
milestone25.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 889696 - Catch exception occuring while updating 3rd party apps on booting. r=fabrice
dom/apps/src/Webapps.jsm
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -298,16 +298,19 @@ this.DOMApplicationRegistry = {
   installPreinstalledApp: function installPreinstalledApp(aId) {
 #ifdef MOZ_WIDGET_GONK
     let app = this.webapps[aId];
     let baseDir;
     try {
       baseDir = FileUtils.getDir("coreAppsDir", ["webapps", aId], false);
       if (!baseDir.exists()) {
         return;
+      } else if (!baseDir.directoryEntries.hasMoreElements()) {
+        debug("Error: Core app in " + baseDir.path + " is empty");
+        return;
       }
     } catch(e) {
       // In ENG builds, we don't have apps in coreAppsDir.
       return;
     }
 
     let filesToMove;
     let isPackage;
@@ -334,17 +337,21 @@ this.DOMApplicationRegistry = {
           " from " + baseDir.path);
 
     // We copy this app to DIRECTORY_NAME/$aId, and set the base path as needed.
     let destDir = FileUtils.getDir(DIRECTORY_NAME, ["webapps", aId], true, true);
 
     filesToMove.forEach(function(aFile) {
         let file = baseDir.clone();
         file.append(aFile);
-        file.copyTo(destDir, aFile);
+        try {
+          file.copyTo(destDir, aFile);
+        } catch(e) {
+          debug("Error: Failed to copy " + file.path + " to " + destDir.path);
+        }
       });
 
     app.installState = "installed";
     app.cachePath = app.basePath;
     app.basePath = FileUtils.getDir(DIRECTORY_NAME, ["webapps"], true, true)
                             .path;
 
     if (!isPackage) {