зеркало из https://github.com/mozilla/gecko-dev.git
Bug 912340 - Add the manifest's 'role' property to mozIApplication. r=fabrice
--HG-- extra : rebase_source : 1b816681777578222c30d0184a865cf68e2c8efb
This commit is contained in:
Родитель
75da4fb1b8
Коммит
fb55ba5754
|
@ -93,6 +93,7 @@ this.AppsUtils = {
|
|||
installerIsBrowser: !!aApp.installerIsBrowser,
|
||||
storeId: aApp.storeId || "",
|
||||
storeVersion: aApp.storeVersion || 0,
|
||||
role: aApp.role || "",
|
||||
redirects: aApp.redirects
|
||||
};
|
||||
},
|
||||
|
@ -320,6 +321,10 @@ this.AppsUtils = {
|
|||
}
|
||||
}
|
||||
|
||||
// The 'role' field must be a string.
|
||||
if (aManifest.role && (typeof aManifest.role !== "string")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
|
@ -639,5 +644,9 @@ ManifestHelper.prototype = {
|
|||
fullPackagePath: function() {
|
||||
let packagePath = this._localeProp("package_path");
|
||||
return this._origin.resolve(packagePath ? packagePath : "");
|
||||
},
|
||||
|
||||
get role() {
|
||||
return this._manifest.role || "";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,6 +190,11 @@ this.DOMApplicationRegistry = {
|
|||
this.webapps[id].storeVersion = 0;
|
||||
}
|
||||
|
||||
// Default role to "".
|
||||
if (this.webapps[id].role === undefined) {
|
||||
this.webapps[id].role = "";
|
||||
}
|
||||
|
||||
// At startup we can't be downloading, and the $TMP directory
|
||||
// will be empty so we can't just apply a staged update.
|
||||
app.downloading = false;
|
||||
|
@ -242,13 +247,14 @@ this.DOMApplicationRegistry = {
|
|||
if (supportSystemMessages()) {
|
||||
this._processManifestForIds(ids, aRunUpdate);
|
||||
} else {
|
||||
// Read the CSPs. If MOZ_SYS_MSG is defined this is done on
|
||||
// Read the CSPs and roles. If MOZ_SYS_MSG is defined this is done on
|
||||
// _processManifestForIds so as to not reading the manifests
|
||||
// twice
|
||||
this._readManifests(ids, (function readCSPs(aResults) {
|
||||
aResults.forEach(function registerManifest(aResult) {
|
||||
let app = this.webapps[aResult.id];
|
||||
app.csp = aResult.manifest.csp || "";
|
||||
app.role = aResult.manifest.role || "";
|
||||
if (app.appStatus >= Ci.nsIPrincipal.APP_STATUS_PRIVILEGED) {
|
||||
app.redirects = this.sanitizeRedirects(aResult.redirects);
|
||||
}
|
||||
|
@ -734,6 +740,7 @@ this.DOMApplicationRegistry = {
|
|||
let manifest = aResult.manifest;
|
||||
app.name = manifest.name;
|
||||
app.csp = manifest.csp || "";
|
||||
app.role = manifest.role || "";
|
||||
if (app.appStatus >= Ci.nsIPrincipal.APP_STATUS_PRIVILEGED) {
|
||||
app.redirects = this.sanitizeRedirects(manifest.redirects);
|
||||
}
|
||||
|
@ -1477,6 +1484,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
app.name = manifest.name;
|
||||
app.csp = manifest.csp || "";
|
||||
app.role = manifest.role || "";
|
||||
app.updateTime = Date.now();
|
||||
} else {
|
||||
manifest = new ManifestHelper(aOldManifest, app.origin);
|
||||
|
@ -2057,6 +2065,7 @@ this.DOMApplicationRegistry = {
|
|||
|
||||
appObject.name = manifest.name;
|
||||
appObject.csp = manifest.csp || "";
|
||||
appObject.role = manifest.role || "";
|
||||
|
||||
appObject.installerAppId = aData.appId;
|
||||
appObject.installerIsBrowser = aData.isBrowser;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
* We expose Gecko-internal helpers related to "web apps" through this
|
||||
* sub-interface.
|
||||
*/
|
||||
[scriptable, uuid(05c57885-27cf-47fc-8da7-eeec9eb853a7)]
|
||||
[scriptable, uuid(11322d0c-e98e-442d-97a6-8b197d5b888e)]
|
||||
interface mozIApplication: mozIDOMApplication
|
||||
{
|
||||
/* Return true if this app has |permission|. */
|
||||
|
@ -40,4 +40,7 @@ interface mozIApplication: mozIDOMApplication
|
|||
|
||||
/* Store version if the app is installed from a store */
|
||||
readonly attribute unsigned long storeVersion;
|
||||
|
||||
/* role copied from the manifest */
|
||||
readonly attribute DOMString role;
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче