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

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

@ -15,6 +15,8 @@
proxy.setProp(prop, value);
}
export let relaxed = false;
let iframe;
let pending_imports = 0;
let pending = false;
@ -127,7 +129,7 @@
</style>
<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>
<html>
<head>

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

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

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

@ -239,6 +239,6 @@
</div>
<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>

Loading…
Cancel
Save