/** * CSP-Safe Expression Parser * * WHY THIS EXISTS: * Page Content Security Policy (CSP) blocks eval() and new Function() — the two * mechanisms normally used by execute_js. But chrome.scripting.executeScript can * inject a PRE-COMPILED function reference into the page's MAIN world. Chrome's * native injection mechanism bypasses CSP because no string-to-code conversion * happens — the function was compiled at extension build time. * * HOW IT WORKS: * 1. This parser converts a JS expression string into a structured command * (property paths, method calls, literal arguments — all JSON-serializable data). * 2. The structured command is passed as an ARGUMENT to a pre-compiled executor * function via chrome.scripting.executeScript({func: executor, args: [command]}). * 3. The executor interprets the command using direct property access (obj[key]) * and Function.prototype.apply() — operations CSP does NOT restrict. * * CSP blocks CODE-FROM-STRINGS (eval, new Function, inline