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

feat: add several debugging aides #5854

Closed
wants to merge 1 commit into from
Closed

Conversation

brandonocasey
Copy link
Contributor

@brandonocasey brandonocasey commented Mar 11, 2019

TODO: Add some tests in this pull request to verify:

  1. That domData contains nothing after player is disposed
  2. That eventhandlers in DomData do not have the same guid for the same event (IE the same function is listening for the same event)

Copy link
Member

@gkatsev gkatsev left a comment

Choose a reason for hiding this comment

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

Also, I don't think any PRs against video.js should be ignore:.

@@ -553,6 +554,8 @@ videojs.computedStyle = computedStyle;
*/
videojs.dom = Dom;

videojs.domData = DomData;
Copy link
Member

Choose a reason for hiding this comment

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

I am against this being in a production build of Video.js, though, I do see the usefulness of it when debugging.

Copy link
Member

Choose a reason for hiding this comment

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

If we can have this be here during local dev but not when releasing, that's fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For local development we can just import DomData (as long as we let it export elData). I think that plugins could also benefit from being able to see what elData they may be leaking, but I am not quite sure how to do that without exposing it here.

Copy link
Contributor Author

@brandonocasey brandonocasey Mar 12, 2019

Choose a reason for hiding this comment

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

Perhaps we can expose it somewhere else? or put elData on the player somehow so that the player can remove it all on dispose?

Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure we can safely expose it and not deal with consequences down the line or have issues with people fiddling with it and causing issues.

@@ -280,6 +280,7 @@ const EventedMixin = {
// Use the same function ID as the listener so we can remove it later
// it using the ID of the original listener.
wrapper.guid = listener.guid;
wrapper.original_ = listener.original_ || listener;
Copy link
Member

Choose a reason for hiding this comment

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

we'd want to make sure to null these out so that we're not leaking references.

@@ -44,6 +44,9 @@ export const bind = function(context, fn, uid) {
// currently used in text tracks
bound.guid = (uid) ? uid + '_' + fn.guid : fn.guid;

bound.original_ = fn.original_ || fn;
Copy link
Member

Choose a reason for hiding this comment

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

we should make sure to null these out when they're no longer needed.

@brandonocasey brandonocasey changed the title ignore: add several debugging aides feat: add several debugging aides Mar 12, 2019
@brandonocasey
Copy link
Contributor Author

After thinking about this more, maybe we just want to have another build target. Something like video.debug.js and include/exclude code like this accordingly. Most of this code is useful but I could see it causing issues in production.

@gkatsev
Copy link
Member

gkatsev commented Mar 12, 2019

A debug build is fine, or having a rollup directive via envify or something that removes the exposing of domData when in production

@brandonocasey
Copy link
Contributor Author

OK I am going to open an issue and link back to this pull request, perhaps we can revisit this when we are fully building on rollup via #5649 & #5601 I will work on adding a unit test to prevent leaks via DomData in another pull request.

@brandonocasey
Copy link
Contributor Author

The issue in question #5858

@brandonocasey brandonocasey deleted the ignore/debugging-aide branch March 19, 2019 17:36
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.

None yet

2 participants