Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clear readyQueue with dispose #6967

Merged
merged 5 commits into from
Dec 11, 2020
Merged

fix: clear readyQueue with dispose #6967

merged 5 commits into from
Dec 11, 2020

Conversation

brandonocasey
Copy link
Contributor

Description

Seems like we never clear the internal readyQueue_ when calling dispose which may cause the issues seen in #6701 (comment) and #5706

@brandonocasey
Copy link
Contributor Author

I updated this pull request slightly when adding a unit test I realized that this case will also throw an error when it happens about nodeName since we don't check for null in validateTarget. The error was also too vague for my liking but we can back that part of the changes out if we think that it's too much for this pull request.

const validateTarget = (target) => {
if (!target.nodeName && !isEvented(target)) {
throw new Error('Invalid target; must be a DOM node or evented object.');
const validateTarget = (target, obj, fnName) => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made these errors more specific.

if (!target.nodeName && !isEvented(target)) {
throw new Error('Invalid target; must be a DOM node or evented object.');
const validateTarget = (target, obj, fnName) => {
if (!target || (!target.nodeName && !isEvented(target))) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check if target is null before trying to check a property on it.

@@ -398,6 +418,8 @@ const EventedMixin = {
* Whether or not the default behavior was prevented.
*/
trigger(event, hash) {
validateTarget(this.eventBusEl_, this, 'trigger');
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validate on trigger, this is likely the cause of the issue we see in dom

@gkatsev
Copy link
Member

gkatsev commented Dec 4, 2020

If it can be split out into two PRs, that would be nice. The changes look good.

@brandonocasey
Copy link
Contributor Author

Moved the evented changes to #6982

@brandonocasey brandonocasey added the needs: LGTM Needs one or more additional approvals label Dec 7, 2020
@gkatsev gkatsev merged commit 11d37e2 into main Dec 11, 2020
@gkatsev gkatsev deleted the fix/ready-queue-dispose branch December 11, 2020 21:04
@misteroneill misteroneill removed the needs: LGTM Needs one or more additional approvals label May 23, 2023
edirub pushed a commit to edirub/video.js that referenced this pull request Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants