Backed out changesets 2a58557adc6f and e69381450554 (bug 893800) for test_app_uninstall.html timeouts.
authorRyan VanderMeulen <ryanvm@gmail.com>
Fri, 13 Sep 2013 09:47:17 -0400
changeset 160034 2aa1e16b67b05c67d451f99d4fd733d14351f3b3
parent 160033 bfbf9d94ed1dae08fa233b193dda871061e7caa5
child 160035 2981946d58f4b682a3a016a1af933c6fff7383ec
push id2961
push userlsblakk@mozilla.com
push dateMon, 28 Oct 2013 21:59:28 +0000
treeherdermozilla-beta@73ef4f13486f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs893800
milestone26.0a1
backs out2a58557adc6f56202f27c9dab0fdc6bfff085601
e69381450554e751b91dd04102a0fa3bbe07442f
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 changesets 2a58557adc6f and e69381450554 (bug 893800) for test_app_uninstall.html timeouts.
b2g/app/b2g.js
b2g/chrome/content/shell.js
browser/installer/removed-files.in
dom/apps/src/AppsUtils.jsm
dom/apps/src/OperatorApps.jsm
dom/apps/src/Webapps.jsm
dom/apps/src/moz.build
dom/apps/tests/Makefile.in
dom/apps/tests/test_operator_app_install.js
dom/apps/tests/test_operator_app_install.xul
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -419,17 +419,16 @@ pref("services.push.requestTimeout", 100
 pref("services.push.udp.wakeupEnabled", true);
 // port on which UDP server socket is bound
 pref("services.push.udp.port", 2442);
 
 // NetworkStats
 #ifdef MOZ_B2G_RIL
 pref("dom.mozNetworkStats.enabled", true);
 pref("ril.cellbroadcast.disabled", false);
-pref("dom.webapps.firstRunWithSIM", false);
 #endif
 
 // WebSettings
 pref("dom.mozSettings.enabled", true);
 pref("dom.navigator-property.disable.mozSettings", false);
 pref("dom.mozPermissionSettings.enabled", true);
 
 // controls if we want camera support
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -596,20 +596,16 @@ var shell = {
 
     this.reportCrash(true);
 
     Cu.import('resource://gre/modules/Webapps.jsm');
     DOMApplicationRegistry.allAppsLaunchable = true;
 
     this.sendEvent(window, 'ContentStart');
 
-#ifdef MOZ_B2G_RIL
-    Cu.import('resource://gre/modules/OperatorApps.jsm');
-#endif
-
     content.addEventListener('load', function shell_homeLoaded() {
       content.removeEventListener('load', shell_homeLoaded);
       shell.isHomeLoaded = true;
 
 #ifdef MOZ_WIDGET_GONK
       libcutils.property_set('sys.boot_completed', '1');
 #endif
 
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -1110,17 +1110,16 @@ xpicleanup@BIN_SUFFIX@
   modules/services-sync/type_records/prefs.js
   modules/services-sync/type_records/tabs.js
   modules/services-sync/util.js
   modules/stylePanel.jsm
   modules/tabview/AllTabs.jsm
   modules/tabview/groups.jsm
   modules/tabview/utils.jsm
   modules/Webapps.jsm
-  modules/OperatorApps.jsm
   modules/WindowDraggingUtils.jsm
   #ifdef XP_WIN
     modules/WindowsJumpLists.jsm
     modules/WindowsPreviewPerTab.jsm
   #endif
   modules/XPCOMUtils.jsm
   modules/XPIProvider.jsm
   res/contenteditable.css
--- a/dom/apps/src/AppsUtils.jsm
+++ b/dom/apps/src/AppsUtils.jsm
@@ -5,19 +5,17 @@
 "use strict";
 
 const Cu = Components.utils;
 const Cc = Components.classes;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 
 Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/WebappOSUtils.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 
 XPCOMUtils.defineLazyGetter(this, "NetUtil", function() {
   return Cc["@mozilla.org/network/util;1"]
            .getService(Ci.nsINetUtil);
 });
 
@@ -489,42 +487,16 @@ this.AppsUtils = {
         return false;
       }
     }
 
     // Nothing failed.
     return true;
   },
 
-  // Loads a JSON file using OS.file. aFile is a string representing the path
-  // of the file to be read.
-  // Returns a Promise resolved with the json payload or rejected with
-  // OS.File.Error
-  loadJSONAsync: function(aFile) {
-    debug("_loadJSONAsync: " + aFile);
-    return Task.spawn(function() {
-      let file = yield OS.File.open(aFile, { read: true });
-      let rawData = yield file.read();
-      // Read json file into a string
-      let data;
-      try {
-        // Obtain a converter to read from a UTF-8 encoded input stream.
-        let converter = new TextDecoder();
-        data = JSON.parse(converter.decode(rawData));
-        file.close();
-      } catch (ex) {
-        debug("Error parsing JSON: " + aFile + ". Error: " + ex);
-        Cu.reportError("OperatorApps: Could not parse JSON: " +
-                       aFile + " " + ex + "\n" + ex.stack);
-        throw ex;
-      }
-      throw new Task.Result(data);
-    });
-  },
-
   // Returns the MD5 hash of a string.
   computeHash: function(aString) {
     let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
                       .createInstance(Ci.nsIScriptableUnicodeConverter);
     converter.charset = "UTF-8";
     let result = {};
     // Data is an array of bytes.
     let data = converter.convertToByteArray(aString, result);
deleted file mode 100644
--- a/dom/apps/src/OperatorApps.jsm
+++ /dev/null
@@ -1,262 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-this.EXPORTED_SYMBOLS = ["OperatorAppsRegistry"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/Webapps.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://gre/modules/AppsUtils.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-
-#ifdef MOZ_B2G_RIL
-XPCOMUtils.defineLazyServiceGetter(this, "iccProvider",
-                                   "@mozilla.org/ril/content-helper;1",
-                                   "nsIIccProvider");
-
-XPCOMUtils.defineLazyServiceGetter(this, "mobileConnection",
-                                   "@mozilla.org/ril/content-helper;1",
-                                   "nsIMobileConnectionProvider");
-#endif
-
-function debug(aMsg) {
-  //dump("-*-*- OperatorApps.jsm : " + aMsg + "\n");
-}
-
-const DIRECTORY_NAME = "webappsDir";
-
-// The files will be stored on DIRECTORY_NAME + "/" + SINGLE_VARIANT_SOURCE_DIR
-// SINGLE_VARIANT_CONF_FILE will be stored on SINGLE_VARIANT_SOURCE_DIR
-// Apps will be stored on a app per directory basis, hanging from
-// SINGLE_VARIANT_SOURCE_DIR
-const SINGLE_VARIANT_SOURCE_DIR = "svoperapps";
-const SINGLE_VARIANT_CONF_FILE  = "singlevariantconf.json";
-const PREF_FIRST_RUN_WITH_SIM   = "dom.webapps.firstRunWithSIM";
-const METADATA                  = "metadata.json";
-const UPDATEMANIFEST            = "update.webapp";
-const MANIFEST                  = "manifest.webapp";
-const APPLICATION_ZIP           = "application.zip";
-
-function isFirstRunWithSIM() {
-  try {
-    if (Services.prefs.prefHasUserValue(PREF_FIRST_RUN_WITH_SIM)) {
-      return Services.prefs.getBoolPref(PREF_FIRST_RUN_WITH_SIM);
-    }
-  } catch(e) {
-    debug ("Error getting pref. " + e);
-  }
-  return true;
-}
-
-#ifdef MOZ_B2G_RIL
-let iccListener = {
-  notifyStkCommand: function() {},
-
-  notifyStkSessionEnd: function() {},
-
-  notifyIccCardLockError: function() {},
-
-  notifyCardStateChange: function() {},
-
-  notifyIccInfoChanged: function() {
-    let iccInfo = iccProvider.iccInfo;
-    if (iccInfo && iccInfo.mcc && iccInfo.mnc) {
-      debug("******* iccListener cardIccInfo MCC-MNC: " + iccInfo.mcc +
-            "-" + iccInfo.mnc);
-      iccProvider.unregisterIccMsg(this);
-      OperatorAppsRegistry._installOperatorApps(iccInfo.mcc, iccInfo.mnc);
-    }
-  }
-};
-#endif
-
-this.OperatorAppsRegistry = {
-
-  _baseDirectory: null,
-
-  init: function() {
-    debug("init");
-#ifdef MOZ_B2G_RIL
-    if (isFirstRunWithSIM()) {
-      debug("First Run with SIM");
-      let mcc = 0;
-      let mnc = 0;
-      if (mobileConnection.iccInfo && mobileConnection.iccInfo.mcc) {
-        mcc = mobileConnection.iccInfo.mcc;
-      }
-      if (mobileConnection.iccInfo && mobileConnection.iccInfo.mnc) {
-        mnc = mobileConnection.iccInfo.mnc;
-      }
-      if (mcc && mnc) {
-        this._installOperatorApps(mcc, mnc);
-      } else {
-        iccProvider.registerIccMsg(iccListener);
-      }
-    } else {
-      debug("No First Run with SIM");
-    }
-#endif
-  },
-
-  set appsDir(aDir) {
-    debug("appsDir SET: " + aDir);
-    if (aDir) {
-      this._baseDirectory = Cc["@mozilla.org/file/local;1"]
-          .createInstance(Ci.nsILocalFile);
-      this._baseDirectory.initWithPath(aDir);
-    } else {
-      this._baseDirectory = null;
-    }
-  },
-
-  get appsDir() {
-    if (!this._baseDirectory) {
-      this._baseDirectory = FileUtils.getFile(DIRECTORY_NAME,
-                                              [SINGLE_VARIANT_SOURCE_DIR]);
-    }
-    return this._baseDirectory;
-  },
-
-  eraseVariantAppsNotInList: function(aIdsApp) {
-    if (!aIdsApp || !Array.isArray(aIdsApp)) {
-      aIdsApp = [ ];
-    }
-
-    let svDir;
-    try {
-      svDir = this.appsDir.clone();
-    } catch (e) {
-      debug("eraseVariantAppsNotInList --> Error getting Dir "+
-             svDir.path + ". " + e);
-      return;
-    }
-
-    if (!svDir || !svDir.exists()) {
-      return;
-    }
-
-    let entries = svDir.directoryEntries;
-    while (entries.hasMoreElements()) {
-      let entry = entries.getNext().QueryInterface(Ci.nsIFile);
-      if (entry.isDirectory() && aIdsApp.indexOf(entry.leafName) < 0) {
-        try{
-          entry.remove(true);
-        } catch(e) {
-          debug("Error removing [" + entry.path + "]." + e);
-        }
-      }
-    }
-  },
-
-  _launchInstall: function(isPackage, aId, aMetadata, aManifest) {
-    if (!aManifest) {
-      debug("Error: The application " + aId + " does not have a manifest");
-      return;
-    }
-
-    let appData = {
-      app: {
-        installOrigin: aMetadata.installOrigin,
-        origin: aMetadata.origin,
-        manifestURL: aMetadata.manifestURL,
-        manifestHash: AppsUtils.computeHash(JSON.stringify(aManifest))
-      },
-      appId: undefined,
-      isBrowser: false,
-      isPackage: isPackage
-    };
-
-    if (isPackage) {
-      debug("aId:" + aId + ". Installing as packaged app.");
-      let installPack = OS.Path.join(this.appsDir.path, aId, APPLICATION_ZIP);
-      OS.File.exists(installPack).then(
-        function(aExists) {
-          if (!aExists) {
-            debug("SV " + installPack.path + " file do not exists for app " +
-                  aId);
-            return;
-          }
-          appData.app.localInstallPath = installPack;
-          appData.app.updateManifest = aManifest;
-          DOMApplicationRegistry.confirmInstall(appData);
-      });
-    } else {
-      debug("aId:" + aId + ". Installing as hosted app.");
-      appData.app.manifest = aManifest;
-      DOMApplicationRegistry.confirmInstall(appData);
-    }
-  },
-
-  _installOperatorApps: function(aMcc, aMnc) {
-    Task.spawn(function() {
-      debug("Install operator apps ---> mcc:"+ aMcc + ", mnc:" + aMnc);
-      if (!isFirstRunWithSIM()) {
-        debug("Operator apps already installed.");
-        return;
-      }
-
-      let aIdsApp = yield this._getSingleVariantApps(aMcc, aMnc);
-      debug("installOperatorApps --> aIdsApp:" + JSON.stringify(aIdsApp));
-      for (let i = 0; i < aIdsApp.length; i++) {
-        let aId = aIdsApp[i];
-        let aMetadata = yield AppsUtils.loadJSONAsync(
-                           OS.Path.join(this.appsDir.path, aId, METADATA));
-        debug("metadata:" + JSON.stringify(aMetadata));
-        let isPackage = true;
-        let manifest;
-        let manifests = [UPDATEMANIFEST, MANIFEST];
-        for (let j = 0; j < manifests.length; j++) {
-          try {
-            manifest = yield AppsUtils.loadJSONAsync(
-                          OS.Path.join(this.appsDir.path, aId, manifests[j]));
-            break;
-          } catch (e) {
-            isPackage = false;
-          }
-        }
-        if (manifest) {
-          this._launchInstall(isPackage, aId, aMetadata, manifest);
-        } else {
-          debug ("Error. Neither " + UPDATEMANIFEST + " file nor " + MANIFEST +
-                 " file for " + aId + " app.");
-        }
-      }
-      this.eraseVariantAppsNotInList(aIdsApp);
-      Services.prefs.setBoolPref(PREF_FIRST_RUN_WITH_SIM, false);
-    }.bind(this)).then(null, function(aError) {
-        debug("Error: " + aError);
-    });
-  },
-
-  _getSingleVariantApps: function(aMcc, aMnc) {
-
-    function normalizeCode(aCode) {
-      let ncode = "" + aCode;
-      while (ncode.length < 3) {
-        ncode = "0" + ncode;
-      }
-      return ncode;
-    }
-
-    return Task.spawn(function () {
-      let key = normalizeCode(aMcc) + "-" + normalizeCode(aMnc);
-      let file = OS.Path.join(this.appsDir.path, SINGLE_VARIANT_CONF_FILE);
-      let aData = yield AppsUtils.loadJSONAsync(file);
-      if (!aData || !(key in aData)) {
-        return;
-      }
-      throw new Task.Result(aData[key]);
-    }.bind(this));
-  }
-};
-
-OperatorAppsRegistry.init();
--- a/dom/apps/src/Webapps.jsm
+++ b/dom/apps/src/Webapps.jsm
@@ -2190,36 +2190,24 @@ this.DOMApplicationRegistry = {
     if (!aData.isPackage) {
       this.updateAppHandlers(null, app.manifest, app);
       if (aInstallSuccessCallback) {
         aInstallSuccessCallback(app.manifest);
       }
     }
 
     if (manifest.package_path) {
-      // If it is a local app then it must been installed from a local file
-      // instead of web.
-      let origPath = jsonManifest.package_path;
-      if (aData.app.localInstallPath) {
-        jsonManifest.package_path = "file://" + aData.app.localInstallPath;
-      }
       // origin for install apps is meaningless here, since it's app:// and this
       // can't be used to resolve package paths.
       manifest = new ManifestHelper(jsonManifest, app.manifestURL);
 
       this.queuedPackageDownload[app.manifestURL] = {
         manifest: manifest,
         app: appObject,
         callback: aInstallSuccessCallback
-      };
-
-      if (aData.app.localInstallPath) {
-        // if it's a local install, there's no content process so just
-        // ack the install
-        this.onInstallSuccessAck(app.manifestURL);
       }
     }
   },
 
   _nextLocalId: function() {
     let id = Services.prefs.getIntPref("dom.mozApps.maxLocalId") + 1;
 
     while (this.getManifestURLByLocalId(id)) {
@@ -2303,24 +2291,16 @@ this.DOMApplicationRegistry = {
     // - check the signature on the zip.
     // - extract the manifest from the zip and check it.
     // - ask confirmation to the user.
     // - add the new app to the registry.
     // If we fail at any step, we backout the previous ones and return an error.
 
     debug("downloadPackage " + JSON.stringify(aApp));
 
-    let fullPackagePath = aManifest.fullPackagePath();
-
-    // Check if it's a local file install (we've downloaded/sideloaded the
-    // package already or it did exist on the build).
-
-    let isLocalFileInstall =
-      Services.io.extractScheme(fullPackagePath) === 'file';
-
     let id = this._appIdForManifestURL(aApp.manifestURL);
     let app = this.webapps[id];
 
     let self = this;
     // Removes the directory we created, and sends an error to the DOM side.
     function cleanup(aError) {
       debug("Cleanup: " + aError);
       let dir = FileUtils.getDir("TmpD", ["webapps", id], true, true);
@@ -2402,27 +2382,20 @@ this.DOMApplicationRegistry = {
       } else if (isInstalled) {
         throw "WRONG_APP_STORE_ID";
       }
     }
 
     function download() {
       debug("About to download " + aManifest.fullPackagePath());
 
-      let requestChannel;
-      if (isLocalFileInstall) {
-        requestChannel = NetUtil.newChannel(aManifest.fullPackagePath())
-                                .QueryInterface(Ci.nsIFileChannel);
-      } else {
-        requestChannel = NetUtil.newChannel(aManifest.fullPackagePath())
-                                .QueryInterface(Ci.nsIHttpChannel);
-        requestChannel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
-      }
-
-      if (app.packageEtag && !isLocalFileInstall) {
+      let requestChannel = NetUtil.newChannel(aManifest.fullPackagePath())
+                                  .QueryInterface(Ci.nsIHttpChannel);
+      requestChannel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
+      if (app.packageEtag) {
         debug("Add If-None-Match header: " + app.packageEtag);
         requestChannel.setRequestHeader("If-None-Match", app.packageEtag, false);
       }
 
       AppDownloadManager.add(aApp.manifestURL,
         {
           channel: requestChannel,
           appId: id,
@@ -2608,21 +2581,18 @@ this.DOMApplicationRegistry = {
                 // Only allow signed apps to be installed from a whitelist of
                 // domains, and require all packages installed from any of the
                 // domains on the whitelist to be signed. This is a stopgap until
                 // we have a real story for handling multiple app stores signing
                 // apps.
                 let signedAppOriginsStr =
                   Services.prefs.getCharPref(
                     "dom.mozApps.signed_apps_installable_from");
-                // If it's a local install and it's signed then we assume
-                // the app origin is a valid signer.
-                let isSignedAppOrigin = (isSigned && isLocalFileInstall) ||
-                                         signedAppOriginsStr.split(",").
-                                               indexOf(aApp.installOrigin) > -1;
+                let isSignedAppOrigin
+                  = signedAppOriginsStr.split(",").indexOf(aApp.installOrigin) > -1;
                 if (!isSigned && isSignedAppOrigin) {
                   // Packaged apps installed from these origins must be signed;
                   // if not, assume somebody stripped the signature.
                   throw "INVALID_SIGNATURE";
                 } else if (isSigned && !isSignedAppOrigin) {
                   // Other origins are *prohibited* from installing signed apps.
                   // One reason is that our app revocation mechanism requires
                   // strong cooperation from the host of the mini-manifest, which
@@ -2664,20 +2634,18 @@ this.DOMApplicationRegistry = {
                                                 aManifest._manifest)) {
                   throw "MANIFEST_MISMATCH";
                 }
 
                 if (!AppsUtils.checkInstallAllowed(manifest, aApp.installOrigin)) {
                   throw "INSTALL_FROM_DENIED";
                 }
 
-                // Local file installs can be privileged even without the signature.
-                let maxStatus = isSigned || isLocalFileInstall
-                                   ? Ci.nsIPrincipal.APP_STATUS_PRIVILEGED
-                                   : Ci.nsIPrincipal.APP_STATUS_INSTALLED;
+                let maxStatus = isSigned ? Ci.nsIPrincipal.APP_STATUS_PRIVILEGED
+                                         : Ci.nsIPrincipal.APP_STATUS_INSTALLED;
 
                 if (AppsUtils.getAppManifestStatus(manifest) > maxStatus) {
                   throw "INVALID_SECURITY_LEVEL";
                 }
                 app.appStatus = AppsUtils.getAppManifestStatus(manifest);
 
                 // Save the new Etag for the package.
                 if (aIsUpdate) {
--- a/dom/apps/src/moz.build
+++ b/dom/apps/src/moz.build
@@ -29,17 +29,16 @@ EXTRA_JS_MODULES += [
     'FreeSpaceWatcher.jsm',
     'OfflineCacheInstaller.jsm',
     'PermissionsInstaller.jsm',
     'PermissionsTable.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
     'AppsUtils.jsm',
-    'OperatorApps.jsm',
     'Webapps.jsm',
 ]
 
 FAIL_ON_WARNINGS = True
 
 LIBXUL_LIBRARY = True
 
 LIBRARY_NAME = 'dom_apps_s'
--- a/dom/apps/tests/Makefile.in
+++ b/dom/apps/tests/Makefile.in
@@ -14,11 +14,9 @@ MOCHITEST_FILES = \
   file_packaged_app.template.html \
   test_packaged_app_install.html \
   test_packaged_app_update.html \
   test_packaged_app_common.js \
   $(NULL)
 
 MOCHITEST_CHROME_FILES = \
   test_apps_service.xul \
-  test_operator_app_install.xul \
-  test_operator_app_install.js \
   $(NULL)
deleted file mode 100644
--- a/dom/apps/tests/test_operator_app_install.js
+++ /dev/null
@@ -1,278 +0,0 @@
-"use strict";
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-Cu.import("resource://gre/modules/OperatorApps.jsm");
-Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-
-// From prio.h
-const PR_RDWR        = 0x04;
-const PR_CREATE_FILE = 0x08;
-const PR_TRUNCATE    = 0x20;
-
-SimpleTest.waitForExplicitFinish();
-
-var gApp = null;
-
-var launchableValue = undefined;
-
-var index = -1;
-var singlevariantDir = undefined;
-
-function debug(aMsg) {
-  dump("== Tests debug == " + aMsg + "\n");
-}
-
-
-var updateData = {
-  name : "testOperatorApp1",
-  version : 2,
-  size : 767,
-  package_path: "http://test/tests/dom/apps/tests/file_packaged_app.sjs",
-  description: "Updated even faster than Firefox, just to annoy slashdotters",
-  developer: {
-    name: "Tester Operator App",
-    url: "http://mochi.test:8888"
-  }
-};
-
-var manifestData = {
-  name : "testOperatorApp1",
-  version : 2,
-  description: "Updated even faster than Firefox, just to annoy slashdotters",
-  launch_path: "index.html",
-  developer: {
-    name: "Tester Operator App",
-    url: "http://mochi.test:8888"
-  },
-  default_locale: "en-US"
-};
-
-var metadataData = {
-  id: "testOperatorApp1",
-  installOrigin: "http://mochi.test:8888",
-  manifestURL: "http://test/tests/dom/apps/tests/file_packaged_app.sjs",
-  origin: "http://test"
-};
-
-function writeFile(aFile, aData, aCb) {
-  debug("Saving " + aFile.path);
-  // Initialize the file output stream.
-  let ostream = FileUtils.openSafeFileOutputStream(aFile);
-
-  // Obtain a converter to convert our data to a UTF-8 encoded input stream.
-  let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
-                  .createInstance(Ci.nsIScriptableUnicodeConverter);
-  converter.charset = "UTF-8";
-
-  // Asynchronously copy the data to the file.
-  let istream = converter.convertToInputStream(aData);
-  NetUtil.asyncCopy(istream, ostream, function(rc) {
-    FileUtils.closeSafeFileOutputStream(ostream);
-    if (aCb)
-      aCb();
-  });
-}
-
-// File and resources helpers
-function addZipEntry(zipWriter, entry, entryName) {
-  var stream = Cc["@mozilla.org/io/string-input-stream;1"]
-               .createInstance(Ci.nsIStringInputStream);
-  stream.setData(entry, entry.length);
-  zipWriter.addEntryStream(entryName, Date.now(),
-                           Ci.nsIZipWriter.COMPRESSION_BEST, stream, false);
-}
-
-function setupDataDirs(aCb) {
-  let dirNum = "tmp_" + Math.floor(Math.random() * 10000000 + 1);
-  let tmpDir = FileUtils.getDir("TmpD", [dirNum, "singlevariantapps"], true,
-                                true);
-  let appDir = FileUtils.getDir("TmpD", [dirNum, "singlevariantapps",
-                                "testOperatorApp1"], true, true);
-
-  singlevariantDir = tmpDir.path;
-  let singlevariantFile = tmpDir.clone();
-  singlevariantFile.append("singlevariantconf.json");
-
-
-  writeFile(singlevariantFile, JSON.stringify({"214-007":["testOperatorApp1"]}),
-            function() {
-    let indexhtml = "<html></html>";
-    let manifest = JSON.stringify(manifestData);
-    // Create the application package.
-    var zipWriter = Cc["@mozilla.org/zipwriter;1"]
-                    .createInstance(Ci.nsIZipWriter);
-    var zipFile = FileUtils.getFile("TmpD", [
-                                      dirNum,
-                                      "singlevariantapps",
-                                      "testOperatorApp1",
-                                      "application.zip"]);
-    zipWriter.open(zipFile, PR_RDWR | PR_CREATE_FILE | PR_TRUNCATE);
-    addZipEntry(zipWriter, indexhtml, "index.html");
-    addZipEntry(zipWriter, manifest, "manifest.webapp");
-    zipWriter.close();
-
-    var metadataFile = appDir.clone();
-    metadataFile.append("metadata.json");
-    writeFile(metadataFile, JSON.stringify(metadataData), function() {
-      var updateFile = appDir.clone();
-      updateFile.append("update.webapp");
-      writeFile(updateFile, JSON.stringify(updateData), aCb);
-    });
-  });
-}
-
-function next() {
-  index += 1;
-  if (index >= steps.length) {
-    ok(false, "Shouldn't get here!");
-    return;
-  }
-  try {
-    steps[index]();
-  } catch(ex) {
-    ok(false, "Caught exception", ex);
-  }
-}
-
-function go() {
-  next();
-}
-
-function finish() {
-  SpecialPowers.setAllAppsLaunchable(launchableValue);
-  SpecialPowers.removePermission("webapps-manage", document);
-  SimpleTest.finish();
-}
-
-function mozAppsError() {
-  ok(false, "mozApps error: " + this.error.name);
-  finish();
-}
-
-function installOperatorApp(aMcc, aMnc, aCb) {
-  OperatorAppsRegistry.appsDir = singlevariantDir;
-  OperatorAppsRegistry._installOperatorApps(aMcc, aMnc);
-}
-
-function checkAppState(aApp,
-                       aVersion,
-                       aExpectedApp,
-                       aCb) {
-  debug(JSON.stringify(aApp, null, 2));
-  if (aApp.manifest) {
-    debug(JSON.stringify(aApp.manifest, null, 2));
-  }
-
-  if (aExpectedApp.name) {
-    if (aApp.manifest) {
-      is(aApp.manifest.name, aExpectedApp.name, "Check name");
-    }
-    is(aApp.updateManifest.name, aExpectedApp.name, "Check name mini-manifest");
-  }
-  if (aApp.manifest) {
-    is(aApp.manifest.version, aVersion, "Check version");
-  }
-  if (typeof aExpectedApp.size !== "undefined" && aApp.manifest) {
-    is(aApp.manifest.size, aExpectedApp.size, "Check size");
-  }
-  if (aApp.manifest) {
-    is(aApp.manifest.launch_path, "index.html", "Check launch path");
-  }
-  if (aExpectedApp.manifestURL) {
-    is(aApp.manifestURL, aExpectedApp.manifestURL, "Check manifestURL");
-  }
-  if (aExpectedApp.installOrigin) {
-    is(aApp.installOrigin, aExpectedApp.installOrigin, "Check installOrigin");
-  }
-  ok(aApp.removable, "Removable app");
-  if (typeof aExpectedApp.progress !== "undefined") {
-    todo(aApp.progress == aExpectedApp.progress, "Check progress");
-  }
-  if (aExpectedApp.installState) {
-    is(aApp.installState, aExpectedApp.installState, "Check installState");
-  }
-  if (typeof aExpectedApp.downloadAvailable !== "undefined") {
-    is(aApp.downloadAvailable, aExpectedApp.downloadAvailable,
-       "Check download available");
-  }
-  if (typeof aExpectedApp.downloading !== "undefined") {
-    is(aApp.downloading, aExpectedApp.downloading, "Check downloading");
-  }
-  if (typeof aExpectedApp.downloadSize !== "undefined") {
-    is(aApp.downloadSize, aExpectedApp.downloadSize, "Check downloadSize");
-  }
-  if (typeof aExpectedApp.readyToApplyDownload !== "undefined") {
-    is(aApp.readyToApplyDownload, aExpectedApp.readyToApplyDownload,
-       "Check readyToApplyDownload");
-  }
-
-  if (aCb && typeof aCb === 'function') {
-    aCb();
-  }
-  return;
-}
-
-var steps = [
-  function() {
-    setupDataDirs(next);
-    ok(true, "Data directory set up to " + singlevariantDir);
-  },
-  function() {
-    // Set up
-    launchableValue = SpecialPowers.setAllAppsLaunchable(true);
-    ok(true, "Set up");
-    next();
-  },
-  function() {
-    ok(true, "autoConfirmAppInstall");
-    SpecialPowers.autoConfirmAppInstall(next);
-  },
-  function() {
-    ok(true, "== TEST == Install operator app");
-
-    navigator.mozApps.mgmt.oninstall = function(evt) {
-      ok(true, "Got oninstall event");
-      gApp = evt.application;
-      gApp.ondownloaderror = function() {
-        ok(false, "Download error " + gApp.downloadError.name);
-        finish();
-      };
-      let downloadsuccessHandler = function() {
-        gApp.ondownloadsuccess = null;
-        ok(true, "App downloaded");
-
-        var expected = {
-          name: manifestData.name,
-          manifestURL: metadataData.manifestURL,
-          installOrigin: metadataData.installOrigin,
-          progress: 0,
-          installState: "installed",
-          downloadAvailable: false,
-          downloading: false,
-          downloadSize: 767,
-          readyToApplyDownload: false
-        };
-        checkAppState(gApp, manifestData.version, expected, next);
-      };
-      gApp.ondownloadsuccess = downloadsuccessHandler;
-      if (!gApp.downloading && gApp.ondownloadsuccess) {
-        ok(true, "Got an earlier event");
-        // Seems we set the handler too late.
-        gApp.ondownloadsuccess = null;
-        downloadsuccessHandler();
-      }
-    };
-    installOperatorApp("214", "007", next);
-  },
-  function() {
-    ok(true, "all done!\n");
-    SimpleTest.finish();
-  }
-];
-
-go();
-
deleted file mode 100644
--- a/dom/apps/tests/test_operator_app_install.xul
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=893800
--->
-<window title="Mozilla Bug 893800"
-        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
-  <!-- test results are displayed in the html:body -->
-  <body xmlns="http://www.w3.org/1999/xhtml">
-  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=893800"
-     target="_blank">Mozilla Bug 893800</a>
-  </body>
-
-  <script type="application/javascript;version=1.7" src="test_operator_app_install.js" />
-</window>