fix: follow-up to PR #234 (remove accidental file, revert from document.write to equiv. srcdoc) (#248)
* chore: remove tamper-detection.ts (not meant to be submitted) Follow-up to PR #234. This file was accidentally included. * revert to srcdoc Follow-up to PR #234 per domfarolino's review feedback. * regen * regen
This commit is contained in:
parent
9a9ecf27d4
commit
ba550f1aeb
1 changed files with 6 additions and 343 deletions
|
|
@ -95,21 +95,9 @@ window.addEventListener("message", async (event) => {
|
|||
inner.setAttribute("allow", allowAttribute);
|
||||
}
|
||||
if (typeof html === "string") {
|
||||
// Use document.write instead of srcdoc for WebGL compatibility.
|
||||
// srcdoc creates an opaque origin which prevents WebGL canvas updates
|
||||
// from being displayed properly. document.write preserves the sandbox
|
||||
// origin, allowing WebGL to work correctly.
|
||||
// CSP is enforced via HTTP headers on this page (sandbox.html).
|
||||
const doc = inner.contentDocument || inner.contentWindow?.document;
|
||||
if (doc) {
|
||||
doc.open();
|
||||
doc.write(html);
|
||||
doc.close();
|
||||
} else {
|
||||
// Fallback to srcdoc if document is not accessible
|
||||
console.warn("[Sandbox] document.write not available, falling back to srcdoc");
|
||||
inner.srcdoc = html;
|
||||
}
|
||||
inner.srcdoc = html;
|
||||
} else {
|
||||
console.error("[Sandbox] Missing or invalid HTML content in sandbox-resource-ready notification.");
|
||||
}
|
||||
} else {
|
||||
if (inner && inner.contentWindow) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue