Bug 1318209 - Remove mozIApplication; r=baku
authorEhsan Akhgari <ehsan@mozilla.com>
Wed, 16 Nov 2016 21:00:04 -0500
changeset 323105 32bde324c727a46b0409bc174ec33ca2d77bdc1a
parent 323104 aba885aafee0210b1f063a423b1c0b3ce28d15f7
child 323106 234ca79c0f2ec4371cf7b83c4c9549584bb9d029
push id30967
push userphilringnalda@gmail.com
push dateFri, 18 Nov 2016 03:21:38 +0000
treeherdermozilla-central@8e476f8bd52d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1318209
milestone53.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 1318209 - Remove mozIApplication; r=baku
b2g/components/AlertsHelper.jsm
b2g/components/ContentPermissionPrompt.js
caps/BasePrincipal.cpp
caps/nsScriptSecurityManager.cpp
caps/nsScriptSecurityManager.h
dom/apps/AppsService.js
dom/apps/AppsServiceChild.jsm
dom/apps/AppsUtils.jsm
dom/apps/tests/unit/test_moziapplication.js
dom/apps/tests/unit/xpcshell.ini
dom/interfaces/apps/moz.build
dom/interfaces/apps/mozIApplication.idl
dom/interfaces/apps/nsIAppsService.idl
dom/ipc/TabChild.cpp
testing/specialpowers/content/specialpowersAPI.js
--- a/b2g/components/AlertsHelper.jsm
+++ b/b2g/components/AlertsHelper.jsm
@@ -139,43 +139,16 @@ var AlertsHelper = {
   },
 
   registerListener: function(alertId, cookie, alertListener) {
     this._listeners[alertId] = { observer: alertListener, cookie: cookie };
   },
 
   registerAppListener: function(uid, listener) {
     this._listeners[uid] = listener;
-
-    appsService.getManifestFor(listener.manifestURL).then((manifest) => {
-      let app = appsService.getAppByManifestURL(listener.manifestURL);
-      let helper = new ManifestHelper(manifest, app.origin, app.manifestURL);
-      let getNotificationURLFor = function(messages) {
-        if (!messages) {
-          return null;
-        }
-
-        for (let i = 0; i < messages.length; i++) {
-          let message = messages[i];
-          if (message === kNotificationSystemMessageName) {
-            return helper.fullLaunchPath();
-          } else if (typeof message === "object" &&
-                     kNotificationSystemMessageName in message) {
-            return helper.resolveURL(message[kNotificationSystemMessageName]);
-          }
-        }
-
-        // No message found...
-        return null;
-      }
-
-      listener.target = getNotificationURLFor(manifest.messages);
-
-      // Bug 816944 - Support notification messages for entry_points.
-    });
   },
 
   deserializeStructuredClone: function(dataString) {
     if (!dataString) {
       return null;
     }
     let scContainer = Cc["@mozilla.org/docshell/structured-clone-container;1"].
       createInstance(Ci.nsIStructuredCloneContainer);
@@ -217,24 +190,16 @@ var AlertsHelper = {
         mozbehavior: behavior
       });
     }
 
     if (!manifestURL || !manifestURL.length) {
       send(null, null);
       return;
     }
-
-    // If we have a manifest URL, get the icon and title from the manifest
-    // to prevent spoofing.
-    appsService.getManifestFor(manifestURL).then((manifest) => {
-      let app = appsService.getAppByManifestURL(manifestURL);
-      let helper = new ManifestHelper(manifest, app.origin, manifestURL);
-      send(helper.name, helper.iconURLForSize(kNotificationIconSize));
-    });
   },
 
   showAlertNotification: function(aMessage) {
     let data = aMessage.data;
     let currentListener = this._listeners[data.name];
     if (currentListener && currentListener.observer) {
       currentListener.observer.observe(null, kTopicAlertFinished, currentListener.cookie);
     }
--- a/b2g/components/ContentPermissionPrompt.js
+++ b/b2g/components/ContentPermissionPrompt.js
@@ -177,53 +177,16 @@ ContentPermissionPrompt.prototype = {
         debug("legal multiple requests");
         return true;
       }
     }
 
     return false;
   },
 
-  handledByApp: function handledByApp(request, typesInfo) {
-    if (request.principal.appId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
-        request.principal.appId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID) {
-      // This should not really happen
-      request.cancel();
-      return true;
-    }
-
-    let appsService = Cc["@mozilla.org/AppsService;1"]
-                        .getService(Ci.nsIAppsService);
-    let app = appsService.getAppByLocalId(request.principal.appId);
-
-    // Check each permission if it's denied by permission manager with app's
-    // URL.
-    let notDenyAppPrincipal = function(type) {
-      let url = Services.io.newURI(app.origin, null, null);
-      let principal =
-        secMan.createCodebasePrincipal(url,
-                                       {appId: request.principal.appId});
-      let result = Services.perms.testExactPermissionFromPrincipal(principal,
-                                                                   type.access);
-
-      if (result == Ci.nsIPermissionManager.ALLOW_ACTION ||
-          result == Ci.nsIPermissionManager.PROMPT_ACTION) {
-        type.deny = false;
-      }
-      return !type.deny;
-    }
-    // Cancel the entire request if one of the requested permissions is denied
-    if (!typesInfo.every(notDenyAppPrincipal)) {
-      request.cancel();
-      return true;
-    }
-
-    return false;
-  },
-
   handledByPermissionType: function handledByPermissionType(request, typesInfo) {
     for (let i in typesInfo) {
       if (permissionSpecificChecker.hasOwnProperty(typesInfo[i].permission) &&
           permissionSpecificChecker[typesInfo[i].permission](request)) {
         return true;
       }
     }
 
@@ -265,18 +228,17 @@ ContentPermissionPrompt.prototype = {
       return;
     }
 
     if(!this.checkMultipleRequest(typesInfo)) {
       request.cancel();
       return;
     }
 
-    if (this.handledByApp(request, typesInfo) ||
-        this.handledByPermissionType(request, typesInfo)) {
+    if (this.handledByPermissionType(request, typesInfo)) {
       return;
     }
 
     // returns true if the request was handled
     if (this.handleExistingPermission(request, typesInfo)) {
        return;
     }
 
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -595,23 +595,18 @@ BasePrincipal::GetOriginSuffix(nsACStrin
 {
   mOriginAttributes.CreateSuffix(aOriginAttributes);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BasePrincipal::GetAppStatus(uint16_t* aAppStatus)
 {
-  if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
-    NS_WARNING("Asking for app status on a principal with an unknown app id");
-    *aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
-    return NS_OK;
-  }
-
-  *aAppStatus = nsScriptSecurityManager::AppStatusForPrincipal(this);
+  // TODO: Remove GetAppStatus.
+  *aAppStatus = nsIPrincipal::APP_STATUS_NOT_INSTALLED;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 BasePrincipal::GetAppId(uint32_t* aAppId)
 {
   if (AppId() == nsIScriptSecurityManager::UNKNOWN_APP_ID) {
     MOZ_ASSERT(false);
--- a/caps/nsScriptSecurityManager.cpp
+++ b/caps/nsScriptSecurityManager.cpp
@@ -51,17 +51,16 @@
 #include "nsDOMJSUtils.h"
 #include "nsAboutProtocolUtils.h"
 #include "nsIClassInfo.h"
 #include "nsIURIFixup.h"
 #include "nsCDefaultURIFixup.h"
 #include "nsIChromeRegistry.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIAsyncVerifyRedirectCallback.h"
-#include "mozIApplication.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/dom/BindingUtils.h"
 #include <stdint.h>
 #include "mozilla/dom/ScriptSettings.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/StaticPtr.h"
 #include "nsContentUtils.h"
 #include "nsJSUtils.h"
@@ -236,78 +235,16 @@ nsScriptSecurityManager::SecurityCompare
 // SecurityHashURI is consistent with SecurityCompareURIs because NS_SecurityHashURI
 // is consistent with NS_SecurityCompareURIs.  See nsNetUtil.h.
 uint32_t
 nsScriptSecurityManager::SecurityHashURI(nsIURI* aURI)
 {
     return NS_SecurityHashURI(aURI);
 }
 
-uint16_t
-nsScriptSecurityManager::AppStatusForPrincipal(nsIPrincipal *aPrin)
-{
-    uint32_t appId = aPrin->GetAppId();
-
-    // After bug 1238160, the principal no longer knows how to answer "is this a
-    // browser element", which is really what this code path wants. Currently,
-    // desktop is the only platform where we intend to disable isolation on a
-    // browser frame, so non-desktop should be able to assume that
-    // inIsolatedMozBrowser is true for all mozbrowser frames.  Additionally,
-    // apps are no longer used on desktop, so appId is always NO_APP_ID.  We use
-    // a release assertion in nsFrameLoader::OwnerIsIsolatedMozBrowserFrame so
-    // that platforms with apps can assume inIsolatedMozBrowser is true for all
-    // mozbrowser frames.
-    bool inIsolatedMozBrowser = aPrin->GetIsInIsolatedMozBrowserElement();
-
-    NS_WARNING_ASSERTION(
-      appId != nsIScriptSecurityManager::UNKNOWN_APP_ID,
-      "Asking for app status on a principal with an unknown app id");
-
-    // Installed apps have a valid app id (not NO_APP_ID or UNKNOWN_APP_ID)
-    // and they are not inside a mozbrowser.
-    if (appId == nsIScriptSecurityManager::NO_APP_ID ||
-        appId == nsIScriptSecurityManager::UNKNOWN_APP_ID ||
-        inIsolatedMozBrowser)
-    {
-        return nsIPrincipal::APP_STATUS_NOT_INSTALLED;
-    }
-
-    nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
-    NS_ENSURE_TRUE(appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-
-    nsCOMPtr<mozIApplication> app;
-    appsService->GetAppByLocalId(appId, getter_AddRefs(app));
-    NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-
-    uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;
-    NS_ENSURE_SUCCESS(app->GetAppStatus(&status),
-                      nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-
-    nsString appOrigin;
-    NS_ENSURE_SUCCESS(app->GetOrigin(appOrigin),
-                      nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-    nsCOMPtr<nsIURI> appURI;
-    NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(appURI), appOrigin),
-                      nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-
-    // The app could contain a cross-origin iframe - make sure that the content
-    // is actually same-origin with the app.
-    MOZ_ASSERT(inIsolatedMozBrowser == false, "Checked this above");
-    nsAutoCString suffix;
-    PrincipalOriginAttributes attrs;
-    NS_ENSURE_TRUE(attrs.PopulateFromOrigin(NS_ConvertUTF16toUTF8(appOrigin), suffix),
-                   nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-    attrs.mAppId = appId;
-    attrs.mInIsolatedMozBrowser = false;
-    nsCOMPtr<nsIPrincipal> appPrin = BasePrincipal::CreateCodebasePrincipal(appURI, attrs);
-    NS_ENSURE_TRUE(appPrin, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
-    return aPrin->Equals(appPrin) ? status
-                                  : nsIPrincipal::APP_STATUS_NOT_INSTALLED;
-}
-
 /*
  * GetChannelResultPrincipal will return the principal that the resource
  * returned by this channel will use.  For example, if the resource is in
  * a sandbox, it will return the nullprincipal.  If the resource is forced
  * to inherit principal, it will return the principal of its parent.  If
  * the load doesn't require sandboxing or inheriting, it will return the same
  * principal as GetChannelURIPrincipal. Namely the principal of the URI
  * that is being loaded.
--- a/caps/nsScriptSecurityManager.h
+++ b/caps/nsScriptSecurityManager.h
@@ -62,18 +62,16 @@ public:
      * Utility method for comparing two URIs.  For security purposes, two URIs
      * are equivalent if their schemes, hosts, and ports (if any) match.  This
      * method returns true if aSubjectURI and aObjectURI have the same origin,
      * false otherwise.
      */
     static bool SecurityCompareURIs(nsIURI* aSourceURI, nsIURI* aTargetURI);
     static uint32_t SecurityHashURI(nsIURI* aURI);
 
-    static uint16_t AppStatusForPrincipal(nsIPrincipal *aPrin);
-
     static nsresult
     ReportError(JSContext* cx, const nsAString& messageTag,
                 nsIURI* aSource, nsIURI* aTarget);
 
     static uint32_t
     HashPrincipalByOrigin(nsIPrincipal* aPrincipal);
 
     static bool
--- a/dom/apps/AppsService.js
+++ b/dom/apps/AppsService.js
@@ -32,21 +32,16 @@ function AppsService()
 
 AppsService.prototype = {
 
   isInvalidId: function(localId) {
     return (localId == Ci.nsIScriptSecurityManager.NO_APP_ID ||
             localId == Ci.nsIScriptSecurityManager.UNKNOWN_APP_ID);
   },
 
-  getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
-    debug("GetAppByManifestURL( " + aManifestURL + " )");
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
   getManifestFor: function getManifestFor(aManifestURL) {
     debug("getManifestFor(" + aManifestURL + ")");
     if (this.inParent) {
       throw Cr.NS_ERROR_NOT_IMPLEMENTED;
     } else {
       return Promise.reject(
         new Error("Calling getManifestFor() from child is not supported"));
     }
@@ -57,24 +52,16 @@ AppsService.prototype = {
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
   getAppLocalIdByStoreId: function getAppLocalIdByStoreId(aStoreId) {
     debug("getAppLocalIdByStoreId( " + aStoreId + " )");
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
-  getAppByLocalId: function getAppByLocalId(aLocalId) {
-    debug("getAppByLocalId( " + aLocalId + " )");
-    if (this.isInvalidId(aLocalId)) {
-      return null;
-    }
-    throw Cr.NS_ERROR_NOT_IMPLEMENTED;
-  },
-
   getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
     debug("getManifestURLByLocalId( " + aLocalId + " )");
     if (this.isInvalidId(aLocalId)) {
       return null;
     }
     throw Cr.NS_ERROR_NOT_IMPLEMENTED;
   },
 
--- a/dom/apps/AppsServiceChild.jsm
+++ b/dom/apps/AppsServiceChild.jsm
@@ -350,42 +350,26 @@ this.DOMApplicationRegistry = {
       }
     }
     return {};
   },
 
   /**
    * nsIAppsService API
    */
-  getAppByManifestURL: function getAppByManifestURL(aManifestURL) {
-    debug("getAppByManifestURL " + aManifestURL);
-    return AppsUtils.getAppByManifestURL(this.webapps, aManifestURL);
-  },
-
   getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aManifestURL) {
     debug("getAppLocalIdByManifestURL " + aManifestURL);
     return AppsUtils.getAppLocalIdByManifestURL(this.webapps, aManifestURL);
   },
 
   getAppLocalIdByStoreId: function(aStoreId) {
     debug("getAppLocalIdByStoreId:" + aStoreId);
     return AppsUtils.getAppLocalIdByStoreId(this.webapps, aStoreId);
   },
 
-  getAppByLocalId: function getAppByLocalId(aLocalId) {
-    debug("getAppByLocalId " + aLocalId + " - ready: " + this.ready);
-    let app = this.localIdIndex[aLocalId];
-    if (!app) {
-      debug("Ouch, No app!");
-      return null;
-    }
-
-    return new mozIApplication(app);
-  },
-
   getManifestURLByLocalId: function getManifestURLByLocalId(aLocalId) {
     debug("getManifestURLByLocalId " + aLocalId);
     return AppsUtils.getManifestURLByLocalId(this.webapps, aLocalId);
   },
 
   getCoreAppsBasePath: function getCoreAppsBasePath() {
     debug("getCoreAppsBasePath() not yet supported on child!");
     return null;
--- a/dom/apps/AppsUtils.jsm
+++ b/dom/apps/AppsUtils.jsm
@@ -21,69 +21,29 @@ XPCOMUtils.defineLazyModuleGetter(this, 
 
 XPCOMUtils.defineLazyServiceGetter(this, "appsService",
                                    "@mozilla.org/AppsService;1",
                                    "nsIAppsService");
 
 // Shared code for AppsServiceChild.jsm, Webapps.jsm and Webapps.js
 
 this.EXPORTED_SYMBOLS =
-  ["AppsUtils", "ManifestHelper", "isAbsoluteURI", "mozIApplication"];
+  ["AppsUtils", "ManifestHelper", "isAbsoluteURI"];
 
 function debug(s) {
   //dump("-*- AppsUtils.jsm: " + s + "\n");
 }
 
 this.isAbsoluteURI = function(aURI) {
   let foo = Services.io.newURI("http://foo", null, null);
   let bar = Services.io.newURI("http://bar", null, null);
   return Services.io.newURI(aURI, null, foo).prePath != foo.prePath ||
          Services.io.newURI(aURI, null, bar).prePath != bar.prePath;
 }
 
-this.mozIApplication = function(aApp) {
-  _setAppProperties(this, aApp);
-}
-
-mozIApplication.prototype = {
-  hasPermission: function(aPermission) {
-    // This helper checks an URI inside |aApp|'s origin and part of |aApp| has a
-    // specific permission. It is not checking if browsers inside |aApp| have such
-    // permission.
-    let perm = Services.perms.testExactPermissionFromPrincipal(this.principal,
-                                                               aPermission);
-    return (perm === Ci.nsIPermissionManager.ALLOW_ACTION);
-  },
-
-  get principal() {
-    if (this._principal) {
-      return this._principal;
-    }
-
-    this._principal = null;
-
-    try {
-      this._principal = Services.scriptSecurityManager.createCodebasePrincipal(
-        Services.io.newURI(this.origin, null, null),
-        {appId: this.localId});
-    } catch(e) {
-      dump("Could not create app principal " + e + "\n");
-    }
-
-    return this._principal;
-  },
-
-  QueryInterface: function(aIID) {
-    if (aIID.equals(Ci.mozIApplication) ||
-        aIID.equals(Ci.nsISupports))
-      return this;
-    throw Cr.NS_ERROR_NO_INTERFACE;
-  }
-}
-
 function _setAppProperties(aObj, aApp) {
   aObj.name = aApp.name;
   aObj.csp = aApp.csp;
   aObj.installOrigin = aApp.installOrigin;
   aObj.origin = aApp.origin;
 #ifdef MOZ_WIDGET_ANDROID
   aObj.apkPackageName = aApp.apkPackageName;
 #endif
@@ -215,31 +175,16 @@ this.AppsUtils = {
     let urlParser = Cc["@mozilla.org/network/url-parser;1?auth=no"]
                     .getService(Ci.nsIURLParser);
     let uriData = [aPagePath, aPagePath.length, {}, {}, {}, {}, {}, {}];
     urlParser.parsePath.apply(urlParser, uriData);
     let [{value: pathPos}, {value: pathLen}] = uriData.slice(2, 4);
     return aPagePath.substr(pathPos, pathLen);
   },
 
-  getAppByManifestURL: function getAppByManifestURL(aApps, aManifestURL) {
-    debug("getAppByManifestURL " + aManifestURL);
-    // This could be O(1) if |webapps| was a dictionary indexed on manifestURL
-    // which should be the unique app identifier.
-    // It's currently O(n).
-    for (let id in aApps) {
-      let app = aApps[id];
-      if (app.manifestURL == aManifestURL) {
-        return new mozIApplication(app);
-      }
-    }
-
-    return null;
-  },
-
   getManifestFor: function getManifestFor(aManifestURL) {
     debug("getManifestFor(" + aManifestURL + ")");
     return DOMApplicationRegistry.getManifestFor(aManifestURL);
   },
 
   getAppLocalIdByManifestURL: function getAppLocalIdByManifestURL(aApps, aManifestURL) {
     debug("getAppLocalIdByManifestURL " + aManifestURL);
     for (let id in aApps) {
@@ -257,28 +202,16 @@ this.AppsUtils = {
       if (aApps[id].storeId == aStoreId) {
         return aApps[id].localId;
       }
     }
 
     return Ci.nsIScriptSecurityManager.NO_APP_ID;
   },
 
-  getAppByLocalId: function getAppByLocalId(aApps, aLocalId) {
-    debug("getAppByLocalId " + aLocalId);
-    for (let id in aApps) {
-      let app = aApps[id];
-      if (app.localId == aLocalId) {
-        return new mozIApplication(app);
-      }
-    }
-
-    return null;
-  },
-
   getManifestURLByLocalId: function getManifestURLByLocalId(aApps, aLocalId) {
     debug("getManifestURLByLocalId " + aLocalId);
     for (let id in aApps) {
       let app = aApps[id];
       if (app.localId == aLocalId) {
         return app.manifestURL;
       }
     }
deleted file mode 100644
--- a/dom/apps/tests/unit/test_moziapplication.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource:///modules/AppsUtils.jsm");
-
-add_test(() => {
-  let app = {
-    name: "TestApp",
-    csp: "aCsp",
-    installOrigin: "http://installorigin.com",
-    origin: "http://www.example.com",
-    installTime: Date.now(),
-    manifestURL: "http://www.example.com/manifest.webapp",
-    appStatus: Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED,
-    removable: false,
-    id: 123,
-    localId: 123,
-    basePath: "/",
-    progress: 1.0,
-    installState: "installed",
-    downloadAvailable: false,
-    downloading: false,
-    lastUpdateCheck: Date.now(),
-    updateTime: Date.now(),
-    etag: "aEtag",
-    packageEtag: "aPackageEtag",
-    manifestHash: "aManifestHash",
-    packageHash: "aPackageHash",
-    staged: false,
-    installerAppId: 345,
-    installerIsBrowser: false,
-    storeId: "aStoreId",
-    storeVersion: 1,
-    role: "aRole",
-    kind: "aKind",
-    enabled: true,
-    sideloaded: false
-  };
-
-  let mozapp = new mozIApplication(app);
-
-  Object.keys(app).forEach((key) => {
-    if (key == "principal") {
-      return;
-    }
-    Assert.equal(app[key], mozapp[key],
-                 "app[" + key + "] should be equal to mozapp[" + key + "]");
-  });
-
-  Assert.ok(mozapp.principal, "app principal should exist");
-  let expectedPrincipalOrigin = app.origin + "^appId=" + app.localId;
-  Assert.equal(mozapp.principal.origin, expectedPrincipalOrigin,
-               "app principal origin ok");
-  Assert.equal(mozapp.principal.appId, app.localId, "app principal appId ok");
-  Assert.equal(mozapp.principal.isInIsolatedMozBrowserElement, false,
-               "app principal isInIsolatedMozBrowserElement ok");
-  run_next_test();
-});
-
-function run_test() {
-  run_next_test();
-}
--- a/dom/apps/tests/unit/xpcshell.ini
+++ b/dom/apps/tests/unit/xpcshell.ini
@@ -1,5 +1,4 @@
 [DEFAULT]
 
 [test_manifestSanitizer.js]
 [test_manifestHelper.js]
-[test_moziapplication.js]
--- a/dom/interfaces/apps/moz.build
+++ b/dom/interfaces/apps/moz.build
@@ -1,13 +1,12 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
-    'mozIApplication.idl',
     'nsIAppsService.idl',
 ]
 
 XPIDL_MODULE = 'dom_apps'
 
deleted file mode 100644
--- a/dom/interfaces/apps/mozIApplication.idl
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=8 et :
- */
-/* 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/. */
-
-#include "domstubs.idl"
-
-interface nsIPrincipal;
-
-/**
- * We expose Gecko-internal helpers related to "web apps" through this
- * sub-interface.
- */
-[scriptable, uuid(e76aa5e0-80b2-404f-bccc-1067828bb6ed)]
-interface mozIApplication: nsISupports
-{
-  /* Return true if this app has |permission|. */
-  boolean hasPermission(in string permission);
-
-  /* Application status as defined in nsIPrincipal. */
-  readonly attribute unsigned short appStatus;
-
-  /* Returns the uuid of the app. */
-  readonly attribute DOMString id;
-
-  /* Returns the origin of the app. */
-  readonly attribute DOMString origin;
-
-  /* Returns the manifest url of the app. */
-  readonly attribute DOMString manifestURL;
-
-  /* Returns the local id of the app. */
-  readonly attribute unsigned long localId;
-
-  /* Returns the base directory for the app */
-  readonly attribute DOMString basePath;
-
-  /* Name copied from the manifest */
-  readonly attribute DOMString name;
-
-  /* CSP copied from the manifest */
-  readonly attribute DOMString csp;
-
-  /* Store ID if the app is installed from a store */
-  readonly attribute DOMString storeID;
-
-  /* Store version if the app is installed from a store */
-  readonly attribute unsigned long storeVersion;
-
-  /* role copied from the manifest */
-  readonly attribute DOMString role;
-
-  /* Returns the kind of the app. */
-  readonly attribute DOMString kind;
-
-  /* Returns the app's principal */
-  readonly attribute nsIPrincipal principal;
-};
--- a/dom/interfaces/apps/nsIAppsService.idl
+++ b/dom/interfaces/apps/nsIAppsService.idl
@@ -1,52 +1,42 @@
 /* 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/. */
 
 #include "domstubs.idl"
 
-interface mozIApplication;
-interface nsIURI;
-
 %{C++
 #define APPS_SERVICE_CID { 0x05072afa, 0x92fe, 0x45bf, { 0xae, 0x22, 0x39, 0xb6, 0x9c, 0x11, 0x70, 0x58 } }
 #define APPS_SERVICE_CONTRACTID "@mozilla.org/AppsService;1"
 %}
 
 /*
  * This service allows accessing some DOMApplicationRegistry methods from
  * non-javascript code.
  */
 [scriptable, uuid(711cfab6-7b72-4aa2-a60c-17952ea05661)]
 interface nsIAppsService : nsISupports
 {
-  mozIApplication getAppByManifestURL(in DOMString manifestURL);
-
   /**
    * Returns a Promise for the manifest for a given manifestURL.
    * This is only supported in the parent process: the promise will be rejected
    * in content processes.
    */
   jsval getManifestFor(in DOMString manifestURL);
 
   /**
    * Returns the |localId| of the app associated with the |manifestURL| passed
    * in parameter.
    * Returns nsIScriptSecurityManager::NO_APP_ID if |manifestURL| isn't a valid
    * installed manifest URL.
    */
   unsigned long getAppLocalIdByManifestURL(in DOMString manifestURL);
 
   /**
-   * Returns the application associated to this localId.
-   */
-  mozIApplication getAppByLocalId(in unsigned long localId);
-
-  /**
    * Returns the manifest URL associated to this localId.
    */
   DOMString getManifestURLByLocalId(in unsigned long localId);
 
   /**
    * Returns the basepath for core apps
    */
   DOMString getCoreAppsBasePath();
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -41,17 +41,16 @@
 #include "mozilla/Move.h"
 #include "mozilla/ProcessHangMonitor.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/Services.h"
 #include "mozilla/StaticPtr.h"
 #include "mozilla/TextEvents.h"
 #include "mozilla/TouchEvents.h"
 #include "mozilla/Unused.h"
-#include "mozIApplication.h"
 #include "nsContentUtils.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsDocShell.h"
 #include "nsEmbedCID.h"
 #include "nsGlobalWindow.h"
 #include <algorithm>
 #ifdef MOZ_CRASHREPORTER
 #include "nsExceptionHandler.h"
--- a/testing/specialpowers/content/specialpowersAPI.js
+++ b/testing/specialpowers/content/specialpowersAPI.js
@@ -1769,26 +1769,16 @@ SpecialPowersAPI.prototype = {
   _getPrincipalFromArg: function(arg) {
     let principal;
     let secMan = Services.scriptSecurityManager;
 
     if (typeof(arg) == "string") {
       // It's an URL.
       let uri = Services.io.newURI(arg, null, null);
       principal = secMan.createCodebasePrincipal(uri, {});
-    } else if (arg.manifestURL) {
-      // It's a thing representing an app.
-      let appsSvc = Cc["@mozilla.org/AppsService;1"]
-                      .getService(Ci.nsIAppsService)
-      let app = appsSvc.getAppByManifestURL(arg.manifestURL);
-      if (!app) {
-        throw "No app for this manifest!";
-      }
-
-      principal = app.principal;
     } else if (arg.nodePrincipal) {
       // It's a document.
       // In some tests the arg is a wrapped DOM element, so we unwrap it first.
       principal = unwrapIfWrapped(arg).nodePrincipal;
     } else {
       let uri = Services.io.newURI(arg.url, null, null);
       let attrs = arg.originAttributes || {};
       principal = secMan.createCodebasePrincipal(uri, attrs);