1.34.0 / Linux: all webviews fail - webviewProtocolProvider sends the whole pooled ArrayBuffer, service-worker.js fails to parse

Environment

  • Qoder IDE 1.34.0 (base VS Code 1.106.3, commit b98cae71697a1f5cb03ec68386a98dc2f39827aa)
  • Arch Linux, kernel 7.2.10, Wayland session (X11 also affected)
  • Runs on system Electron: electron42 42.11.14-2 (Chromium 148.0.7778.280), installed via AUR package qoder-ide-bin 1.34.0-1
  • The app’s product.json declares “electron”: “42.2.0”
  • Affected: every webview (seepine.md-editor, Markdown preview, any extension webview panel)

Symptom

Error loading webview: Error: Could not register service worker: TypeError: Failed to register a ServiceWorker for scope (‘vscode-webview:///’) with script (‘vscode-webview:///service-worker.js?v=4&vscode-resource-base-authority=vscode-resource.vscode-cdn.net&remoteAuthority=’): ServiceWorker script evaluation failed.

Clearing Service Worker/, Code Cache/, Cache/, GPUCache/, CachedData/ and restarting does not help. A brand-new profile reproduces it as soon as a webview loads.

Root cause (confirmed with Chromium logs)

Launching with --enable-logging=stderr --v=1 shows the real reason:

[INFO:CONSOLE:1] "Uncaught SyntaxError: Unexpected token ':'",
  source: vscode-webview://<uuid>/service-worker.js?v=4&... (1)

The response body is not the 7031-byte service-worker.js - it is the whole backing ArrayBuffer of the VSBuffer, which can be a view into Node’s 64 KiB slab pool. Chromium therefore receives the script plus trailing garbage bytes and the worker script fails to parse.

out/main.js, webviewProtocolProvider.handleWebviewRequest:

o = await this._fileService.readFile(s);
return new Response(o.value.buffer.buffer, { headers: { ... } });   // <-- whole slab, not the file bytes

Minimal reproduction (same electron42 binary, no Qoder involved)

Register the real vs/workbench/contrib/webview/browser/pre/service-worker.js through a privileged vscode-webview scheme plus --service-worker-schemes=vscode-webview:

  • body = exact-size ArrayBuffer (content.buffer, 7031 bytes) → register() OK
  • body = 8 KiB pooled slab containing the content + junk (slab.buffer) → “ServiceWorker script evaluation failed”, identical message

So the Electron build, the scheme privileges and the script itself are fine; only the response length is wrong.

Suggested fix

- return new Response(o.value.buffer.buffer, { headers: { ... } });
+ const b = o.value.buffer;
+ return new Response(b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength), { headers: { ... } });

Note the other .buffer.buffer usage in main.js (writeImage) already passes byteOffset/byteLength; only this handler misses it.

Why it shows up on Arch

The AUR package runs the official bundle on system Electron 42.11.14 while the app declares electron 42.2.0. Whether fileService.readFile() returns a pooled view seems to depend on that combination; the official bundled build may not hit it, but the handler is unsafe in every build.

Workaround for affected users

Patch that one line in /usr/lib/qoder-ide/out/main.js (keep a backup, validate with node --check), then fully quit and restart Qoder. The change has to be re-applied after each package update.

Same bug on the official signed macOS build — not limited to the AUR / system-Electron setup.

Environment

  • Qoder 1.39.1 (VS Code base 1.106.3, commit f0f54cd57e70ffcef263b4e33d1074ab3f69aea5, built 2026-11-06)
  • macOS 26.3.2, Apple Silicon (arm64)
  • Official notarized bundle in /Applications/Qoder IDE.app (bundled Electron)

Symptom
Every webview (e.g. built-in Markdown preview) fails with:
Could not register service worker ... ServiceWorker script evaluation failed.
Reload Window and clearing Service Worker / Code Cache / Cache do not help.
VS Code 1.144.1 on the same machine renders the same Markdown preview fine.

Root cause (same as above)
out/main.js, webview protocol handler:

return new Response(o.value.buffer.buffer, {headers:{"Content-Type":r.mime, ...}})

VS Code 1.144.1 (out/mainImpl.js) uses:

return new Response(s.value.buffer, {headers:{"Content-Type":t.mime, ...}})

Verified fix
Changing o.value.buffer.buffer → o.value.buffer in out/main.js (only this one occurrence), then fully quitting (⌘Q) and relaunching, makes all webviews work again. Note Reload Window is not enough since main.js is loaded by the main process.

Please ship this one-line fix — it has been present since at least 1.34.0 and the patch gets overwritten on every update.