{"record":{"id":"292f8fe974078e0c","repo":"mozilla/pdf.js","slug":"app-plugins-is-read-only","errorCode":null,"errorMessage":"app.plugins is read-only","messagePattern":"app\\.plugins is read-only","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/scripting_api/app.js","lineNumber":306,"sourceCode":"  set openInPlace(val) {\n    this._openInPlace = val;\n    /* TODO */\n  }\n\n  get platform() {\n    return this._platform;\n  }\n\n  set platform(_) {\n    throw new Error(\"app.platform is read-only\");\n  }\n\n  get plugins() {\n    return [];\n  }\n\n  set plugins(_) {\n    throw new Error(\"app.plugins is read-only\");\n  }\n\n  get printColorProfiles() {\n    return [];\n  }\n\n  set printColorProfiles(_) {\n    throw new Error(\"app.printColorProfiles is read-only\");\n  }\n\n  get printerNames() {\n    return [];\n  }\n\n  set printerNames(_) {\n    throw new Error(\"app.printerNames is read-only\");\n  }\n","sourceCodeStart":288,"sourceCodeEnd":324,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/scripting_api/app.js#L288-L324","documentation":"app.plugins returns an empty array because PDF.js has no plugin objects. The list is viewer-managed and read-only; the setter throws. Assignment is rejected unconditionally.","triggerScenarios":"Any assignment app.plugins = [...] in PDF JavaScript or API test code hits the throw at src/scripting_api/app.js:306.","commonSituations":"Scripts trying to register plugin descriptors; authors assuming the array is a public registry.","solutions":["Read app.plugins only; expect [] in PDF.js.","Detect plugin support via app.numPlugins (also 0).","Keep any plugin-like extensibility outside the scripting API."],"exampleFix":"// before\napp.plugins = [myPlugin];\n// after\nconst plugins = app.plugins; // [] in pdf.js","handlingStrategy":"validation","validationCode":"// app.plugins always returns [] in pdf.js.\nconst pluginNames = (app) => app.plugins.map(p => p?.name);","typeGuard":"const isPluginList = (v) => Array.isArray(v);","tryCatchPattern":"try { /* code that may assign app.plugins */ }\ncatch (e) { if (!/plugins is read-only/.test(e.message)) throw e; }","preventionTips":["Treat plugin lists as viewer-managed.","Detect via app.numPlugins > 0.","Keep extensibility outside the scripting API."],"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"}