Bug 1367407 - Early return from timeline render if destroy was called; r=daisuke

MozReview-Commit-ID: L1I1qSSIOBf

--HG--
extra : rebase_source : da1b35b969b9e58b339b4962eb2d5f661b0ad81a
This commit is contained in:
Patrick Brosset 2017-06-13 13:56:22 +02:00
parent cc4ada49d0
commit de00d543b8

View File

@ -262,6 +262,8 @@ AnimationsTimeline.prototype = {
this.animationDetailCloseButton = null;
this.animationRootEl = null;
this.selectedAnimation = null;
this.isDestroyed = true;
},
/**
@ -486,6 +488,11 @@ AnimationsTimeline.prototype = {
// Draw the animation time block.
const tracks = yield this.getTracks(animation);
// If we're destroyed by now, just give up.
if (this.isDestroyed) {
return;
}
let timeBlock = new AnimationTimeBlock();
timeBlock.init(timeBlockEl);
timeBlock.render(animation, tracks);
@ -674,7 +681,16 @@ AnimationsTimeline.prototype = {
* handle.
*/
if (this.serverTraits.hasGetProperties) {
let properties = yield animation.getProperties();
let properties = [];
try {
properties = yield animation.getProperties();
} catch (e) {
// Expected if we've already been destroyed in the meantime.
if (!this.isDestroyed) {
throw e;
}
}
for (let {name, values} of properties) {
if (!tracks[name]) {
tracks[name] = [];
@ -686,7 +702,16 @@ AnimationsTimeline.prototype = {
}
}
} else {
let frames = yield animation.getFrames();
let frames = [];
try {
frames = yield animation.getFrames();
} catch (e) {
// Expected if we've already been destroyed in the meantime.
if (!this.isDestroyed) {
throw e;
}
}
for (let frame of frames) {
for (let name in frame) {
if (this.NON_PROPERTIES.indexOf(name) != -1) {