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

Commit

Permalink
Bug 1039955 - Fix direct circular activity
Browse files Browse the repository at this point in the history
  • Loading branch information
alivedise committed Aug 28, 2014
1 parent 553f796 commit bb46002
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
8 changes: 6 additions & 2 deletions apps/system/js/app_window_manager.js
Expand Up @@ -661,8 +661,12 @@
var caller;
var callee = this.getApp(config.origin);
caller = this._activeApp.getTopMostWindow();
callee.callerWindow = caller;
caller.calleeWindow = callee;
if (caller.getBottomMostWindow() === callee) {
callee.frontWindow.kill();
} else {
callee.callerWindow = caller;
caller.calleeWindow = callee;
}
},

debug: function awm_debug() {
Expand Down
20 changes: 19 additions & 1 deletion apps/system/test/unit/app_window_manager_test.js
Expand Up @@ -855,7 +855,6 @@ suite('system/AppWindowManager', function() {
// callee is app7, caller is app2
injectRunningApps(app7);
AppWindowManager._activeApp = app1;
fakeAppConfig.parentApp = '';
this.sinon.stub(app1, 'getTopMostWindow').returns(app2);

AppWindowManager.linkWindowActivity(fakeAppConfig);
Expand All @@ -864,6 +863,25 @@ suite('system/AppWindowManager', function() {
assert.deepEqual(app7.callerWindow, app2);
assert.isFalse(homescreenLauncher.getHomescreen.called);
});

test('If there is a direct circular activity, ' +
'close the frontwindow to reveal the callee',
function() {
// callee is app1, caller is app3(a front window)
injectRunningApps(app1);
AppWindowManager._activeApp = app1;
fakeAppConfig.parentApp = '';
app1.frontWindow = app3;
this.sinon.stub(app1, 'getTopMostWindow').returns(app3);
this.sinon.stub(app3, 'getBottomMostWindow').returns(app1);
var stubKill = this.sinon.stub(app3, 'kill');

AppWindowManager.linkWindowActivity(fakeAppConfig1);

assert.isTrue(stubKill.called);
assert.isUndefined(app1.callerWindow);
app1.frontWindow = null;
});
});

test('getApp', function() {
Expand Down

0 comments on commit bb46002

Please sign in to comment.