-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathindex.html
More file actions
159 lines (152 loc) · 7.11 KB
/
index.html
File metadata and controls
159 lines (152 loc) · 7.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SandboxJS — Test Suite</title>
<link rel="shortcut icon" href="logo.svg" type="image/x-icon">
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
<script src="test/eval/script.js" type="module"></script>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<header class="site-header">
<div class="header-inner">
<div class="brand">
<img src="logo.svg" alt="SandboxJS logo" class="logo">
<div class="brand-text">
<h1>SandboxJS</h1>
<span class="tagline">Safe JavaScript eval runtime</span>
</div>
</div>
<div class="controls">
<label class="toggle-label">
<input id="jit-parsing" type="checkbox" checked>
<span class="toggle-track"><span class="toggle-thumb"></span></span>
JIT Parsing
</label>
<div class="select-wrap">
<select id="runtime-type">
<option value="sync" selected>Sync</option>
<option value="async">Async</option>
</select>
</div>
<button id="open-sandbox-modal-btn" class="secondary-btn">Sandbox Runner</button>
<button id="run-btn" class="run-btn">Run Tests</button>
</div>
</div>
<p class="description">
Tests compare SandboxJS against a proxied <code>eval</code>. A global <code>bypassed</code> flag is set to <code>true</code> if a test escapes the sandbox — highlighted in red. Blocked bypasses show as <em>Error</em>.
</p>
</header>
<div class="page-body">
<aside class="sidebar">
<div class="perf-card">
<h2 class="card-title">Performance</h2>
<table id="times">
<tbody></tbody>
</table>
</div>
<nav class="category-nav" id="category-nav">
<h2 class="card-title">Sections</h2>
<ul id="category-list"></ul>
</nav>
</aside>
<main class="tests-main" id="tests-main">
<div class="summary-bar" id="summary-bar"></div>
<!-- sections injected here by script.js -->
</main>
</div>
<div id="sandbox-modal" class="modal-shell hidden" aria-hidden="true">
<div class="modal-backdrop" data-close-modal="true"></div>
<div class="sandbox-modal" role="dialog" aria-modal="true" aria-labelledby="sandbox-modal-title">
<div class="sandbox-modal-header">
<div>
<h2 id="sandbox-modal-title">Sandbox Runner</h2>
<p>Write JavaScript, keep it in the URL hash, and run it only when you press the button.</p>
</div>
<button id="sandbox-close-btn" class="icon-btn" type="button" aria-label="Close sandbox runner">Close</button>
</div>
<div class="sandbox-modal-body">
<div class="sandbox-field">
<div class="sandbox-field-header">
<span class="sandbox-field-label">JavaScript Input</span>
<button id="sandbox-settings-btn" class="settings-gear-btn" type="button" aria-label="Sandbox settings" title="Sandbox settings">
<svg viewBox="0 0 20 20" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round">
<circle cx="10" cy="10" r="2.8"/>
<path d="M10 2.5v1.2M10 16.3v1.2M2.5 10h1.2M16.3 10h1.2M4.6 4.6l.85.85M14.55 14.55l.85.85M4.6 15.4l.85-.85M14.55 5.45l.85-.85"/>
</svg>
<span id="sandbox-settings-badge" class="settings-badge hidden"></span>
</button>
</div>
<div id="sandbox-settings-panel" class="sandbox-settings-panel hidden">
<div class="settings-panel-inner">
<div class="settings-section">
<span class="settings-section-label">Options</span>
<div class="settings-grid">
<label class="settings-toggle-label">
<input type="checkbox" id="setting-forbid-calls">
<span class="toggle-track"><span class="toggle-thumb"></span></span>
forbidFunctionCalls
</label>
<label class="settings-toggle-label">
<input type="checkbox" id="setting-forbid-creation">
<span class="toggle-track"><span class="toggle-thumb"></span></span>
forbidFunctionCreation
</label>
<label class="settings-toggle-label">
<input type="checkbox" id="setting-halt-on-error">
<span class="toggle-track"><span class="toggle-thumb"></span></span>
haltOnSandboxError
</label>
<label class="settings-toggle-label">
<input type="checkbox" id="setting-async">
<span class="toggle-track"><span class="toggle-thumb"></span></span>
async
</label>
</div>
</div>
<div class="settings-section">
<span class="settings-section-label">Execution Quota</span>
<div class="settings-field-row">
<input type="number" id="setting-quota" class="settings-input" placeholder="unlimited" min="0" step="1000">
<span class="settings-field-hint">ticks (blank = unlimited)</span>
</div>
</div>
<div class="settings-section">
<span class="settings-section-label">Scope / State</span>
<div class="settings-field-row">
<textarea id="setting-scope" class="settings-textarea" placeholder='{ "myVar": 42 }' rows="3" spellcheck="false"></textarea>
</div>
<span class="settings-field-hint">JSON object merged into sandbox scope</span>
</div>
<button id="sandbox-settings-reset-btn" class="settings-reset-btn" type="button">Reset to defaults</button>
</div>
</div>
<div id="sandbox-editor"></div>
</div>
<div class="sandbox-actions">
<span id="sandbox-status" class="sandbox-status">Idle</span>
<span id="sandbox-ticks-output" class="sandbox-ticks">—</span>
<button id="sandbox-clear-btn" class="secondary-btn" type="button">Clear</button>
<button id="sandbox-exec-btn" class="run-btn" type="button">Run In Sandbox</button>
</div>
<div id="sandbox-bypass-notice" class="sandbox-notice sandbox-notice-safe">
<strong id="sandbox-bypass-icon" aria-hidden="true">✓</strong>
<span id="sandbox-bypass-text">`globalThis.bypassed` is falsy.</span>
</div>
<div class="sandbox-output-grid">
<section class="output-card">
<h3>Console</h3>
<pre id="sandbox-console-output">No logs yet.</pre>
</section>
<section class="output-card">
<h3>Return Value</h3>
<pre id="sandbox-return-output">Run code to inspect the result.</pre>
</section>
</div>
</div>
</div>
</div>
</body>
</html>