webrecorder / wombat

Wombat.js client-side rewriting library
GNU Affero General Public License v3.0
81 stars 31 forks source link

Rewrite document.write / srcdoc assign with remote blob fetch when in service-worker mode #115

Closed ikreymer closed 1 year ago

ikreymer commented 1 year ago

Due to several issues in Chrome, in particular: https://bugs.chromium.org/p/chromium/issues/detail?id=880768 https://bugs.chromium.org/p/chromium/issues/detail?id=1102209

an iframe loses its service worker after document.write is called in the iframe. Same for about:blank or srcdoc: iframe. As a work-around, prevent document.write() calls from being made, and instead store the written text, create blob, and load via service-worker /blob:<blob id> response, thereby allowing the iframe to still be controlled by the service worker. Also override srcdoc: assignment and convert to blob in the same way