mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 09:15:35 +00:00
Bug 1462229 - Part 3: Guard that not touching null object during creating graph after animation inspector destroyed. r=gl
MozReview-Commit-ID: 2UWt3aq1e4x --HG-- extra : rebase_source : ef6f2047efccde2fbc80b0cbfb4b82a181ecf1dd
This commit is contained in:
parent
eae57fa593
commit
7703af13b4
@ -532,6 +532,11 @@ class AnimationInspector {
|
||||
* https://drafts.csswg.org/web-animations/#the-animation-interface
|
||||
*/
|
||||
simulateAnimation(keyframes, effectTiming, isElementNeeded) {
|
||||
// Don't simulate animation if the animation inspector is already destroyed.
|
||||
if (!this.win) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let targetEl = null;
|
||||
|
||||
if (isElementNeeded) {
|
||||
@ -642,6 +647,11 @@ class AnimationInspector {
|
||||
}
|
||||
|
||||
updateState(animations) {
|
||||
// Animation inspector already destroyed
|
||||
if (!this.inspector) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.stopAnimationsCurrentTimeTimer();
|
||||
|
||||
this.inspector.store.dispatch(updateAnimations(animations));
|
||||
|
@ -50,7 +50,13 @@ class ComputedTimingPath extends TimingPath {
|
||||
easing: keyframe.easing
|
||||
};
|
||||
});
|
||||
|
||||
const simulatedAnimation = simulateAnimation(frames, effectTiming, true);
|
||||
|
||||
if (!simulatedAnimation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const simulatedElement = simulatedAnimation.effect.target;
|
||||
const win = simulatedElement.ownerGlobal;
|
||||
const endTime = simulatedAnimation.effect.getComputedTiming().endTime;
|
||||
|
@ -36,6 +36,11 @@ class EffectTimingPath extends TimingPath {
|
||||
});
|
||||
|
||||
const simulatedAnimation = simulateAnimation(null, effectTiming, false);
|
||||
|
||||
if (!simulatedAnimation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const endTime = simulatedAnimation.effect.getComputedTiming().endTime;
|
||||
|
||||
const getValueFunc = time => {
|
||||
|
@ -52,6 +52,11 @@ class NegativePath extends PureComponent {
|
||||
});
|
||||
|
||||
const simulatedAnimation = simulateAnimation(frames, effectTiming, true);
|
||||
|
||||
if (!simulatedAnimation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const simulatedElement = simulatedAnimation.effect.target;
|
||||
const win = simulatedElement.ownerGlobal;
|
||||
|
||||
|
@ -83,7 +83,13 @@ class ComputedStylePath extends PureComponent {
|
||||
duration,
|
||||
fill: "forwards",
|
||||
};
|
||||
|
||||
const simulatedAnimation = simulateAnimation(keyframes, effect, true);
|
||||
|
||||
if (!simulatedAnimation) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const simulatedElement = simulatedAnimation.effect.target;
|
||||
const win = simulatedElement.ownerGlobal;
|
||||
const threshold = getPreferredProgressThresholdByKeyframes(keyframes);
|
||||
@ -181,7 +187,13 @@ class ComputedStylePath extends PureComponent {
|
||||
for (let i = 0; i < keyframes.length - 1; i++) {
|
||||
const startKeyframe = keyframes[i];
|
||||
const endKeyframe = keyframes[i + 1];
|
||||
segments.push(...this.getPathSegments(startKeyframe, endKeyframe));
|
||||
const keyframesSegments = this.getPathSegments(startKeyframe, endKeyframe);
|
||||
|
||||
if (!keyframesSegments) {
|
||||
return null;
|
||||
}
|
||||
|
||||
segments.push(...keyframesSegments);
|
||||
}
|
||||
|
||||
return [
|
||||
|
Loading…
Reference in New Issue
Block a user