fix: guard videoPlayer.destroy() against re-entrant calls with jQuery UI 1.14.1#38062
fix: guard videoPlayer.destroy() against re-entrant calls with jQuery UI 1.14.1#38062jignaciopm wants to merge 2 commits intoopenedx:masterfrom
Conversation
|
Thanks for the pull request, @jignaciopm! This repository is currently maintained by Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review. 🔘 Get product approvalIf you haven't already, check this list to see if your contribution needs to go through the product review process.
🔘 Provide contextTo help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:
🔘 Get a green buildIf one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green. DetailsWhere can I find more information?If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources: When can I expect my changes to be merged?Our goal is to get community contributions seen and reviewed as efficiently as possible. However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:
💡 As a result it may take up to several weeks or months to complete a review and merge your PR. |
|
Hi @bradenmacdonald , We wanted to let you know that Luis Felipe wasn't able to continue working on the PR he opened for upgrading jQuery UI. However, we've picked up where he left off and added the necessary adjustments to make the Karma JS tests pass. Thanks for your feedback and support! |
Description
jQuery UI upgrade: v1.10.0 → v1.14.1
This PR updates the local jQuery UI file (
common/static/js/vendor/jquery-ui.min.js) from version 1.10.0 (2013) to version 1.14.1 (2024), the latest stable release from the official jQuery UI project, and updates the CDN reference incommon/templates/xblock_v2/xblock_iframe.htmlaccordingly.Motivation:
common/templates/xblock_v2/xblock_iframe.htmlpreviously referenced jQuery UI 1.12.1 via CDN. This update ensures the CDN reference and the local vendor copy are in sync.Full changelog: https://jqueryui.com/changelog/ · Upgrade guide: https://jqueryui.com/upgrade-guide/1.14/
Fix: karma xmodule webpack tests failing after the upgrade
jQuery UI 1.14.1 includes a
jquery-patch.jsmodule that overrides$.cleanDatato firetriggerHandler("remove")on any element that has a jQuery"remove"event handler registered — a behavior that did not exist in v1.10.0.The video player registers
state.videoPlayer.destroyas a"remove"handler on the video element:When any part of the teardown chain (fixture cleanup, slider destroy, volume slider destroy) calls
$.fn.remove()or$.fn.empty(), the patched$.cleanDatatriggersvideoPlayer.destroy()again — afterdelete this.videoPlayerhad already run — causingTypeError: this.videoPlayer is undefinedand cascading to 591 out of 619 karma tests failing.Two defensive changes were made to 03_video_player.js:
this.videoPlayeris already gone."remove"event handler — at the very start ofdestroy(), before any cleanup that could trigger$.cleanData.Impacts: Developer only — no runtime behavior change for Learners or Course Authors.
Supporting information
Testing instructions
nvm use 24 npm install npm run build-dev npx karma start xmodule/js/karma_xmodule_webpack.conf.js --log-level debug --single-run --grep="Video"Deadline
None.
Other information
"remove"event handler cleanup added at the start ofdestroy()is safe: it mirrors the existingoff('remove')call already present inHTML5Video.Player.destroy()(02_html5_video.js:235).