Closed Bug 207904 Opened 22 years ago Closed 22 years ago

Saving XML saves wrong contents !

Categories

(Core :: XML, defect)

defect
Not set
critical

Tracking

()

RESOLVED FIXED
mozilla1.4final

People

(Reporter: beanladen, Assigned: hjtoi-bugzilla)

References

()

Details

(Keywords: dataloss, regression)

Attachments

(2 files)

User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529 Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030529 Saving the file given via right button changes the contents of the file saved. Line 6 is changed from <!DOCTYPE SearchResuls> to <!DOCTYPE [earchResul]> ! Reproducible: Always Steps to Reproduce: 1.Goto given URL 2.Save via right button 'save link target as...' 3.View contents of saved file and source view of file Actual Results: Line 6 is changed from <!DOCTYPE SearchResuls> to <!DOCTYPE [earchResul]> ! Expected Results: Do not change downloaded file contents ! Very strange thing, I've never seen something like this before. Maybe there's more changed, I did not check the whole contents.
Severe enough to block 1.4 ?
Flags: blocking1.4?
Of course, it should be <!DOCTYPE SearchResult> .... Active character coding is UTF 8.
WFM 20030529 PC/WinXP
You're saving the page as "Web Page, complete", so we do various fixup of the data to point urls to relative forms of the urls. We shouldn't be changing the doctype like that, though....
Status: UNCONFIRMED → NEW
Ever confirmed: true
OS: Linux → All
Hardware: PC → All
Status: NEW → ASSIGNED
Keywords: dataloss
Target Milestone: --- → mozilla1.4final
I don't see anything in the persist object that might cause this problem, however "save as complete" also involves a parser, a DOM and XML serializer so it could be a problem with one of those. Saving only the page just dumps out the unmolested original data straight from the URI. In particular I notice from breakpointing here: http://lxr.mozilla.org/seamonkey/source/content/base/src/nsXMLContentSerializer.cpp#225 That the doctype is saved with no name and internalSubset == "earchResul". So looking further and I see the parser is at fault. During parsing it has lopped off the start and end characters assuming them to be '[' and ']', stuffing the rest into the internalSubset value. I think <!DOCTYPE SearchResult> is valid XML from the spec, but perhaps the parser is not doing the right thing when is not followed by a public or system keyword or a set of declarations.
This a regression. I don't know yet when this regressed, but something changed so that |mDoctypeText| no longer includes the closing |>| which throws off |GetDocTypeToken()|.
Keywords: nsbeta1, regression
Attached patch Proposed fixSplinter Review
There have been same changes in how we handle the [] delimiters in the internal subset, but I didn't notice what could have caused the difference. I noticed in my testing that the doctype closing '>' is no longer in mDoctypeText, therefore it is no longer a delimiter in |GetDocTypeToken()|. To fix the case where there is nothing but name, I decided to test if the delimiter find returned a negative value, and in that case make the method consume the whole doctype.
Attachment #124776 - Flags: superreview?(jst)
Attachment #124776 - Flags: review?(harishd)
Comment on attachment 124776 [details] [diff] [review] Proposed fix sr=jst
Attachment #124776 - Flags: superreview?(jst) → superreview+
Comment on attachment 124776 [details] [diff] [review] Proposed fix r=harishd
Attachment #124776 - Flags: review?(harishd) → review+
Checked in on trunk, leaving open to get this to the branch. The fix is low risk, fixes a dataloss regression issue that actually prevents you from opening the XML files in Mozilla (because they will become invalid XML).
Whiteboard: fixed-trunk
a=adt. Please land this fix on the Mozilla 1.4 branch and add fixed1.4 to the staus whiteboard.
Comment on attachment 124776 [details] [diff] [review] Proposed fix a=asa (on behalf of drivers) for checkin to the 1.4 branch.
Attachment #124776 - Flags: approval1.4? → approval1.4+
Comment on attachment 124776 [details] [diff] [review] Proposed fix Please add fixed1.4 when checked into branch
Fixed on branch as well.
Status: ASSIGNED → RESOLVED
Closed: 22 years ago
Flags: blocking1.4?
Keywords: fixed1.4
Resolution: --- → FIXED
Whiteboard: fixed-trunk
verified fixed on branch checked builds :- Linux 2003-06-19-07-1.4 WinXP 2003-06-24-08-1.4 changing KW : fixed1.4 to verified1.4 keeping the status as resolved for now, since it has to be verifed fixed on trunk as well.
Keywords: fixed1.4verified1.4
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: