Bug 918658 - Don't pretend that mozIApplication inherits from mozIDOMApplication r=bent

This commit is contained in:
Fabrice Desré 2013-10-08 15:52:26 -07:00
parent de4321f3a8
commit 94d42490f8
10 changed files with 27 additions and 37 deletions

View File

@ -572,9 +572,8 @@ nsPrincipal::GetAppStatus()
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
nsCOMPtr<mozIDOMApplication> domApp;
appsService->GetAppByLocalId(mAppId, getter_AddRefs(domApp));
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
nsCOMPtr<mozIApplication> app;
appsService->GetAppByLocalId(mAppId, getter_AddRefs(app));
NS_ENSURE_TRUE(app, nsIPrincipal::APP_STATUS_NOT_INSTALLED);
uint16_t status = nsIPrincipal::APP_STATUS_INSTALLED;

View File

@ -1449,11 +1449,9 @@ nsFrameLoader::GetOwnApp()
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, nullptr);
nsCOMPtr<mozIDOMApplication> domApp;
appsService->GetAppByManifestURL(manifest, getter_AddRefs(domApp));
nsCOMPtr<mozIApplication> app;
appsService->GetAppByManifestURL(manifest, getter_AddRefs(app));
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
MOZ_ASSERT_IF(domApp, app);
return app.forget();
}
@ -1472,12 +1470,9 @@ nsFrameLoader::GetContainingApp()
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, nullptr);
nsCOMPtr<mozIDOMApplication> domApp;
appsService->GetAppByLocalId(appId, getter_AddRefs(domApp));
MOZ_ASSERT(domApp);
nsCOMPtr<mozIApplication> app;
appsService->GetAppByLocalId(appId, getter_AddRefs(app));
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
MOZ_ASSERT_IF(domApp, app);
return app.forget();
}

View File

@ -14,7 +14,7 @@
#include "mozilla/ErrorResult.h"
#include "nsIAppsService.h"
#include "nsServiceManagerUtils.h"
#include "nsIDOMApplicationRegistry.h"
#include "mozIApplication.h"
#include "nsIPermissionManager.h"
#include "GeckoProfiler.h"
@ -415,7 +415,7 @@ nsGenericHTMLFrameElement::GetAppManifestURL(nsAString& aOut)
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, NS_OK);
nsCOMPtr<mozIDOMApplication> app;
nsCOMPtr<mozIApplication> app;
appsService->GetAppByManifestURL(manifestURL, getter_AddRefs(app));
if (app) {
aOut.Assign(manifestURL);

View File

@ -55,8 +55,7 @@ mozIApplication.prototype = {
},
QueryInterface: function(aIID) {
if (aIID.equals(Ci.mozIDOMApplication) ||
aIID.equals(Ci.mozIApplication) ||
if (aIID.equals(Ci.mozIApplication) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;

View File

@ -5,14 +5,14 @@
* 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 "nsIDOMApplicationRegistry.idl"
#include "domstubs.idl"
/**
* We expose Gecko-internal helpers related to "web apps" through this
* sub-interface.
*/
[scriptable, uuid(11322d0c-e98e-442d-97a6-8b197d5b888e)]
interface mozIApplication: mozIDOMApplication
[scriptable, uuid(7bd62430-c374-49eb-be1b-ce821a180360)]
interface mozIApplication: nsISupports
{
/* Return true if this app has |permission|. */
boolean hasPermission(in string permission);
@ -23,6 +23,12 @@ interface mozIApplication: mozIDOMApplication
/* 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;

View File

@ -17,10 +17,10 @@ interface nsIURI;
* This service allows accessing some DOMApplicationRegistry methods from
* non-javascript code.
*/
[scriptable, uuid(9b23d8f0-b2f3-46af-bff4-3df6c3cb69db)]
[scriptable, uuid(93cde78d-56f6-4322-b707-9b23eb80d90d)]
interface nsIAppsService : nsISupports
{
mozIDOMApplication getAppByManifestURL(in DOMString manifestURL);
mozIApplication getAppByManifestURL(in DOMString manifestURL);
/**
* Returns the |localId| of the app associated with the |manifestURL| passed
@ -33,7 +33,7 @@ interface nsIAppsService : nsISupports
/**
* Returns the application associated to this localId.
*/
mozIDOMApplication getAppByLocalId(in unsigned long localId);
mozIApplication getAppByLocalId(in unsigned long localId);
/**
* Returns the manifest URL associated to this localId.

View File

@ -10,7 +10,6 @@
#include "ContentParent.h"
#include "mozIApplication.h"
#include "mozilla/hal_sandbox/PHalParent.h"
#include "nsIDOMApplicationRegistry.h"
#include "TabParent.h"
using namespace mozilla::dom;

View File

@ -62,7 +62,6 @@
#include "nsIAlertsService.h"
#include "nsIAppsService.h"
#include "nsIClipboard.h"
#include "nsIDOMApplicationRegistry.h"
#include "nsIDOMGeoGeolocation.h"
#include "nsIDOMWakeLock.h"
#include "nsIDOMWindow.h"
@ -986,10 +985,9 @@ TryGetNameFromManifestURL(const nsAString& aManifestURL,
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE_VOID(appsService);
nsCOMPtr<mozIDOMApplication> domApp;
appsService->GetAppByManifestURL(aManifestURL, getter_AddRefs(domApp));
nsCOMPtr<mozIApplication> app;
appsService->GetAppByManifestURL(aManifestURL, getter_AddRefs(app));
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
if (!app) {
return;
}

View File

@ -227,10 +227,9 @@ GetAppForId(uint32_t aAppId)
nsCOMPtr<nsIAppsService> appsService = do_GetService(APPS_SERVICE_CONTRACTID);
NS_ENSURE_TRUE(appsService, nullptr);
nsCOMPtr<mozIDOMApplication> domApp;
appsService->GetAppByLocalId(aAppId, getter_AddRefs(domApp));
nsCOMPtr<mozIApplication> app;
appsService->GetAppByLocalId(aAppId, getter_AddRefs(app));
nsCOMPtr<mozIApplication> app = do_QueryInterface(domApp);
return app.forget();
}

View File

@ -371,13 +371,8 @@ NeckoParent::AllocPRemoteOpenFileParent(const URIParams& aURI,
nsRefPtr<TabParent> tabParent =
static_cast<TabParent*>(Manager()->ManagedPBrowserParent()[i]);
uint32_t appId = tabParent->OwnOrContainingAppId();
nsCOMPtr<mozIDOMApplication> domApp;
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(domApp));
if (!domApp) {
continue;
}
mozApp = do_QueryInterface(domApp);
if (!mozApp) {
nsresult rv = appsService->GetAppByLocalId(appId, getter_AddRefs(mozApp));
if (NS_FAILED(rv) || !mozApp) {
continue;
}
hasManage = false;