Closed Bug 102437 Opened 23 years ago Closed 22 years ago

[FIX]outdated view source charset handling can be removed

Categories

(Core :: Internationalization, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.3alpha

People

(Reporter: bzbarsky, Assigned: bzbarsky)

References

Details

(Keywords: intl, perf)

Attachments

(1 file, 1 obsolete file)

nsXMLDocument.cpp has a lot of charset handling stuff for view-source. Unfortunately, view-source is no longer an XML document; it's been an HTML document for over a year now. I can't figure out whether this charset detection needs to be moved over to nsHTMLDocument or just deleted or what....
assigning to ftang
Assignee: yokoyama → ftang
Keywords: intl
please be specific.
Do you mean I should be specific as to what code I mean?
yea
http://lxr.mozilla.org/seamonkey/source/content/xml/document/src/nsXMLDocument.cpp#467 The code is: if(bIsHTML &&(0 == nsCRT::strcmp("view-source", aCommand))) { // only do this for view-source //view source is now an XML document and we need to make provisions //for the usual charset use when displaying those documents, this //code mirrors nsHTMLDocument.cpp ... about 150 lines of charset detection code ... } Actually, the enclosing 462 nsCOMPtr<nsIContentViewer> cv; 463 docShell->GetContentViewer(getter_AddRefs(cv)); 464 if (cv) { also looks like it could go.
nhotta- can you take a look at this one ?
Assignee: ftang → nhotta
Priority: -- → P4
So is this requesting to use the detection code in nsHTMLDocument for XML?
Status: NEW → ASSIGNED
No. The code in nsXMLDocument is only used if we are viewing source. That means that we never use it (since view source now uses an HTML document to show the source, so XML documents never have aCommand == "view-source"). So it's just code that's doing nothing. Therefore we should either remove it (reducing bloat) or move it over to nsHTMLDocument if that does not contain equivalent detection (improving correctness).
ok, thanks
Target Milestone: --- → mozilla1.0
Keywords: mozilla1.0
Reassign to shanjian.
Assignee: nhotta → shanjian
Status: ASSIGNED → NEW
Target Milestone: mozilla1.0 → ---
QA Contact: andreasb → ylong
*** Bug 129966 has been marked as a duplicate of this bug. ***
I filed bug 129966 and bzbarsky pointed me to this bug. What is needed is just to delete a chunk of code (c.f. comment #5) that has become useless as a result of using another approach for the view-source feature.
Status: NEW → ASSIGNED
updating title to better reflect the reality.
Summary: view source charset handling may need to be moved → outdated view source charset handling can be removed
Attached patch remove the junk (obsolete) — Splinter Review
I realized today that this is doing some expensive and useless work on every single XML file (including fun shit like XBL bindings and such).
bbaetz? rbs? reviews?
Assignee: shanjian → bzbarsky
Status: ASSIGNED → NEW
Keywords: perf
Priority: P4 → P1
Summary: outdated view source charset handling can be removed → [FIX]outdated view source charset handling can be removed
Target Milestone: --- → mozilla1.3alpha
Comment on attachment 105390 [details] [diff] [review] remove the junk r=bbaetz the non-mine stuff was never being run, because bISHTML should never be true for an XML document, + the strcmp for viewsource would fail anyway.
Attachment #105390 - Flags: review+
Comment on attachment 105390 [details] [diff] [review] remove the junk sr=heikki I want more patches like this :)
Attachment #105390 - Flags: superreview+
Is the left-over intentional (e.g., in .h)? (c.f. the bonsai diff in comment #13).
Also, |charsetSource| and the whole chunk of code commented as "check channel's charset..." seem useless now.
The charset/charsetsource is passed to the parser... I left it in fairly deliberately, because I can't tell for sure that it's safe to remove it. Is it?
This comment got trapped in mid-air limbo.. it's a response to comment 19: more or less, since I also left in the code that gets the charset from the channel... that part may still make sense in XML that's not view-source. I landed the patch (before seeing rbs' comment). Patch to clean up the headers coming up...
Attachment #105390 - Attachment is obsolete: true
r/sr=rbs if you need it.
I do. heikki? Bradley?
Checked in. The rest of that code looks like it might actually do something (in fact it almost certainly does, in the case when the XML is not UTF8 and does not specify an encoding in the XML decl, which is legal if you specify it in the HTTP headers). So marking fixed.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
No regression was found with view page source on trunk build, so marking as verified with this code change bug.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: