File: packages/fingerprint-injector/src/utils.js, inside fixIframeContentWindow() → handleIframeCreation() → the srcdoc setter
The problem — two consecutive lines contradict each other:
set(newValue) {
addContentWindowProxy(this);
// Step 1: Lock the property as NON-WRITABLE
Object.defineProperty(iframe, 'srcdoc', {
configurable: false,
writable: false, // ← srcdoc is now read-only
value: _srcdoc,
});
// Step 2: Try to assign to it — THROWS because step 1 just made it read-only
_iframe.srcdoc = newValue; // ← "Cannot assign to read only property 'srcdoc'"
}
Step 1 locks the property as writable: false. Step 2 immediately tries to assign a new value to that same property. In strict mode (which TypeScript-compiled code uses), this throws an error. The srcdoc content never gets set, and the iframe never loads.
The fix — use setAttribute instead of property assignment:
// Before
_iframe.srcdoc = newValue;
// After
_iframe.setAttribute('srcdoc', newValue);
setAttribute writes directly to the DOM attribute level, completely bypassing the JavaScript property descriptor. It doesn't care whether the JS property is writable or not — the browser still processes it and loads the iframe content correctly.
File: packages/fingerprint-injector/src/utils.js, inside fixIframeContentWindow() → handleIframeCreation() → the srcdoc setter
The problem — two consecutive lines contradict each other:
Step 1 locks the property as writable: false. Step 2 immediately tries to assign a new value to that same property. In strict mode (which TypeScript-compiled code uses), this throws an error. The srcdoc content never gets set, and the iframe never loads.
The fix — use setAttribute instead of property assignment:
setAttribute writes directly to the DOM attribute level, completely bypassing the JavaScript property descriptor. It doesn't care whether the JS property is writable or not — the browser still processes it and loads the iframe content correctly.