Donner 0.5.1
Embeddable browser-grade SVG2 engine
Loading...
Searching...
No Matches
SvgSource.h File Reference

SvgSource resolves a user-supplied URI into a raw byte buffer that the sandbox child can parse. This is the host-side half of the address bar design: the host has filesystem (and eventually network) privilege, and hands the sandbox child only the resulting bytes — never the filename, never the URL. More...

#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <string>
#include <string_view>
#include <vector>
Include dependency graph for SvgSource.h:
This graph shows which files directly or indirectly include this file:

Classes

struct  donner::editor::sandbox::SvgFetchResult
 Result payload. bytes is only populated on kOk; all other statuses leave it empty and set diagnostics to a human-readable reason. More...
struct  donner::editor::sandbox::SvgSourceOptions
 Configuration knobs for a SvgSource. Defaults match the design doc's address-bar section: 100 MB cap on local files. More...
class  donner::editor::sandbox::SvgSource
 Stateless-from-the-outside URI resolver. SvgSource holds the config knobs, but every fetch() call is independent and thread-safe. More...

Namespaces

namespace  donner
 Top-level Donner namespace, which is split into different sub-namespaces such as donner::svg and donner::css.

Enumerations

enum class  donner::editor::sandbox::SvgFetchStatus {
  kOk ,
  kSchemeNotSupported ,
  kInvalidUri ,
  kNotFound ,
  kNotRegularFile ,
  kPermissionDenied ,
  kTooLarge ,
  kReadFailed ,
  kNetworkError
}
 Outcome of a fetch attempt. kOk means bytes is populated and the caller can pass it straight to SandboxHost::renderToBackend. More...

Detailed Description

SvgSource resolves a user-supplied URI into a raw byte buffer that the sandbox child can parse. This is the host-side half of the address bar design: the host has filesystem (and eventually network) privilege, and hands the sandbox child only the resulting bytes — never the filename, never the URL.

Supported schemes in this milestone:

  • file://<absolute-path> — spec-style file URIs.
  • bare absolute paths (/foo/bar.svg).
  • bare relative paths (./icon.svg, icon.svg) — resolved against the caller-specified base directory.

https:// / http:// — fetched via the system curl CLI on the host side. The host enforces a 10 MB cap, 10-second timeout, and max 5 redirects. The sandbox child never sees the URL or touches the network.

Enumeration Type Documentation

◆ SvgFetchStatus

Outcome of a fetch attempt. kOk means bytes is populated and the caller can pass it straight to SandboxHost::renderToBackend.

Enumerator
kOk 

Bytes retrieved successfully.

kSchemeNotSupported 

URI used a scheme this build doesn't implement.

kInvalidUri 

URI could not be parsed.

kNotFound 

Resolved path does not exist.

kNotRegularFile 

Path exists but isn't a regular file.

kPermissionDenied 

Resolved path isn't readable.

kTooLarge 

File exceeds the configured size cap.

kReadFailed 

I/O error mid-read.

kNetworkError 

HTTP(S) fetch failed (timeout, DNS, etc.).