site: run tutorial and widget REPLs in relaxed sandbox (#2147)

pull/2279/head
Conduitry 7 years ago
parent 29b4615d9d
commit 665c3eac79

@ -15,6 +15,8 @@
proxy.setProp(prop, value); proxy.setProp(prop, value);
} }
export let relaxed = false;
let iframe; let iframe;
let pending_imports = 0; let pending_imports = 0;
let pending = false; let pending = false;
@ -127,7 +129,7 @@
</style> </style>
<div class="iframe-container"> <div class="iframe-container">
<iframe title="Result" class:inited bind:this={iframe} sandbox="allow-popups-to-escape-sandbox allow-scripts allow-popups allow-forms allow-pointer-lock allow-top-navigation allow-modals" class="{error || pending || pending_imports ? 'greyed-out' : ''}" srcdoc=' <iframe title="Result" class:inited bind:this={iframe} sandbox="allow-popups-to-escape-sandbox allow-scripts allow-popups allow-forms allow-pointer-lock allow-top-navigation allow-modals {relaxed ? 'allow-scripts allow-same-origin' : ''}" class="{error || pending || pending_imports ? 'greyed-out' : ''}" srcdoc='
<!doctype html> <!doctype html>
<html> <html>
<head> <head>

@ -12,6 +12,7 @@
export let sourceErrorLoc = null; export let sourceErrorLoc = null;
export let runtimeError = null; export let runtimeError = null;
export let embedded = false; export let embedded = false;
export let relaxed = false;
let foo; // TODO workaround for https://github.com/sveltejs/svelte/issues/2122 let foo; // TODO workaround for https://github.com/sveltejs/svelte/issues/2122
@ -120,6 +121,7 @@
<Viewer <Viewer
bind:this={viewer} bind:this={viewer}
bind:error={runtimeError} bind:error={runtimeError}
{relaxed}
on:binding="{e => setPropFromViewer(e.detail.prop, e.detail.value)}" on:binding="{e => setPropFromViewer(e.detail.prop, e.detail.value)}"
/> />
</div> </div>

@ -83,6 +83,6 @@
<div class="repl-outer"> <div class="repl-outer">
{#if process.browser} {#if process.browser}
<Repl bind:this={repl} {version} embedded={true}/> <Repl bind:this={repl} {version} embedded={true} relaxed/>
{/if} {/if}
</div> </div>

@ -12,6 +12,7 @@
export let version = 'beta'; // TODO change this to latest when the time comes export let version = 'beta'; // TODO change this to latest when the time comes
export let embedded = false; export let embedded = false;
export let orientation = 'columns'; export let orientation = 'columns';
export let relaxed = false;
export function toJSON() { export function toJSON() {
// TODO there's a bug here — Svelte hoists this function because // TODO there's a bug here — Svelte hoists this function because
@ -222,7 +223,7 @@
</section> </section>
<section slot=b style='height: 100%;'> <section slot=b style='height: 100%;'>
<Output {version} {embedded}/> <Output {version} {embedded} {relaxed}/>
</section> </section>
</SplitPane> </SplitPane>
</div> </div>

@ -239,6 +239,6 @@
</div> </div>
<div class="tutorial-repl"> <div class="tutorial-repl">
<Repl bind:this={repl} orientation="rows" on:change={handle_change}/> <Repl bind:this={repl} orientation="rows" on:change={handle_change} relaxed/>
</div> </div>
</div> </div>

Loading…
Cancel
Save