Open Bug 1194791 Opened 10 years ago Updated 3 years ago

"File|Save" on a view-source-in-tab (the new default) does not do what the user wants. (It defaults to "web page, complete" & includes view-source formatting in the saved output)

Categories

(Toolkit :: View Source, defect, P3)

defect

Tracking

()

REOPENED
Tracking Status
firefox43 --- affected

People

(Reporter: dholbert, Unassigned)

References

Details

(Keywords: regression)

Attachments

(2 files)

STR: 1. View an SVG file (or any file really, but it's a bit worse with SVG): http://hg.mozilla.org/mozilla-central/raw-file/beb9cc29efb9/layout/reftests/svg/image/lime100x100.svg 2. Ctrl+U to view source. 3. Ctrl+S to save. Note that we save with a ".svg" file extension. 4. Try to open the saved file. EXPECTED RESULTS: Valid SVG file with the source that I was just viewing. ACTUAL RESULTS: Invalid SVG file. We saved a representation of the DOM of the "view-source" page, so there's a bunch of HTML junk in there. From the principle of "Do what I mean" -- if a user is viewing a page's source and they try to save it, they certainly expect to be saving *the source that they're viewing* -- not our weird markup for presenting that source.
Summary: "File|Save" on a view-source page does not do what the user wants → "File|Save" on a view-source page does not do what the user wants. (It pulls in all of the view-source: markup into the saved file)
WORKAROUND: switch away from "Web page, complete" in the save dialog. This seems to only happen if you're doing the "Web page, complete" type of saving. I'm using latest Nightly 43.0a1 (2015-08-14) with e10s disabled, BTW.
Summary: "File|Save" on a view-source page does not do what the user wants. (It pulls in all of the view-source: markup into the saved file) → "File|Save" on a view-source page does not do what the user wants. (It pulls in all of the view-source: markup into the saved file) (with default "web page, complete" option)
Daniel, do you know if this is a regression with the new view source in tab behavior, or has it always been this way?
Flags: needinfo?(dholbert)
(In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #4) > Daniel, do you know if this is a regression with the new view source in tab > behavior, or has it always been this way? This is a regression (presumably from view-source-in-tab). In Firefox 40 (current release), if I perform the STR (getting a view-source popup-window), the "Save" dialog only offers "SVG Image" as the save-operation-type, in the dropdown at the bottom-right. In Firefox Nightly, the "Save" dialog offers (and defaults to) "Web Page, Complete".
Flags: needinfo?(dholbert)
(In reply to Daniel Holbert [:dholbert] from comment #5) > (In reply to J. Ryan Stinnett [:jryans] (use ni?) from comment #4) > > Daniel, do you know if this is a regression with the new view source in tab > > behavior, or has it always been this way? > > This is a regression (presumably from view-source-in-tab). > > In Firefox 40 (current release), if I perform the STR (getting a view-source > popup-window), the "Save" dialog only offers "SVG Image" as the > save-operation-type, in the dropdown at the bottom-right. > > In Firefox Nightly, the "Save" dialog offers (and defaults to) "Web Page, > Complete". Thanks for checking it out!
Blocks: 1067325
Keywords: regression
Just to be sure, I did a quick mozregression run, & confirmed that this is a regression from bug 1067325. Regression range: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=d44425c6730c&tochange=b6623a27fa64 (Any build during my regression run that popped up a view-source dialog would save in the way that I expected. Any build that used view-source-in-tab ended up saving in a broken way.) WORTH NOTING: Even before bug 1067325 landed, you can still trigger the broken behavior if you replace steps 1 and 2 of my STR with "manually visit a view-source: URI directly" -- e.g. if you visit this URI: view-source:http://hg.mozilla.org/mozilla-central/raw-file/beb9cc29efb9/layout/reftests/svg/image/lime100x100.svg So from that sense, it's not a regression (this is how view-source-in-tab has always behaved it seems). But it is a regression from the perspective of the user story, i.e. the STR from comment 0.
Summary: "File|Save" on a view-source page does not do what the user wants. (It pulls in all of the view-source: markup into the saved file) (with default "web page, complete" option) → "File|Save" on a view-source-in-tab (the new default) does not do what the user wants. (It defaults to "web page, complete" & includes view-source formatting in the saved output)
I can confirm the behavior is still the same in Firefox 60, and it’s unexpected that when viewing the source code of a webpage, it’s not the source code of the webpage that is downloaded. When in view-source mode, a better default behavior should be to download only the source that is presented to the user. The user would still be able to choose other options in the saving dialog.
(In reply to ariasuni from comment #8) > When in view-source mode, a better default behavior should be to download > only the source that is presented to the user. The user would still be able > to choose other options in the saving dialog. I definitely agree with this. In order to save the SVG, the user can right click on the original page and pick "Save Page As..". This works as expected -> saving the SVG file. Honza
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
(In reply to Jan Honza Odvarko [:Honza] (need-info? me) from comment #9) > In order to save the SVG, the user can right click on the original page and > pick "Save Page As..". That's true - there are other ways to save the file without the markup -- but it doesn't change the fact that our behavior on the view-source tab is quite unexpected here. (Did you really intend to WONTFIX this -- perhaps that was accidental? The behavior feels quite unexpected and seems worth fixing, if someone got the time to work on it.)
Flags: needinfo?(odvarko)
(In reply to Daniel Holbert [:dholbert] from comment #10) > (Did you really intend to WONTFIX this -- perhaps that was accidental? The > behavior feels quite unexpected and seems worth fixing, if someone got the > time to work on it.) Ok, let's reopen this! @Daniel, can you please provide simple description of what should be done here for anyone interested in this bug? (plus perhaps links to the code base, so it's easier to start exploring it?). Thanks! Honza
Status: RESOLVED → REOPENED
Flags: needinfo?(odvarko) → needinfo?(dholbert)
Resolution: WONTFIX → ---
(In reply to Jan Honza Odvarko [:Honza] (need-info? me) from comment #11) > @Daniel, can you please provide simple description of what should be done > here for anyone interested in this bug? > (plus perhaps links to the code base, so it's easier to start exploring it?). I don't know enough about the view-source code (or the file|save code) to be able to offer those. One possible maybe-simple (?) option: remove/disable the "Web Page, complete" option in the dropdown-menu of the File|Save dialog, for save operations that originate from "View Source". It's extremely unlikely that a user wants to save all of our prettifying markup.
Flags: needinfo?(dholbert)
It occurs to me that it’s the same with the reader mode, so the behavior should probably be consistent. view-source and about:reader display the same page but in a different way, so the save action should work on the same object (i.e. saving the original page). I don’t think removing the option is the best solution, because I want to be able to look at the source code of the page, and then want to save it.
(In reply to ariasuni from comment #13) > It occurs to me that it’s the same with the reader mode, so the behavior > should probably be consistent. This is an interesting point, but I'm not sure I agree, and I think it merits a separate bug. Counterpoint: consider a news article with flash ads and noise and junk all over the place, which a user prefers to view in reader mode. If the user then does File|Save, there's a decent chance that the user *does*, in fact, want to save the reader-mode view that they're preferring to read, as long as that saved copy ends up looking like this reader-mode view that they've opted for. In contrast, users don't "opt" to view pages in view-source mode for the benefit of its formatting/styling, and there's near-zero likelihood that any user would actually want "File|Save" to capture all of the extra styling that the browser applies when showing the colorized/plaintext "view-source". It's pretty plainly clear that the user wants to just save the source itself, in the same format that it was sent to the browser (not with extra browser-added markup). > I don’t think removing the option is the best solution, because I want to be > able to look at the source code of the page, and then want to save it. I'm not suggesting that we remove the ability to save it. I was suggesting (as one possibility) that we remove/disable the "Web page, complete" option from the save menu, in this special case -- because that specific (unfortunately-default) option is what triggers the problem here. See comment 3 and comment 5.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: