From c2faa7ed89e79c88e8a104a56592a9aa40fa4c3e Mon Sep 17 00:00:00 2001 From: Dave Hylands Date: Mon, 10 Sep 2012 21:30:10 -0700 Subject: [PATCH] Bug 784805 - Add a name field to mozIApplication and set it from the manifest r=fabrice --- dom/apps/src/AppsUtils.jsm | 1 + dom/apps/src/Webapps.jsm | 2 ++ dom/interfaces/apps/mozIApplication.idl | 5 ++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dom/apps/src/AppsUtils.jsm b/dom/apps/src/AppsUtils.jsm index 36237361b160..1318ac461ff4 100644 --- a/dom/apps/src/AppsUtils.jsm +++ b/dom/apps/src/AppsUtils.jsm @@ -24,6 +24,7 @@ let AppsUtils = { // Clones a app, without the manifest. cloneAppObject: function cloneAppObject(aApp) { return { + name: aApp.name, installOrigin: aApp.installOrigin, origin: aApp.origin, receipts: aApp.receipts ? JSON.parse(JSON.stringify(aApp.receipts)) : null, diff --git a/dom/apps/src/Webapps.jsm b/dom/apps/src/Webapps.jsm index 836f1f573bd7..7568b2848a9d 100644 --- a/dom/apps/src/Webapps.jsm +++ b/dom/apps/src/Webapps.jsm @@ -179,6 +179,7 @@ let DOMApplicationRegistry = { let app = this.webapps[aId]; this._readManifests([{ id: aId }], (function registerManifest(aResult) { let manifest = aResult[0].manifest; + app.name = manifest.name; this._registerSystemMessages(manifest, app); this._registerActivities(manifest, app); }).bind(this)); @@ -368,6 +369,7 @@ let DOMApplicationRegistry = { this.webapps[id] = appObject; appObject.status = "installed"; + appObject.name = app.manifest.name; let manifest = new DOMApplicationManifest(app.manifest, app.origin); diff --git a/dom/interfaces/apps/mozIApplication.idl b/dom/interfaces/apps/mozIApplication.idl index d1f68617e4a0..02c3cf95dc2b 100644 --- a/dom/interfaces/apps/mozIApplication.idl +++ b/dom/interfaces/apps/mozIApplication.idl @@ -11,7 +11,7 @@ * We expose Gecko-internal helpers related to "web apps" through this * sub-interface. */ -[scriptable, uuid(764e8930-ff06-4f23-9a6a-8523b93ac09f)] +[scriptable, uuid(efe22f80-f973-11e1-8a00-b7888ac0d2b9)] interface mozIApplication: mozIDOMApplication { /* Return true if this app has |permission|. */ @@ -22,4 +22,7 @@ interface mozIApplication: mozIDOMApplication /* Returns the local id of the app (not the uuid used for sync). */ readonly attribute unsigned long localId; + + /* Name copied from the manifest */ + readonly attribute DOMString name; };