aboutsummaryrefslogtreecommitdiff
path: root/test/test_jsinterp.py
AgeCommit message (Collapse)Author
2025-03-11[JSInterp] Improve testsdirkf
* from yt-dlp/yt-dlp#12313 * also fix d7c2708
2025-03-11[JSInterp] Improve Date processingdirkf
* add JS_Date class implementing JS Date * support constructor args other than date string * support static methods of Date * Date objects are still automatically coerced to timestamp before using in JS.
2025-02-07[JSInterp] Fix bit-shift coercion for player 9c6dfc4adirkf
2024-12-16[jsinterp] Strip /* comments */ when parsingdirkf
* NB: _separate() is looking creaky
2024-12-16[jsinterp] Fix and improve "methods"dirkf
* push, unshift return new length * impove edge cases for push/pop, shift/unshift, forEach, indexOf, charCodeAt * increase test coverage
2024-12-16[jsinterp] Fix and improve split/joindirkf
* improve split/join edge cases * correctly implement regex split (not like re.split)
2024-12-16[jsinterp] Fix and improve arithmetic operationsdirkf
* addition becomes concat with a string operand * improve handling of edgier cases * arithmetic in float like JS (more places need cast to int?) * increase test coverage
2024-12-16[jsinterp] Support multiple indexing (eg a[1][2])dirkf
* extend single indexing with improved RE (should probably use/have used _separate_at_paren()) * fix some cases that should have given undefined, not throwing * standardise RE group names * support length of objects, like {1: 2, 3: 4, length: 42}
2024-12-16[jsinterp] Fix and improve loose and strict equality operationsdirkf
* reimplement loose equality according to MDN (eg, 1 == "1") * improve strict equality (eg, "abc" === "abc" but 'abc' is not 'abc') * add tests for above
2024-12-16[jsinterp] Implement `typeof` operatordirkf
2024-08-06[jsinterp] Improve slice implementation for player b12cc44bdirkf
Partly taken from yt-dlp/yt-dlp#10664, thx seproDev Fixes #32896
2024-07-11[jsinterp] Support functionality for player `b22ef6e7`dirkf
* support `prototype` for call() and apply() (yt-dlp/yt-dlp#10392, thx Grub4k) * map JS `Array` to `list`
2024-07-11[jsinterp] Re-align JSInterp and tests (esp.) with yt-dlpdirkf
Thx: various yt-dlp authors
2024-06-20[jsinterp] Add Debugger from yt-dlpdirkf
* https://github.com/yt-dlp/yt-dlp/commit/8f53dc4 * thx pukkandan
2023-07-05[Misc] Fixes for 2.6 compatibilitydirkf
2023-06-11[jsinterp] Fix div bug breaking player 8c7583ffdirkf
Thx bashonly: https://github.com/ytdl-org/youtube-dl/issues/32292#issuecomment-1585639223 Fixes #32292
2023-05-23[jsinterp] Small updates for a85a875dirkf
* update signature tests * clarify NaN handling
2023-05-11[jsinterp] Handle NaN in bitwise operatorsdirkf
* also add _NaN * also pull function naming from yt-dlp
2023-04-21[jsinterp] Minimally handle arithmetic operator precedencedirkf
Resolves #32066
2023-03-07[jsinterp] Fix regexp parsing and .replace[All] methoddirkf
* For performance, make regexp object instantiation lazy * Other small performance improvements
2023-02-02[jsinterp] Improve parsingdirkf
* support subset `... else if ...` * support `while` * add `RegExp` class * generalise `new` support * limited more debug strings * matching test changes
2023-02-02Support `if` statementspukkandan
Fix for yt-dlp/yt_dlp#6131 Closes #31509
2022-09-01[jsinterp] Handle new YT players 113ca41c, c57c113cdirkf
* add NaN * allow any white-space character for `after_op` * align with yt-dlp f26af78a8ac11d9d617ed31ea5282cfaa5bcbcfa (charcodeAt and bitwise overflow) * allow escaping in regex, fixing player c57c113c
2022-08-26[jsinterp] Improve try/catch/finally supportdirkf
2022-08-25[jsinterp] Fix bug in operator precedencedirkf
* from https://github.com/yt-dlp/yt-dlp/commit/164b03c4864b0d44cfee5e7702f7c2317164a6cf * added tests
2022-08-19[jsinterp] Clean up and pull yt-dlp styledirkf
* add compat_re_Pattern * improve compat_collections_chain_map * use class JS_Undefined * remove unused code
2022-08-19[jsinterp] Handle regexp literals and throw/catch execution (#31182)dirkf
* based on https://github.com/yt-dlp/yt-dlp/commit/f6ca640b122239d5ab215f8c2564efb7ac3e8c65, thanks pukkandan * adds parse support for regexp flags
2022-08-17[jsinterp] Improve JS language support (#31175)dirkf
* operator ?? * operator ?. * operator ** * accurate operator functions * `undefined` handling * object literals {a: 1, "b": expr} * more tests for weird JS comparisons: see https://github.com/ytdl-org/youtube-dl/issues/31173#issuecomment-1217854397.
2022-08-14[jsinterp] Overhaul JSInterp to handle new YT players 4c3f79c5, 324f67b9 ↵dirkf
(#31170) * back-port from yt-dlp 8f53dc44a0cc1c2d98c35740b9293462c080f5d0, thanks pukkandan * also support void, improve <</>> precedence, improve expressions in comma-list * add more tests
2022-01-30Handle default in switch betterdf
Add https://github.com/yt-dlp/yt-dlp/commit/a1fc7ca0743c8df06416e68ee74b64e07dfe7135 Thanks coletdjnz
2022-01-30Back-port JS interpreter upgrade from yt-dlp PR #1437df
2016-11-17Update coding style after pycodestyle 2.1.0Yen Chi Hsuan
In pycodestyle 2.1.0, E305 was introduced, which requires two blank lines after top level declarations, too. See https://github.com/PyCQA/pycodestyle/issues/400 See also #10689; thanks @stepshal for first mentioning this issue and initial patches
2016-11-11[jsinterp] Fix function calls without arguments.Kacper Michajłow
2015-11-10[jsinterp] Support alternative function definition formYen Chi Hsuan
2015-02-18[jsinterp] Disable comment supportPhilipp Hagemeister
We need a proper lexer to be able to understand YouTube's code, which contains /* inside of strings. For now it's sufficient to just disable comment support altogether. Fixes #4976, fixes #4979, fixes #4980, fixes #4981, fixes #4982. Closes #4977.
2015-02-01[jsinterp] Beef up and add testsPhilipp Hagemeister
In preparation for #4822, extend jsinterp by a lot. (We may even have to/want to write a proper interpreter with actual parsing)