Skip to content

Commit

Permalink
refs #16337. Fix broken view after some cases of concurrent transitio…
Browse files Browse the repository at this point in the history
…ns + fix for compat mode. Thanks ykami & Adrian Vasiliu (IBM, CCLA). !strict.
  • Loading branch information
cjolif committed Jan 23, 2013
1 parent 633573b commit f3e1b79
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
12 changes: 11 additions & 1 deletion mobile/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,14 @@ define([
}
}
this._clearClasses(toNode); // just in case toNode is a sibling of an ancestor.

// #16337
// Uninitialization may fail to clear _inProgress when multiple
// performTransition calls occur in a short duration of time.
var toWidget = registry.byNode(toNode);
if(toWidget){
toWidget._inProgress = false;
}
},

convertToId: function(moveTo){
Expand Down Expand Up @@ -273,7 +281,8 @@ define([
// Transition forward to a blank view, and then open another page.
// | performTransition(null, 1, "slide", null, function(){location.href = href;});

if(this._detail){ return; } // transition is in progress
if(this._inProgress){ return; } // transition is in progress
this._inProgress = true;

// normalize the arg
var detail, optArgs;
Expand Down Expand Up @@ -558,6 +567,7 @@ define([
}
}
this._detail = this._optArgs = this._arguments = undefined;
this._inProgress = false;
},

isVisible: function(/*Boolean?*/checkAncestors){
Expand Down
4 changes: 4 additions & 0 deletions mobile/_compat.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ return {
toNode.style.display = "";
anim = fx.combine([s1,s2]);
connect.connect(anim, "onEnd", this, function(){
if(!this._inProgress){ return; } // transition has been aborted
fromNode.style.display = "none";
fromNode.style.left = "0px";
toNode.style.position = "relative";
Expand Down Expand Up @@ -132,6 +133,7 @@ return {
toNode.style.display = "";
anim = fx.combine([s1,s2]);
connect.connect(anim, "onEnd", this, function(){
if(!this._inProgress){ return; } // transition has been aborted
fromNode.style.display = "none";
toNode.style.position = "relative";
this.invokeCallback();
Expand All @@ -147,6 +149,7 @@ return {
toNode.style.position = "absolute";
toNode.style.left = "0px";
connect.connect(anim, "onEnd", this, function(){
if(!this._inProgress){ return; } // transition has been aborted
fromNode.style.display = "none";
toNode.style.position = "relative";
toNode.style.display = "";
Expand All @@ -170,6 +173,7 @@ return {
toNode.style.display = "";
domStyle.set(toNode, "opacity", 0);
connect.connect(anim, "onEnd", this, function(){
if(!this._inProgress){ return; } // transition has been aborted
fromNode.style.display = "none";
toNode.style.position = "relative";
domStyle.set(fromNode, "opacity", 1);
Expand Down

0 comments on commit f3e1b79

Please sign in to comment.