Skip to content

7.6.x#23

Open
mathewchris96 wants to merge 4 commits intomainfrom
7.6.x
Open

7.6.x#23
mathewchris96 wants to merge 4 commits intomainfrom
7.6.x

Conversation

@mathewchris96
Copy link
Owner

Version changes

misteroneill and others added 4 commits September 5, 2019 15:20
…me people have relied on this (#6216)

When a player is created without an id on the embed code, Video.js automatically assigns it one based on an auto-incrementing number (a.k.a. a GUID). For the longest time, this has happened to result in the default id of the first player being vjs_video_3.

It was never intended for users to rely on this value being consistent, but users do strange and inadvisable things.

PR #6103 had an unintended side effect in that it changed the default id to vjs_video_2, which we worry could affect some users of Video.js.
Use a WeakMap and Set shams for browsers that don't support it.
@phronetic-pr-reviewer
Copy link

🤖 AI Code Review

📋 Code Review Table

Category Status / Notes
Summary of Changes Version bump, bug fixes, polyfills for older browsers
Tests & Correctness OK, but additional tests recommended
Security OK
Performance Minor impact due to polyfills
Architecture & Design OK
Code Quality & Style OK, but some improvements suggested
Docs & Observability OK
Overall Recommendation Needs Changes

PR Review — Summary

  • Goal: This PR updates the version to 7.6.6, adds polyfills for older browser support, and fixes some bugs.
  • Risk: Medium
  • Recommendation: Fix & Re-request

🔴 Critical Issues (must fix before merge)

None identified.

⚠️ Major Issues (should fix)

  • [src/js/component.js:lines 98-138]Polyfill Implementation
    Why: The polyfill for Set is implemented inline, which can lead to code duplication and maintenance challenges if needed elsewhere.
    How to fix: Consider moving the SetSham class to a separate utility module. This will make it reusable and easier to manage.
    Notes: This change will also improve code readability and maintainability.

🟡 Minor Issues (suggested)

  • [src/js/utils/dom-data.js:lines 3-69]Polyfill for WeakMap
    Why: Similar to the Set polyfill, the FakeWeakMap class is implemented inline.
    How to fix: Extract FakeWeakMap to a utility module for reuse and clarity.

  • [src/js/player.js:lines 655-661]Error Handling
    Why: The try-catch block is broad and may hide other errors.
    How to fix: Narrow the scope of the try-catch to only the specific operations that might throw (e.g., accessing certain properties).

💡 Suggestions & Improvements

  • Testing: Consider adding more comprehensive tests for the polyfills to ensure they behave as expected across different environments.
  • Documentation: Update the documentation to reflect the changes in polyfill usage and any potential limitations or considerations for developers.

✅ Positives

  • The PR includes a test to ensure the default ID of the first player remains consistent, which is a good practice for backward compatibility.
  • The changelog is updated, providing clear documentation of changes for users.

Suggested PR checklist (add these items to the PR description)

  • Extract polyfills into utility modules
  • Add tests for polyfill behaviors
  • Narrow error handling in player.js
  • Update documentation to reflect changes

Additional requirements & heuristics:

  • Specific file references and approximate line numbers or hunk context are included.
  • Unified-diff or short snippets are provided where applicable.
  • The review is collaborative and educational, aiming to enable fast fixes with clear, testable changes.

📊 Review Summary

🔍 This is an automated AI review. Please use your judgment and verify all suggestions before implementing them.

@phronetic-pr-reviewer
Copy link

🤖 AI Code Review

📋 Code Review Table

Category Status / Notes
Summary of Changes Version update, bug fixes, and support for older browsers.
Tests & Correctness OK, but additional tests for new shims would be beneficial.
Security OK, no new security concerns identified.
Performance Minor impact due to shims, acceptable for compatibility.
Architecture & Design OK, but consider a more modular approach for shims.
Code Quality & Style OK, but some code can be refactored for clarity.
Docs & Observability OK, changelog updated; inline comments are clear.
Overall Recommendation Needs Changes

PR Review — Summary

  • Goal: This PR updates the version to 7.6.6, fixes bugs, and adds support for older browsers by introducing shims for Set and WeakMap.
  • Risk: Medium
  • Recommendation: Fix & Re-request

🔴 Critical Issues (must fix before merge)

  • [src/js/component.js:lines 98-138]Shim for Set
    Why: The shim for Set is implemented inline, which can lead to code duplication and maintenance challenges.
    How to fix: Extract the SetSham class to a separate module or utility file for reuse and clarity.
    Tests/Verification: Ensure that existing tests cover scenarios where Set is not available.

⚠️ Major Issues (should fix)

  • [src/js/utils/dom-data.js:lines 3-69]Shim for WeakMap
    Why: Similar to the Set shim, the WeakMap shim is implemented inline, which can complicate future maintenance.
    How to fix: Move the FakeWeakMap class to a separate module or utility file.
    Notes: Consider adding tests specifically for the FakeWeakMap functionality.

🟡 Minor Issues (suggested)

  • [src/js/player.js:lines 655-661]Error handling in property copying
    Why: The try-catch block is broad and may mask other issues.
    How to fix: Narrow the catch block to specific properties known to cause issues, or log unexpected errors for debugging.

💡 Suggestions & Improvements

  • Consider adding unit tests for the new shims to ensure they behave as expected across different environments.
  • Review the use of window and document to ensure compatibility with server-side rendering if applicable.

✅ Positives

  • The changelog is updated, providing clear documentation of changes.
  • The PR includes a test to verify that the default player ID remains consistent.

Suggested PR checklist (add these items to the PR description)

  • Unit tests added for SetSham and FakeWeakMap.
  • Ensure compatibility with server-side rendering environments.
  • Review error handling in src/js/player.js for potential improvements.

Additional requirements & heuristics:

  • Always include specific file references and approximate line numbers or hunk context.
  • Where helpful, include a tiny unified-diff (diff ... block) or a short snippet that can be copy-pasted.
  • If a suggestion is speculative because context is missing, prefix with "Assuming X, …".
  • Provide a confidence level per major finding: High/Medium/Low.
  • If multiple fixes are possible, list a recommended minimal fix and an optional larger refactor.
  • If an issue touches security, mark it Critical and explain attack scenarios and remediation steps.

Tone: collaborative and educational — enable fast fixes with clear, testable changes.


📊 Review Summary

🔍 This is an automated AI review. Please use your judgment and verify all suggestions before implementing them.

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