Skip to content

Commit 4276b9c

Browse files
committed
revert to srcdoc
Follow-up to PR #234 per domfarolino's review feedback.
1 parent 6377357 commit 4276b9c

1 file changed

Lines changed: 3 additions & 15 deletions

File tree

examples/basic-host/src/sandbox.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,21 +95,9 @@ window.addEventListener("message", async (event) => {
9595
inner.setAttribute("allow", allowAttribute);
9696
}
9797
if (typeof html === "string") {
98-
// Use document.write instead of srcdoc for WebGL compatibility.
99-
// srcdoc creates an opaque origin which prevents WebGL canvas updates
100-
// from being displayed properly. document.write preserves the sandbox
101-
// origin, allowing WebGL to work correctly.
102-
// CSP is enforced via HTTP headers on this page (sandbox.html).
103-
const doc = inner.contentDocument || inner.contentWindow?.document;
104-
if (doc) {
105-
doc.open();
106-
doc.write(html);
107-
doc.close();
108-
} else {
109-
// Fallback to srcdoc if document is not accessible
110-
console.warn("[Sandbox] document.write not available, falling back to srcdoc");
111-
inner.srcdoc = html;
112-
}
98+
inner.srcdoc = html;
99+
} else {
100+
console.error("[Sandbox] Missing or invalid HTML content in sandbox-resource-ready notification.");
113101
}
114102
} else {
115103
if (inner && inner.contentWindow) {

0 commit comments

Comments
 (0)