Go to this link. The PDF doesn't load, while it does in Firefox and Chrome. Note that if you go to https://github.com/ethereum/research/blob/master/papers/CasperTFG then click on CasperTFG.pdf it will render on Github, as it does on Chrome and Firefox. If you try to open it in a new tab it doesn't load. It doesn't make a difference if all cookies are allowed, nor if Brave shields are down.
Actual result:

Expected result:

Reproduces how often:
100%
Brave: 0.19.80
rev: 7d07299a5d462d3c9ae32cfbfbe7296cc57c89b9
Muon: 4.5.13
libchromiumcontent: 62.0.3202.75
V8: 6.2.414.36
Node.js: 7.9.0
Update Channel: Release
OS Platform: Linux
OS Release: 4.13.0-17-generic
OS Architecture: x64
Reproducible on current live release:
Yes
I've had this problem as well on other sites, but not really sure what circumstances cause it.
The pdf does load if it is the link itself that opens the new tab (e.g. when left-clicking on a pdf-link in gmail), but not when the user opens the new tab (e.g. ctrl-clicking the pdf-link).
This is the same issue as #11059 ?
CC @diracdeltas
Fixing this likely requires fixing 2 bugs. First, an HTML page is being served with a .pdf extension:
$ curl -I https://github.com/ethereum/research/blob/master/papers/CasperTFG/CasperTFG.pdf
HTTP/1.1 200 OK
Server: GitHub.com
Date: Fri, 16 Feb 2018 21:29:51 GMT
Content-Type: text/html; charset=utf-8
This then confuses the PDF check in js/lib/urlutil.js:
/**
* Converts a potential PDF URL to the PDFJS URL.
* XXX: This only looks at the URL file extension, not MIME types.
* @param {string} url
* @return {string}
*/
toPDFJSLocation: function (url) {
if (url && UrlUtil.isHttpOrHttps(url) && UrlUtil.isFileType(url, 'pdf')) {
return UrlUtil.getPDFViewerUrl(url)
}
return url
},
Once that's fixed, the next problem is that brave doesn't yet know how to serve PDFs to sub-frames on a page, see my recent comments in #12992.
This is likely a dupe of #12763.
I can copy and paste https://ethereum.github.io/yellowpaper/paper.pdf into the URL bar and it will open the PDF in the tab. Right clicking and opening the link in a new tab also works. If I left-click the link it prompts to download it. Perhaps it also has something to do with different PDF versions, e.g. if it is PDF1.5 or later, it will be compatible with browser extensions as listed here.
Looks like that link both uses .pdf and also the correct mime type:
$ curl -I https://ethereum.github.io/yellowpaper/paper.pdf
HTTP/2 200
date: Sat, 17 Feb 2018 18:19:26 GMT
server: GitHub.com
content-type: application/pdf
You're right about the left-click downloading vs. showing, which I think is due to the subFrame resource type being ignored (#12992).
I'll add my notes above to that other bug.