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 #7874 from alivedise/bugzilla/833454_v1-train/card…
Browse files Browse the repository at this point in the history
…s-view-stuck

Bug 833454 - Window manager app switch transition race condition, r=timdream, a=blocking-b2g:tef+
  • Loading branch information
alivedise committed Jan 31, 2013
2 parents d2be3b1 + 72172bf commit 2727664
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 9 deletions.
25 changes: 25 additions & 0 deletions apps/system/js/window.js
Expand Up @@ -7,6 +7,29 @@

var _ = navigator.mozL10n.get;

var ENABLE_LOG = false;

// Use mutation observer to monitor appWindow status change
window.AppLog = function AppLog(app) {
// select the target node
var target = app.frame;

// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.target.id,
mutation.target.className,
mutation.attributeName);
});
});

// configuration of the observer:
var config = { attributes: true };

// pass in the target node, as well as the observer options
observer.observe(target, config);
}

window.AppError = function AppError(app) {
var self = this;
this.app = app;
Expand Down Expand Up @@ -108,6 +131,8 @@
// we may need to export the error state of AppWindow instance to the other module
// in the future.
this.appError = new AppError(this);
if (ENABLE_LOG)
this.appLog = new AppLog(this);

return this;
};
Expand Down
22 changes: 13 additions & 9 deletions apps/system/js/window_manager.js
Expand Up @@ -337,8 +337,17 @@ var WindowManager = (function() {
classList.add('closing-card');

if (openFrame) {
openFrame.classList.remove('opening-card');
openFrame.classList.add('opening-switching');
if (openFrame.classList.contains('opening-card')) {
openFrame.classList.remove('opening-card');
openFrame.classList.add('opening-switching');
} else {
// Skip the opening-card and opening-switching transition
// because the closing-card transition had already finished here.
if (openFrame.classList.contains('fullscreen-app')) {
screenElement.classList.add('fullscreen-app');
}
openFrame.classList.add('opening');
}
}
} else if (classList.contains('closing-card')) {
windowClosed(frame);
Expand All @@ -352,12 +361,7 @@ var WindowManager = (function() {
}

classList.remove('opening-switching');

// XXX: without this setTimeout() there will be no opening transition.
// See https://bugzilla.mozilla.org/show_bug.cgi?id=780692#c111
setTimeout(function continueTransition() {
classList.add('opening');
});
classList.add('opening');
} else if (classList.contains('opening')) {
windowOpened(frame);

Expand Down Expand Up @@ -690,7 +694,7 @@ var WindowManager = (function() {

if (!screenElement.classList.contains('switch-app')) {
openFrame.classList.add('opening');
} else {
} else if (!openFrame.classList.contains('opening')) {
openFrame.classList.add('opening-card');
}
};
Expand Down

0 comments on commit 2727664

Please sign in to comment.