Backed out changeset 28664fb86b3c (bug 1036847) for causing frequent OSX mochitest timeouts.
authorRyan VanderMeulen <ryanvm@gmail.com>
Mon, 14 Jul 2014 10:44:06 -0400
changeset 215740 66651fb7bca3854b53f8037f898c55c3c70729b7
parent 215739 2b6ec29ccdf947773181e3bff457f1e4da8f2be0
child 215741 e49e46b0a9c8b3fc23f3b3aa0877e08ddb80dd7e
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1036847
milestone33.0a1
backs out28664fb86b3c191d64cf932643a8179cc028bc1a
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
Backed out changeset 28664fb86b3c (bug 1036847) for causing frequent OSX mochitest timeouts.
dom/apps/tests/file_packaged_app.sjs
dom/apps/tests/test_packaged_app_common.js
dom/apps/tests/test_packaged_app_install.html
--- a/dom/apps/tests/file_packaged_app.sjs
+++ b/dom/apps/tests/file_packaged_app.sjs
@@ -15,45 +15,33 @@ var gMiniManifestTemplate = "file_packag
 var gAppTemplate = "file_packaged_app.template.html";
 var gAppName = "appname";
 var gDevName = "devname";
 var gDevUrl = "http://dev.url";
 
 function handleRequest(request, response) {
   var query = getQuery(request);
 
+  response.setHeader("Access-Control-Allow-Origin", "*", false);
+
   var packageSize = ("packageSize" in query) ? query.packageSize : 0;
   var appName = ("appName" in query) ? query.appName : gAppName;
   var devName = ("devName" in query) ? query.devName : gDevName;
   var devUrl = ("devUrl" in query) ? query.devUrl : gDevUrl;
-  // allowCancel just means deliver the file slowly so we have time to cancel it
-  var allowCancel = "allowCancel" in query;
-  var getPackage = "getPackage" in query;
-  var alreadyDeferred = Number(getState("alreadyDeferred"));
-
-  if (allowCancel && getPackage && !alreadyDeferred) {
-    // Only do this for the actual package delivery.
-    response.processAsync();
-    // And to avoid timer problems, only do this once.
-    setState("alreadyDeferred", "1");
-  }
-
-  response.setHeader("Access-Control-Allow-Origin", "*", false);
 
   // If this is a version update, update state, prepare the manifest,
   // the application package and return.
   if ("setVersion" in query) {
     var version = query.setVersion;
     setState("version", version);
     var packageVersion = ("dontUpdatePackage" in query) ? version - 1 : version;
     var packageName = "test_packaged_app_" + packageVersion + ".zip";
 
     setState("packageName", packageName);
-    var packagePath = "/" + gBasePath + "file_packaged_app.sjs?" +
-                      (allowCancel?"allowCancel&": "") + "getPackage=" +
+    var packagePath = "/" + gBasePath + "file_packaged_app.sjs?getPackage=" +
                       packageName;
     setState("packagePath", packagePath);
 
     if (version == packageVersion) {
       // Create the application package.
       var zipWriter = Cc["@mozilla.org/zipwriter;1"]
                         .createInstance(Ci.nsIZipWriter);
       var zipFile = FileUtils.getFile("TmpD", [packageName]);
@@ -91,29 +79,21 @@ function handleRequest(request, response
     dump("Etags Match. Sending 304\n");
     response.setStatusLine(request.httpVersion, "304", "Not modified");
     return;
   }
 
   response.setHeader("Etag", etag, false);
 
   // Serve the application package corresponding to the requested app version.
-  if (getPackage) {
+  if ("getPackage" in query) {
     var resource = readFile(packageName, true);
     response.setHeader("Content-Type",
                        "Content-Type: application/java-archive", false);
-    if (allowCancel && !alreadyDeferred) {
-      var timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
-      timer.initWithCallback(function (aTimer) {
-          response.write(resource);
-          response.finish();
-      }, 3000, Ci.nsITimer.TYPE_ONE_SHOT);
-    } else {
-      response.write(resource);
-    }
+    response.write(resource);
     return;
   }
 
   // Serve the mini-manifest corresponding to the requested app version.
   if ("getManifest" in query) {
     var template = gBasePath + gMiniManifestTemplate;
     if (!("noManifestContentType" in query)) {
       response.setHeader("Content-Type",
--- a/dom/apps/tests/test_packaged_app_common.js
+++ b/dom/apps/tests/test_packaged_app_common.js
@@ -52,27 +52,23 @@ var PackagedTestHelper = (function Packa
     finish();
   }
 
   function xhrAbort(url) {
     ok(false, "XHR abort loading " + url);
     finish();
   }
 
-  function setAppVersion(aVersion, aCb, aDontUpdatePackage, aAllowCancel) {
+  function setAppVersion(aVersion, aCb, aDontUpdatePackage) {
     var xhr = new XMLHttpRequest();
     var dontUpdate = "";
-    var allowCancel = "";
     if (aDontUpdatePackage) {
       dontUpdate = "&dontUpdatePackage=1";
     }
-    if (aAllowCancel) {
-      allowCancel= "&allowCancel=1";
-    }
-    var url = gSJS + "?setVersion=" + aVersion + dontUpdate + allowCancel;
+    var url = gSJS + "?setVersion=" + aVersion + dontUpdate;
     xhr.addEventListener("load", function() {
                            is(xhr.responseText, "OK", "setAppVersion OK");
                            aCb();
                          });
     xhr.addEventListener("error", event => xhrError(event, url));
     xhr.addEventListener("abort", event => xhrAbort(url));
     xhr.open("GET", url, true);
     xhr.send();
--- a/dom/apps/tests/test_packaged_app_install.html
+++ b/dom/apps/tests/test_packaged_app_install.html
@@ -29,29 +29,29 @@ function checkAppInstallError(aMiniManif
   var req = navigator.mozApps.installPackage(aMiniManifestURL);
   req.onsuccess = function() {
     ok(false, "We are supposed to throw " + aExpectedError);
     PackagedTestHelper.finish();
   };
   req.onerror = function(evt) {
     var error = evt.target.error.name;
     if (error == aExpectedError) {
-      info("Got expected " + aExpectedError);
+      ok(true, "Got expected " + aExpectedError);
       PackagedTestHelper.next();
     } else {
       ok(false, "Got unexpected " + error);
       PackagedTestHelper.finish();
     }
   };
 }
 
 function checkUninstallApp(aApp) {
   var req = navigator.mozApps.mgmt.uninstall(aApp);
   req.onsuccess = function() {
-    info("App uninstalled");
+    ok(true, "App uninstalled");
     aApp.ondownloadsuccess = null;
     aApp.ondownloaderror = null;
     aApp.onprogress = null;
     PackagedTestHelper.next();
   };
   req.onerror = function(evt) {
     ok(false, "Got unexpected " + evt.target.error.name);
     PackagedTestHelper.finish();
@@ -78,84 +78,84 @@ function checkInstalledApp(aMiniManifest
 
 SimpleTest.waitForExplicitFinish();
 
 var steps = [
   function() {
     // Set up
     SpecialPowers.setAllAppsLaunchable(true);
     SpecialPowers.addPermission("webapps-manage", true, document);
-    info("Set up");
+    ok(true, "Set up");
     PackagedTestHelper.next();
   },
   function() {
-    info("autoConfirmAppInstall");
+    ok(true, "autoConfirmAppInstall");
     SpecialPowers.autoConfirmAppInstall(PackagedTestHelper.next);
   },
   function() {
     PackagedTestHelper.setAppVersion(0, PackagedTestHelper.next);
   },
   function() {
     // Bug 927699 - navigator.mozApps.install(url) lets NS_ERROR_FAILURE onto
     //              the web.
-    info("== TEST == INVALID_URL");
+    ok(true, "== TEST == INVALID_URL");
     checkAppInstallError("", "INVALID_URL");
   },
   function() {
     // Test network error.
-    info("== TEST == Network error");
+    ok(true, "== TEST == Network error");
     checkAppInstallError("http://notvalidurl", "NETWORK_ERROR");
   },
   function() {
     // Test wrong mini-manifest content type.
-    info("== TEST == Not valid mini-manifest content type");
+    ok(true, "== TEST == Not valid mini-manifest content type");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true" +
                           "&noManifestContentType=true";
     checkAppInstallError(miniManifestURL, "INVALID_MANIFEST_CONTENT_TYPE");
   },
   function() {
     // Test mini-manifest 'size' value is not number. Bug 839435.
-    info("== TEST == Size value is not a number");
+    ok(true, "== TEST == Size value is not a number");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true" +
                           "&packageSize=\"NotANumber\"";
     checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
   },
   function() {
     // Test mini-manifest  negative 'size' value. Bug 839435.
-    info("== TEST == Negative size value");
+    ok(true, "== TEST == Negative size value");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true" +
                           "&packageSize=-1";
     checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
   },
   function() {
     // Test wrong package path
-    info("== TEST == Installing app with wrong package path");
+    ok(true, "== TEST == Installing app with wrong package path");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true" +
                           "&wrongPackagePath=true";
     checkAppInstallError(miniManifestURL, "INVALID_MANIFEST");
   },
   function() {
     // Test no manifest in zip file.
-    info("== TEST == No manifest in the zip file");
+    ok(true, "== TEST == No manifest in the zip file");
     var miniManifestURL = PackagedTestHelper.gSJS + "?getManifest=true";
     PackagedTestHelper.checkAppDownloadError(miniManifestURL,
                                             "MISSING_MANIFEST", 0, true, true,
                                              PackagedTestHelper.gAppName);
   },
   function() {
       PackagedTestHelper.setAppVersion(1, PackagedTestHelper.next);
   },
   function() {
     // Test mini-manifest app name is different from the webapp manifest name.
     // Bug 844243.
-    info("== TEST == Mini-manifest app name is different from webapp " +
+    ok(true, "== TEST == Mini-manifest app name is different from webapp " +
              "manifest name");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true" +
                           "&appName=arandomname";
     PackagedTestHelper.checkAppDownloadError(miniManifestURL,
                                              "MANIFEST_MISMATCH", 1, true, true,
                                              "arandomname");
   },
@@ -182,29 +182,29 @@ var steps = [
     PackagedTestHelper.checkAppDownloadError(miniManifestURL,
                                              "MANIFEST_MISMATCH", 1, true, true,
                                              PackagedTestHelper.gAppName);
   },
   function() {
     PackagedTestHelper.setAppVersion(2, PackagedTestHelper.next);
   },
   function() {
-    info("== TEST == Install packaged app");
+    ok(true, "== TEST == Install packaged app");
     var miniManifestURL = PackagedTestHelper.gSJS +
                           "?getManifest=true";
     navigator.mozApps.mgmt.oninstall = function(evt) {
-      info("Got oninstall event");
+      ok(true, "Got oninstall event");
       PackagedTestHelper.gApp = evt.application;
       PackagedTestHelper.gApp.ondownloaderror = function() {
         ok(false, "Download error " +
                   PackagedTestHelper.gApp.downloadError.name);
         PackagedTestHelper.finish();
       };
       PackagedTestHelper.gApp.ondownloadsuccess = function() {
-        info("App downloaded");
+        ok(true, "App downloaded");
         var expected = {
           name: PackagedTestHelper.gAppName,
           manifestURL: miniManifestURL,
           installOrigin: PackagedTestHelper.gInstallOrigin,
           progress: 0,
           installState: "installed",
           downloadAvailable: false,
           downloading: false,
@@ -215,95 +215,21 @@ var steps = [
         PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 2, expected,
                                          true, false, PackagedTestHelper.next);
       };
     };
 
     var request = navigator.mozApps.installPackage(miniManifestURL);
     request.onerror = PackagedTestHelper.mozAppsError;
     request.onsuccess = function() {
-      info("Application installed");
+      ok(true, "Application installed");
     };
   },
   function() {
-    PackagedTestHelper.setAppVersion(3, PackagedTestHelper.next, false, true);
-  },
-  function() {
-    info("== TEST == Install packaged app with a cancel/resume");
-    var miniManifestURL = PackagedTestHelper.gSJS +
-                          "?getManifest=true&allowCancel";
-    navigator.mozApps.mgmt.oninstall = function(evt) {
-      info("Got oninstall event");
-      PackagedTestHelper.gApp = evt.application;
-
-      PackagedTestHelper.gApp.onprogress = function() {
-        // Let's try cancelling and resuming the download later on.
-        PackagedTestHelper.gApp.cancelDownload();
-        // And only do this once.
-        PackagedTestHelper.gApp.onprogress = null;
-      };
-
-      var alreadyCancelled = false;
-      PackagedTestHelper.gApp.ondownloaderror = function() {
-        ok(!alreadyCancelled, "The download should be cancelled only once!");
-        is(PackagedTestHelper.gApp.downloadError.name, "DOWNLOAD_CANCELED",
-           "Download error " + PackagedTestHelper.gApp.downloadError.name);
-        if (!alreadyCancelled) {
-          PackagedTestHelper.gApp.download();
-          alreadyCancelled = true;
-        }
-      };
-
-      PackagedTestHelper.gApp.ondownloadsuccess = function() {
-        info("App downloaded");
-        // We could try also applying the download we just made.
-        var expected = {
-          name: PackagedTestHelper.gAppName,
-          manifestURL: miniManifestURL,
-          installOrigin: PackagedTestHelper.gInstallOrigin,
-          progress: 0,
-          installState: "pending",
-          downloadAvailable: false,
-          downloading: false,
-          downloadSize: 0,
-          size: 0,
-          readyToApplyDownload: true
-        };
-        PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 3, expected,
-                                         true, false, function() {});
-      };
-
-      PackagedTestHelper.gApp.ondownloadapplied = function() {
-        info("App download applied.");
-        var expected = {
-          name: PackagedTestHelper.gAppName,
-          manifestURL: miniManifestURL,
-          installOrigin: PackagedTestHelper.gInstallOrigin,
-          progress: 0,
-          installState: "installed",
-          downloadAvailable: false,
-          downloading: false,
-          downloadSize: 0,
-          size: 0,
-          readyToApplyDownload: false
-        };
-        PackagedTestHelper.checkAppState(PackagedTestHelper.gApp, 3, expected,
-                                         true, false, PackagedTestHelper.next);
-      }
-
-    };
-
-    var request = navigator.mozApps.installPackage(miniManifestURL);
-    request.onerror = PackagedTestHelper.mozAppsError;
-    request.onsuccess = function() {
-      info("Application installed");
-    };
-  },
-  function() {
-    info("all done!\n");
+    ok(true, "all done!\n");
     PackagedTestHelper.finish();
   }
 ];
 
 PackagedTestHelper.setSteps(steps);
 
 addLoadEvent(PackagedTestHelper.start);