Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Lazy loading (level 3) for a browser host: load later parts through the host

Offen
#1,278 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
cpp, html, wasm
Bereich
api, backend, web-dev

Rechercherichtung

Read docs/design/lazy-loading.md decision 2, then trace load(chunk) in viewport.js, HtmlService::write(path), and the wasm binding in wasm/src/wasm_html.cpp (to_html_config) and wasm/js/index.d.ts. The report describes the host bridge, per-document path writing, wasm config, and sandbox constraints; completion means browser hosts can load later parts on demand while file and HTTP loading still work.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

What is missing

With HtmlConfig::lazy_loading, a page loads each later part of a view as a script beside it: text-chunks/<n>.js, sheet<n>-chunks/<m>.js, pdf-pages/<n>.js, and the search index (*-search/<n>.js). viewport.js adds a <script src> with a relative path (docs/design/lazy-loading.md decision 2). That works from file:// and over the HTTP server.

A browser host cannot use it. The website (opendocument.app, on @opendocument/odr-core through wasm) renders into a sandboxed srcdoc iframe:

  • sandbox="allow-scripts" without allow-same-origin, so the frame has no origin
  • CSP script-src 'self' 'wasm-unsafe-eval' 'unsafe-inline', connect-src 'self'
  • no file server

A relative <script src> has nowhere to load from there. The wasm binding also does not read lazyLoading (wasm/src/wasm_html.cpp, to_html_config; wasm/js/index.d.ts). So in 7.6.x a browser host gets level 1 (lazyLayout) only.

What it would take

  1. A host hook in viewport.js. When the page has a host to ask, load(chunk) asks the host for the part named by data-odr-chunk-src (and data-odr-chunk-text for the index) instead of adding a <script src>. For example: post {type: "loadPart", path} through the host bridge, and accept the answer as the script text, or as the html of the part, passed to odr.chunks.fill and odr.chunks.text. The script tag stays the default, so file:// and HTTP do not change.
  2. A wasm call that writes a path. C++ has HtmlService::write(path) (and exists, mimetype), and it renders a part on demand. The wasm binding does not expose it. Something like doc.write(path) returning the text, kept per open document, so the host can answer the hook.
  3. lazyLoading in the wasm config, with the hook as its precondition. The README and index.d.ts should say so.
  4. The sandbox: the answer must reach the frame without allow-same-origin. postMessage into the frame and eval-free insertion fit the site's CSP, because odr.chunks.fill takes html, not code.

Why

The site caps a sheet at 50,000 cells, because the whole markup goes into srcdoc as one string. Level 3 would let it show far larger files: the page holds only the first part, and the rest comes from the open document on demand. It is the same win as on the server: for Core_v5.1.pdf, 1.4 MB instead of 127 MB.

Reported by the website session after moving the site to 7.6.0.

Vorherrschende Sprache
C++
Sterne
41
Forks
10
Ø Merge
10 Std. 30 Min.
Gemergte PRs (30 T.)
342

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus opendocument-app/OpenDocument.core

Alle Issues in opendocument-app/OpenDocument.core

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.