Summary: | Crash in PDFDocument::injectStyleAndContentScript when downloading PDF | ||
---|---|---|---|
Product: | WebKit | Reporter: | Michael Catanzaro <mcatanzaro> |
Component: | WebKitGTK | Assignee: | Michael Catanzaro <mcatanzaro> |
Status: | RESOLVED FIXED | ||
Severity: | Normal | CC: | bugs-noreply, mcatanzaro, webkit-bug-importer |
Priority: | P2 | ||
Version: | WebKit Nightly Build | ||
Hardware: | PC | ||
OS: | Linux | ||
See Also: | https://bugs.webkit.org/show_bug.cgi?id=272590 | ||
Bug Depends on: | |||
Bug Blocks: | 235969 |
Description
Michael Catanzaro
2022-12-24 10:15:57 PST
Can't reproduce anymore. Don't know what changed. Reopening because this crash is reproducible for some websites but not others: Crash: https://dor.mo.gov/forms/MO-1040%20Instructions_2022.pdf No crash: https://www.irs.gov/pub/irs-pdf/i1040gi.pdf So the problem here is PDFDocument::injectStyleAndContentScript expects to be called only once per PDFDocument and releases the PDFDocument's reference to the PDFDocumentEventListener. But the PDFDocumentEventListener is still valid even though PDFDocument::m_listener is null, and it calls PDFDocument::injectStyleAndContentScript a second time for the download. This results in a crash because the function assumes m_listener is never null (because it will never be null the first time it is called). I'm still trying to figure out how to fix it. Well I can at least make it not crash, but I'm not sure how to make the download actually work. It's getting blocked by CSP: [Error] Refused to load blob:webkit-pdfjs-viewer://pdfjs/39176f55-4f67-4515-9733-dc0f6d764506 because it does not appear in the frame-src directive of the Content Security Policy. Not sure why this happens for https://dor.mo.gov/forms/MO-1040%20Instructions_2022.pdf but not for https://www.irs.gov/pub/irs-pdf/i1040gi.pdf Pull request: https://github.com/WebKit/WebKit/pull/27174 The download failure might be related to bug #264355. Possibly the website's content security policy is blocking webkit-pdfjs-viewer://? Committed 277434@main (96e3800242ca): <https://commits.webkit.org/277434@main> Reviewed commits have been landed. Closing PR #27174 and removing active labels. |