Open Bug 1627092 Opened 5 years ago Updated 2 years ago

Firefox corrupts XML when saving using Save Page As from context menu with "Web page, complete"

Categories

(Core :: DOM: Serializers, defect, P2)

74 Branch
defect

Tracking

()

People

(Reporter: pip, Unassigned)

References

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:74.0) Gecko/20100101 Firefox/74.0

Steps to reproduce:

  1. Navigate to https://www.legislation.gov.uk/anaw/2020/1/enacted/data.xml
  2. Right click on page
  3. Click Save Page As...
  4. Save file as anaw-2020-1-enacted-saveas.xml with the option "Web Page, complete"
  5. Download https://www.legislation.gov.uk/anaw/2020/1/enacted/data.xml as anaw-2020-1-enacted-orig.xml, using another browser, cURL, copy and paste from View Source in Firefox into a text editor, or right click a link to that URL and click Save Link As
  6. Diff anaw-2020-1-enacted-orig.xml and anaw-2020-1-enacted-saveas.xml

Can also reproduce with https://www.legislation.gov.uk/ukpga/1990/1/enacted/data.xml and https://www.legislation.gov.uk/ukpga/2020/1/enacted/data.xml, but not https://www.legislation.gov.uk/ukpga/2010/1/enacted/data.xml or https://www.legislation.gov.uk/ukpga/1995/1/enacted/data.xml. So far, the only difference I can see is that the documents that I can reproduce this in (corruption) have XHTML elements present, and the ones that I can't (no corruption) don't have XHTML elements present.

Actual results:

The -saveas.xml version has bogus "namespaces" (of the form </a[0-9]+:tag>) on only the closing tags of various elements. Also, some of the xmlns attributes have been removed from the opening tags.

Tested in Firefox 74 on Windows and Mac, on different networks.

Note that the following methods of saving the XML do not cause this issue:

  • Copy-pasting the code from View Page Source on the above URL into a text editor
  • Right-clicking a link to the above URL and clicking Save Link As
  • Using Save Page As and the option "Web Page, XML only"
  • Using Save Page As on a different browser on the same machine

Expected results:

The files should be the same

Component: Untriaged → DOM: Serializers
Product: Firefox → Core
See Also: → 120556

Confirmed.

Unless we can show that this behavior cannot be triggered by POSTing an XML document via XHR, I think this deserves P2. (If it turns out that this can be triggered only via Save As... + Complete, let's downgrade to P3.)

Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P2
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: