-
Notifications
You must be signed in to change notification settings - Fork 973
PDFJS returns CORS error when PDF is loaded directly #2715
Comments
This reverts the old workaround for pdfjs returning status code 0 errors, which was causing PDF MIME type detection to stop working in cases where the URL is loaded directly instead of by navigation. A webview reload seems to always get rid of the PDF status code 0 error. This includes a merge of PDFJS latest master, but the fix commit is only diracdeltas/pdf.js@6c18572 Fix #2633 Fix #2654 Fixes the session tab part of #2568 Auditors: @bbondy
Why is the commit called "Fix PDFJS MIME type detection"? I tried hard, but couldn't relate that commit description to the code that had been committed. I didn't look at Brave's source code, but I know that in Chrome there is an issue with granting host permissions (=setting up the origin whitelist in the renderer for the given frame) when an extension is being loaded in a |
@Rob--W originally, to work around this CORS issue, I added a shortcut in Brave to bypass PDF.JS's The CORS issue is still a mystery, but it seems to always go away when the viewer URL is reloaded, so that's the workaround for now. |
it's worth noting the CORS error never appears when a PDF is navigated to, such as by clicking a link. it seems to only fire when webview.loadURL (http://electron.atom.io/docs/api/web-view-tag/) is called. calling webview.reload() fixes it. |
the |
The renderer process needs to be restarted for PDFJS to load PDFs without encountering a CORS error. Brave was calling webview.reload in order to force renderer process restart on non-navigation PDF loads, but this was broken by 02ec0b2. This commit fixes it but a better solution would be for renderer reload to automatically happen on non-navigation chrome-extension loads. cf brave/browser-laptop#2715 Auditors: @bridiver
workaround fixed in brave/muon@7e61ac2 |
The renderer process needs to be restarted for PDFJS to load PDFs without encountering a CORS error. Brave was calling webview.reload in order to force renderer process restart on non-navigation PDF loads, but this was broken by 02ec0b2. This commit fixes it but a better solution would be for renderer reload to automatically happen on non-navigation chrome-extension loads. cf brave/browser-laptop#2715 Auditors: @bridiver
The renderer process needs to be restarted for PDFJS to load PDFs without encountering a CORS error. Brave was calling webview.reload in order to force renderer process restart on non-navigation PDF loads, but this was broken by 02ec0b2. This commit fixes it but a better solution would be for renderer reload to automatically happen on non-navigation chrome-extension loads. cf brave/browser-laptop#2715 Auditors: @bridiver
Test plan
#12138 (comment)
611f617 works around the fact that a PDF loaded directly in Brave via webview loadUrl causes a CORS error. reloading always fixes the error for me. seems like some kind of race condition with how the origin is being set.
The text was updated successfully, but these errors were encountered: