{"record":{"id":"a8246030aea3cd48","repo":"perspective-dev/perspective","slug":"webassembly-not-supported","errorCode":null,"errorMessage":"WebAssembly not supported.","messagePattern":"WebAssembly not supported\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"rust/perspective-js/src/ts/wasm/decompress.ts","lineNumber":17,"sourceCode":"// ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n// ┃ ██████ ██████ ██████       █      █      █      █      █ █▄  ▀███ █       ┃\n// ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█  ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄  ▀█ █ ▀▀▀▀▀ ┃\n// ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄   █ ▄▄▄▄▄ ┃\n// ┃ █      ██████ █  ▀█▄       █ ██████      █      ███▌▐███ ███████▄ █       ┃\n// ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫\n// ┃ Copyright (c) 2017, the Perspective Authors.                              ┃\n// ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃\n// ┃ This file is part of the Perspective library, distributed under the terms ┃\n// ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃\n// ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛\n\n// @ts-ignore\nimport { extract } from \"pro_self_extracting_wasm\";\n\nif (typeof WebAssembly === \"undefined\") {\n    throw new Error(\"WebAssembly not supported.\");\n}\n\ninterface Module extends WebAssembly.Exports {\n    size(): number;\n    offset(): number;\n    memory: WebAssembly.Memory;\n}\n\n// Perform a silly dance to deal with the different ways webpack and esbuild\n// load binary, as this may either be an `ArrayBuffer` or `URL` depending\n// on whether `inline` option was specified to `perspective-esbuild-plugin`.\nasync function compile(\n    buffer: ArrayBuffer | Response | WebAssembly.Module | WebAssembly.Exports,\n): Promise<Module> {\n    if (buffer instanceof Response) {\n        return (await WebAssembly.instantiateStreaming(buffer)).instance\n            .exports as Module;\n    } else if (buffer instanceof WebAssembly.Module) {","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/perspective-dev/perspective/blob/11c8238c0c9c0b9e490b5a6a2dc277afad1e980a/rust/perspective-js/src/ts/wasm/decompress.ts#L1-L35","documentation":"The decompress module wraps `pro_self_extracting_wasm`, a self-extracting WebAssembly module used to decompress perspective assets. It performs an environment capability check at import time and throws immediately if the global `WebAssembly` object is undefined, because the module cannot function without WASM support.","triggerScenarios":"Importing (directly or transitively) rust/perspective-js's wasm/decompress.ts in any JavaScript environment that lacks `WebAssembly` — the check runs at module top level, so the error fires on import, not on a later call.","commonSituations":"Running in an old browser (IE11, pre-2017 Safari/Chrome/Firefox); Node.js < 8 without the --expose-wasm flag; embedded JS engines or SSR runtimes without WASM; CSP or enterprise policy disabling WebAssembly; webviews with WASM turned off.","solutions":["Run the application in a browser or Node.js version that supports WebAssembly (any modern browser; Node >= 8).","Check for CSP headers or enterprise policies disabling WebAssembly ('unsafe-eval'/'wasm-unsafe-eval' restrictions) and allow it.","If WASM cannot be enabled, avoid importing this module / the perspective packages that depend on it, or gate the import behind a WebAssembly support check.","Use a polyfill-free fallback: detect support with `typeof WebAssembly === \"undefined\"` before loading the library and show a graceful unsupported-browser message."],"exampleFix":"// before\nimport { load_wasm } from \"@finos/perspective\"; // throws at import on WASM-less envs\nload_wasm();\n\n// after\nif (typeof WebAssembly !== \"undefined\") {\n  const { load_wasm } = await import(\"@finos/perspective\");\n  await load_wasm();\n} else {\n  console.error(\"This application requires WebAssembly support.\");\n}","handlingStrategy":"fallback","validationCode":"if (typeof WebAssembly === \"undefined\") {\n  console.warn(\"WebAssembly unsupported: perspective wasm modules will not load.\");\n}","typeGuard":"function supportsWasm(): boolean {\n  return typeof WebAssembly === \"object\" && typeof WebAssembly.Module === \"function\";\n}","tryCatchPattern":"try {\n  const decompress = await import(\"./wasm/decompress\");\n} catch (e) {\n  if (e.message === \"WebAssembly not supported.\") {\n    showUnsupportedBrowserDialog();\n  } else throw e;\n}","preventionTips":["Feature-detect WebAssembly before importing perspective packages and use dynamic imports to keep the failure recoverable.","Set a browser-support baseline (all evergreen browsers, Node >= 8) and document it.","Check CSP headers allow WebAssembly compilation ('wasm-unsafe-eval')."],"tags":["webassembly","environment","compatibility","module-load"],"backgroundTag":"unsupported-platform","analyzedSha":"11c8238c0c9c0b9e490b5a6a2dc277afad1e980a","analyzedAt":"2026-09-09T00:35:19.377Z","contentChangedAt":"2026-09-09T00:35:19.377Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}