Fix adapt css with split (#1600)

Fix for #1575 where postcss was raising an exception

* adapt the entire CSS as a whole in one pass with postcss, rather than adapting each split part separately
* break up the postcss output again and assign to individual text nodes (kind of inverse of splitCssText at record side)
* impose an upper bound of 30 iterations on the substring searches to preempt possible pathological behavior
* add tests to demonstrate the scenario and prevent regression

More technical details:
* Fix algorithm; checks against `ix_end` within loop were incorrect when `ix_start` was bigger than zero.  
* Fix that length check against wrong array was causing 'should record style mutations with multiple child nodes and replay them correctly' test to fail. 
Note on last point: I haven't looked into things more deeply than that the test was complaining about missing .length after `replayer.pause(1000);`
This commit is contained in:
Eoghan Murray
2025-02-06 13:17:34 +00:00
committed by GitHub
parent a95b3e8e7f
commit a6893f73ab
3 changed files with 88 additions and 7 deletions

View File

@@ -0,0 +1,6 @@
---
"rrweb": patch
"rrweb-snapshot": patch
---
#1575 Fix that postcss could fall over when trying to process css content split arbitrarily