Commit 76b42b8
committed
fix(pdf-server): slice bytes before onDataRange to avoid detached buffer
PDF.js transfers the ArrayBuffer to its worker via postMessage, detaching
it in the main thread. When the same range is re-requested (common on
iOS/WKWebView under memory pressure during scroll/zoom/navigate), the
cached Uint8Array now wraps a detached buffer and onDataRange throws
'Buffer is already detached'.
Fix: pass result.bytes.slice() so the rangeCache entry stays valid.1 parent c026b39 commit 76b42b8
1 file changed
Lines changed: 5 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3875 | 3875 | | |
3876 | 3876 | | |
3877 | 3877 | | |
3878 | | - | |
| 3878 | + | |
| 3879 | + | |
| 3880 | + | |
| 3881 | + | |
| 3882 | + | |
3879 | 3883 | | |
3880 | 3884 | | |
3881 | 3885 | | |
| |||
0 commit comments