{"record":{"id":"fcc51d9d4890b9e9","repo":"mozilla/pdf.js","slug":"app-printcolorprofiles-is-read-only","errorCode":null,"errorMessage":"app.printColorProfiles is read-only","messagePattern":"app\\.printColorProfiles is read-only","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/scripting_api/app.js","lineNumber":314,"sourceCode":"\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\n  get runtimeHighlight() {\n    return this._runtimeHighlight;\n  }\n\n  set runtimeHighlight(val) {\n    this._runtimeHighlight = val;\n    /* TODO */\n  }","sourceCodeStart":296,"sourceCodeEnd":332,"githubUrl":"https://github.com/mozilla/pdf.js/blob/5903d58d58e4dd9ce6ffa3834aea8480f06b4ada/src/scripting_api/app.js#L296-L332","documentation":"app.printColorProfiles returns an empty array (PDF.js does not enumerate color profiles). It is a viewer-managed property, so the setter throws. Assignment is rejected unconditionally.","triggerScenarios":"Any assignment app.printColorProfiles = [...] in PDF JavaScript or caller code hits the throw at src/scripting_api/app.js:314.","commonSituations":"Print workflows trying to inject ICC profile lists; authors assuming undefined/empty implies writable.","solutions":["Read app.printColorProfiles only; expect [].","Configure color profiles through the host print pipeline, not the scripting API.","Feature-detect before attempting print-color-profile logic."],"exampleFix":"// before\napp.printColorProfiles = [profile];\n// after\nconst profiles = app.printColorProfiles; // [] in pdf.js","handlingStrategy":"validation","validationCode":"// app.printColorProfiles always returns [] in pdf.js.\nconst hasProfiles = (app) => app.printColorProfiles.length > 0;","typeGuard":"const isProfileList = (v) => Array.isArray(v);","tryCatchPattern":"try { /* code that may assign app.printColorProfiles */ }\ncatch (e) { if (!/printColorProfiles is read-only/.test(e.message)) throw e; }","preventionTips":["Configure ICC profiles at the host print layer.","Expect [] and feature-detect before print-profile logic.","Never assign to print-related read-only properties."],"tags":["scripting-api","read-only","print","stub"],"backgroundTag":null,"analyzedSha":"5903d58d58e4dd9ce6ffa3834aea8480f06b4ada","analyzedAt":"2026-08-13T02:28:27.364Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}