Repository navigation
Replies: 3 comments
|
Thanks for the detailed report. I implemented the legacy-build option suggested here and prepared a source patch with regression coverage: Both commits are based on upstream The first commit switches the engine, text viewer and embedded worker to matching PDF.js legacy builds, updating the raw-worker declaration and bundler resolver together. The existing real-library smoke used legacy builds while production used modern builds; it now consumes the production worker source. A new built-chunk regression runs in an isolated realm without native Map upsert or typed-array hex methods. That regression fails on the published 0.2.2-alpha.2 chunk and passes after rebuilding the patch. Dependency-level comparison with pdfjs-dist 6.3.289 on Node 24.18.0:
The mixed-build case only isolates the main-thread failure; it is not the proposed configuration. The worker-side failure is why a Map-only polyfill may be insufficient. Validation on Windows: full build and aggregate type checks passed; 609 document-preview package tests passed; all 7 full-application document-preview replay scenarios passed with matching Playwright Chromium 149.0.7827.55, including real Word/PPT conversion and PDF previews. The second commit accounts for Windows-native CRLF in clipboard expectations while retaining exact text comparisons. No snapshots were refreshed. Limits: macOS/WKWebView has not been tested. The broader Web suite stopped with 20 passing tests and one failure in a chat-scroll fixture that invokes POSIX Bash, which the shipped Windows profile disables. I am not claiming the entire Web suite is green. Sharing the commits here in accordance with the current external-PR policy, in case they are useful for review or cherry-picking. |
|
Hi! I would avoid treating a manual modification of the generated or minified PDF.js bundle as the permanent fix. A more maintainable solution would be to check which PDF.js distribution is intended for the application's supported JavaScript runtimes. Depending on the bundling configuration, using the supported legacy build or loading a compatible polyfill before the library initializes may be appropriate. I would also add a smoke test that opens a minimal PDF in each supported desktop runtime, rather than relying only on browser-based unit tests. Since PDF parsing is shared by several document preview workflows, regression coverage should include PDF, DOCX, and PPTX. The key is to fix compatibility at the dependency integration layer so it survives clean builds and future upgrades. |
|
@zy2949804763 thanks — here is the macOS arm64 verification for Verified
Caveat: this is Node + vitest, not the desktop shell's WKWebView. Closing that loop still needs a desktop build; I have no further blockers on the fix itself. Not urgent at all — just leaving a pointer for whoever owns this path: /cc @imccyu @Stevring @yudshj (recent authors of |
Uh oh!
There was an error while loading. Please reload this page.
[BUG] documentpreview 打包的 pdfjs-dist 6.3.289 缺失 getOrInsertComputed polyfill,.pdf/.docx/.pptx 预览全量崩溃
@deepseek-ai/dsh-client-ui-sidebar-documentpreview0.2.1-rc.4,桌面端dsh-worker 0.0.80,macOS arm64(系统 WKWebView)溯源(避免重复提单)
Map.prototype.getOrInsertComputed)」→ 根因此前已被识别,但缺少专门条目,也缺少「三个已发布版本全部存在 + 可直接应用的补丁」这两项证据。
现象
在侧边栏打开
.pdf,或打开.docx/.pptx(走 Office→PDF 转换)时,面板显示:根因
lib/client.pdf.js打包了 pdfjs-dist 6.3.289;Map.prototype.getOrInsertComputed;Map.prototype.getOrInsertComputed目前 Node 24.20.0 / WKWebView / Chrome 均未提供,故该故障与运行环境无关,属于必现。证据
三个官方已发布版本的
lib/client.pdf.js完全相同:md5 均为
da97b3701763f6ba711e0bd60c7397ea(已排除内部打包改动,与 npm tarball 逐字节一致)。对照:
.xlsx预览正常,因为它走client.excel.js的原生表格渲染,不经过 PDF 链路。故障面精确为.pdf/.docx/.pptx。修复建议(任一)
pdfjs-dist/legacy/build/pdf.mjs(legacy 构建自带 polyfill);临时绕过(已在本机验证可行)
在
lib/client.pdf.js顶部注入上述 polyfill 后,.pdf/.docx/.pptx预览恢复正常(完整 diff 见随附hotfix-pdfjs-polyfill.patch)。验收建议
.pdf/.docx/.pptx;附带补丁(对官方 0.2.1-rc.4 tarball 可直接应用)
All reactions