Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21743 from cctuan/1036788
Browse files Browse the repository at this point in the history
Bug 1036788 - Stop using origins to identify apps
  • Loading branch information
cctuan committed Jul 18, 2014
2 parents 24ada16 + 12c6f5d commit a43c96b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/system/js/app_window_factory.js
Expand Up @@ -176,7 +176,7 @@
if (config.manifest.role === 'search') {
return;
}
var app = AppWindowManager.getApp(config.origin);
var app = AppWindowManager.getApp(config.origin, config.manifestURL);
if (app) {
app.reviveBrowser();
} else if (config.origin !== homescreenLauncher.origin) {
Expand Down
15 changes: 9 additions & 6 deletions apps/system/js/app_window_manager.js
Expand Up @@ -42,23 +42,25 @@
/**
* Match app origin and get the first matching one.
* @param {String} origin The origin to be matched.
* @param {String} [manifestURL] The manifestURL to be matched.
* @return {AppWindow} The app window object matched.
*/
getApp: function awm_getApp(origin) {
getApp: function awm_getApp(origin, manifestURL) {
for (var id in this._apps) {
if (this._apps[id].origin == origin) {
if (this._apps[id].origin === origin &&
(!manifestURL || this._apps[id].manifestURL === manifestURL)) {
return this._apps[id];
}
}
return null;
},

/**
* Match app origin and get the first matching one.
* Get all apps.
* @return {Object} The running app window references stored
* by its instanceID.
*/
getApps: function awm_getApps(origin) {
getApps: function awm_getApps() {
return this._apps;
},

Expand Down Expand Up @@ -679,9 +681,10 @@
* @param {String} origin The origin of the running app window to be killed.
* @memberOf module:AppWindowManager
*/
kill: function awm_kill(origin) {
kill: function awm_kill(origin, manifestURL) {
for (var id in this._apps) {
if (this._apps[id].origin === origin) {
if (this._apps[id].origin === origin &&
(!manifestURL || this._apps[id].manifestURL === manifestURL)) {
this._apps[id].kill();
}
}
Expand Down
2 changes: 1 addition & 1 deletion apps/system/js/icc_worker.js
Expand Up @@ -326,7 +326,7 @@ var icc_worker = {
'icc.data': JSON.stringify(message)
});
reqIccData.onsuccess = function icc_getIccData() {
if (AppWindowManager.getApps(application)) {
if (AppWindowManager.getApp(application)) {
return DUMP('Settings is running. Ignoring');
}
navigator.mozApps.mgmt.getAll().onsuccess = function gotApps(evt) {
Expand Down

0 comments on commit a43c96b

Please sign in to comment.