Skip to content

IsolationTest: parent origin access can throw in sandboxed iframes #188

@rgbkrk

Description

@rgbkrk

Problem

In IsolationTest.tsx, reading window.parent.location.origin can throw synchronously in sandboxed cross-origin iframes. This path is not guarded with try/catch.

Additionally, isIsolated doesn't include canFetchParentOrigin in its predicate, so the status can report "isolated" even when that specific check fails or passes unexpectedly.

Location

  • registry/outputs/isolated/IsolationTest.tsx

Suggested Fix

  1. Wrap parent-origin derivation in try/catch:

    let parentOrigin: string | null = null;
    try {
      parentOrigin = window.parent.location?.origin ?? null;
    } catch {
      parentOrigin = null; // Expected in sandboxed iframe
    }
  2. Include !testResult.canFetchParentOrigin in the isIsolated predicate and checklist

Severity

Low - this is a test/diagnostic component, not user-facing functionality. But it can cause confusing results when diagnosing isolation issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions