@rohal12/spindle 0.61.2 → 0.61.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pkg/play.js CHANGED
@@ -241,6 +241,7 @@ function workerExecArgv(execArgv) {
241
241
  * Opens a session that runs the story in a worker. There `window` is
242
242
  * happy-dom's window, not `globalThis`: story code sees `Story` and the DOM
243
243
  * globals, but `window.foo = 1` does not make a bare global `foo`.
244
+ * Requires `trusted: true`: story code has unrestricted host Node access.
244
245
  */
245
246
  function openPlaySession(options) {
246
247
  return openPlaySessionWith(options, {
@@ -258,6 +259,7 @@ function openPlaySession(options) {
258
259
  }
259
260
  /** Internal: `openPlaySession` with the worker and headless URLs given (for tests). */
260
261
  function openPlaySessionWith(options, urls) {
262
+ if (options.trusted !== true) return Promise.reject(/* @__PURE__ */ new Error("spindle: openPlaySession() requires trusted: true; story JavaScript has unrestricted access to host Node APIs, files and environment. Only run code you trust."));
261
263
  const stepTimeoutMs = options.stepTimeoutMs ?? DEFAULT_STEP_TIMEOUT_MS;
262
264
  if (typeof stepTimeoutMs !== "number" || !Number.isFinite(stepTimeoutMs) || stepTimeoutMs <= 0 || stepTimeoutMs > MAX_TIMEOUT_MS) return Promise.reject(/* @__PURE__ */ new Error(`spindle: openPlaySession(): "stepTimeoutMs" must be a positive number of milliseconds, got ${String(stepTimeoutMs)}`));
263
265
  const timeoutMessage = `spindle: play session timed out after ${stepTimeoutMs} ms (the story may be stuck in a loop)`;