Bug 240954

Summary: <object> fails to load same PDF twice
Product: WebKit Reporter: Joe Woods <woods>
Component: PDFAssignee: Nobody <webkit-unassigned>
Status: NEW    
Severity: Normal CC: achristensen, beidson, thorton, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: Safari Technology Preview   
Hardware: Unspecified   
OS: Unspecified   

Joe Woods
Reported 2022-05-26 07:27:05 PDT
I believe this is new in Safari Technology preview, but I could be mistaken: * Insert an `<object>` into the DOM, loading a PDF by the data attribute. * Remove that `<object>`. * Insert another `<object>` into the DOM, loading the same PDF by the data attribute. All subsequent times the object should be loaded, the embedded PDF viewer will not work. I have put together a minimal reproduction here: https://safari-pdf-issue.unstable.email/ Thanks!
Attachments
Alexey Proskuryakov
Comment 1 2022-05-30 19:38:32 PDT
This reproduces for me with macOS 12.5 beta. Looks like <object> gets a zero length PDF every time except the first load. document.getElementById("add").onclick = function () { const pdf = document.getElementById("pdf"); if (pdf) { pdf.parentNode.removeChild(pdf); } const newPdf = document.createElement("object"); newPdf.setAttribute("data", "/dummy.pdf"); newPdf.setAttribute("type", "application/pdf"); newPdf.setAttribute("id", "pdf"); document.body.appendChild(newPdf); }
Radar WebKit Bug Importer
Comment 2 2022-06-02 07:28:13 PDT
Note You need to log in before you can comment on or make changes to this bug.