Skip to content

Safari: engine never loads (DataCloneError) because index.html forces COEP: credentialless, which Safari doesn't support #421

Description

@henriasv

Summary

In Safari the app loads, examples and projects work, but the simulation engine never becomes ready: the sidebar chip stays at Engine loading… NN% and the console shows

COOP/COEP Service Worker registered – "https://andeplane.github.io/atomify/"
Unhandled Promise Rejection: DataCloneError: The object can not be cloned.

Environment

Likely cause

index.html:52-54 configures coi-serviceworker with

window.coi = { coepCredentialless: () => true, ... };

so the service worker injects Cross-Origin-Embedder-Policy: credentialless for every browser. Safari does not implement credentialless (only require-corp; see caniuse, MDN), so the page never becomes cross-origin isolated, SharedArrayBuffer stays unavailable, and the pthreads/KOKKOS wasm build fails when the worker hands its shared memory to the thread pool — which surfaces as the DataCloneError above. The engine-loading chip then never resolves and there is no user-facing message.

Suggested fix

  • Use require-corp on Safari, e.g. coepCredentialless: () => !/^((?!chrome|android).)*safari/i.test(navigator.userAgent) Under require-corp, CORS fetches of example files keep working (raw.githubusercontent.com sends Access-Control-Allow-Origin: *), but no-cors subresources need a CORP header — the example thumbnails set as CSS background-image would need to be loaded as <img crossorigin="anonymous"> (CORS mode) to keep working on Safari.
  • Independently of the fix: if crossOriginIsolated is still false after the service-worker reload, show a clear "this browser can't run the engine" notice instead of an indefinite Engine loading….

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions