DXR doesn't show some file types as text only



2 years ago
2 years ago


(Reporter: Alex Kontos, Unassigned)


Firefox Tracking Flags

(Not tracked)




2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586

Steps to reproduce:

View the raw source for https://dxr.mozilla.org/mozilla-central/source/browser/base/content/abouthome/aboutHome.xhtml

Actual results:

The XHTML page gets rendered rather than being displayed as text only

Expected results:

I assumed I would be able to view the source of the file

Comment 1

2 years ago
I'm unsure if raw is meant to display the source of the files or just let the server deal with the default mime types for said files, so this could be as intended.

Comment 2

2 years ago
Hi Alex,

It's not clear from a user's perspective, but what's going on is that the mozilla-central repository that dxr indexed in this case has a mercurial remote of https://hg.mozilla.org/mozilla-central, and so dxr constructs those "VCS links", including the Raw link, to come from https://hg.mozilla.org/mozilla-central - dxr has no control over how hg.mozilla.org, or whatever default remote a given repository dxr is indexing might happen to have, chooses to serve those files.

In this case hg.mozilla.org is serving that xhtml as "application/xhtml+xml" and so your browser tries to render it as xhtml content.  And in this case fails.  DXR doesn't have a way to view plain uninterpreted file content without the rest of the DXR UI, so I think your options are to either just select the content from within DXR by hand and copy it into a new file, or you can "View Page Source" on the error page you get from the "Raw" link and that will actually display the source of the content, not the source of the error page.
Last Resolved: 2 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.