mozilla/pdf.js · error · Error

fullscreen.transitions is read-only

Error message

fullscreen.transitions is read-only

What it means

Thrown by the setter of `FullScreen.transitions` (src/scripting_api/fullscreen.js:130). The `transitions` property returns a fixed, read-only list of supported page-transition names (per the Acrobat JS spec); PDF.js hard-codes the array and forbids replacing it. Other `FullScreen` setters silently no-op, but `transitions` is the single read-only one.

Source

Thrown at src/scripting_api/fullscreen.js:130

      "WipeUp",
      "SplitHorizontalIn",
      "SplitHorizontalOut",
      "SplitVerticalIn",
      "SplitVerticalOut",
      "BlindsHorizontal",
      "BlindsVertical",
      "BoxIn",
      "BoxOut",
      "GlitterRight",
      "GlitterDown",
      "GlitterRightDown",
      "Dissolve",
      "Random",
    ];
  }

  set transitions(_) {
    throw new Error("fullscreen.transitions is read-only");
  }

  get usePageTiming() {
    return this._usePageTiming;
  }

  set usePageTiming(_) {
    /* TODO or not */
  }

  get useTimer() {
    return this._useTimer;
  }

  set useTimer(_) {
    /* TODO or not */
  }
}

View on GitHub (pinned to 5903d58d58)

Solutions

  1. Do not assign `transitions`; read the fixed list to validate user choices instead.
  2. If you need a restricted subset, keep your own array and check membership against the returned list.
  3. Wrap the assignment in try/catch if it comes from code you cannot refactor.

Example fix

// before
app.fs.transitions = myTransitions;
// after
const allowed = app.fs.transitions; // read-only list
const safe = myTransitions.filter(t => allowed.includes(t));
Defensive patterns

Strategy: try-catch

Validate before calling

const READ_ONLY_FS_PROPS = new Set(['transitions']);
function isWritableFsProp(key) {
  return !READ_ONLY_FS_PROPS.has(key);
}

Try / catch

try {
  app.fs.transitions = list;
} catch (e) {
  // transitions is read-only; filter against the fixed list instead
  const allowed = app.fs.transitions;
  const safe = list.filter(t => allowed.includes(t));
}

Prevention

When it happens

Trigger: A presentation script executes `app.fs.transitions = [...];` to constrain allowed transitions, or generic code that writes back a snapshot of every full-screen property.

Common situations: Presentation-mode scripts ported from Acrobat that customize the transition whitelist; round-tripping a settings object through serialization.

Related errors


AI-assisted analysis of mozilla/pdf.js@5903d58d58 (2026-08-13). Data as JSON: /api/errors/b4db0e887b69c541. Report an issue: GitHub.