{"record":{"id":"d89aaad698612247","repo":"mozilla/pdf.js","slug":"app-monitors-is-read-only","errorCode":null,"errorMessage":"app.monitors is read-only","messagePattern":"app\\.monitors is read-only","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/scripting_api/app.js","lineNumber":273,"sourceCode":"\n  set language(_) {\n    throw new Error(\"app.language is read-only\");\n  }\n\n  get media() {\n    return undefined;\n  }\n\n  set media(_) {\n    throw new Error(\"app.media is read-only\");\n  }\n\n  get monitors() {\n    return [];\n  }\n\n  set monitors(_) {\n    throw new Error(\"app.monitors is read-only\");\n  }\n\n  get numPlugins() {\n    return 0;\n  }\n\n  set numPlugins(_) {\n    throw new Error(\"app.numPlugins is read-only\");\n  }\n\n  get openInPlace() {\n    return this._openInPlace;\n  }\n\n  set openInPlace(val) {\n    this._openInPlace = val;\n    /* TODO */\n  }","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/scripting_api/app.js#L255-L291","documentation":"app.monitors returns an empty array (PDF.js exposes no monitor enumeration). It is a viewer-managed list, so the setter throws. Assignment is rejected unconditionally.","triggerScenarios":"Any assignment app.monitors = [...] in PDF JavaScript or API test code hits the throw at src/scripting_api/app.js:273.","commonSituations":"Scripts trying to register or fake monitor entries for layout logic; authors assuming the array is extensible.","solutions":["Read app.monitors only; expect [] in PDF.js.","Obtain screen geometry from the host page/window APIs instead.","Do not attempt to push into the returned array expecting persistence."],"exampleFix":"// before\napp.monitors = [{ width: 1920 }];\n// after\nconst monitors = app.monitors; // [] in pdf.js; use host APIs instead","handlingStrategy":"validation","validationCode":"// app.monitors always returns [] in pdf.js.\nconst monitorCount = (app) => app.monitors.length;","typeGuard":"const isMonitorList = (v) => Array.isArray(v);","tryCatchPattern":"try { /* code that may assign app.monitors */ }\ncatch (e) { if (!/monitors is read-only/.test(e.message)) throw e; }","preventionTips":["Treat viewer-enumeration properties as read-only.","Use host screen APIs for geometry.","Do not push into returned arrays."],"tags":["scripting-api","read-only","stub","acrobat-js"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}