Closed Bug 243034 Opened 21 years ago Closed 21 years ago

Make nsWyciwygChannel suck less

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jst, Unassigned)

References

Details

Attachments

(2 files)

Currently we always convert document.write() data to UTF-8 when we write it to a wycywyg channel. In stead of doing that, we could simply write it out as UTF-16 and avoid the conversion+copy. Patch coming up.
Attached patch Like so?Splinter Review
Comment on attachment 147994 [details] [diff] [review] Like so? bz, whaddayathink?
Attachment #147994 - Flags: superreview?(bzbarsky)
Attachment #147994 - Flags: review?(bzbarsky)
Comment on attachment 147994 [details] [diff] [review] Like so? r+sr=bzbarsky assuming you tested this (create a page via document.write, then go to some other page, then go back to the wyciwyg one, that sort of thing) and it works.
Attachment #147994 - Flags: superreview?(bzbarsky)
Attachment #147994 - Flags: superreview+
Attachment #147994 - Flags: review?(bzbarsky)
Attachment #147994 - Flags: review+
Yup, that works. And I inspected things in the debugger as well to make sure the parser got the character conversion right with this change.
FIXED.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Question about this: static NS_NAMED_LITERAL_STRING(new_line, "\n"); static NS_NAMED_LITERAL_STRING(empty, ""); const nsAString *term = aNewlineTerminate ? &new_line : ∅ const nsAutoString text = aText + *term; Could it be rewritten as, to prevent string copying, and adding an 'empty' string: static NS_NAMED_LITERAL_STRING(new_line, "\n"); const nsAString text = aNewlineTerminate ? aText + new_line : aText; Or are the string classes allready smart enough to prevent string copying in case of adding an empty string?
(In reply to comment #6) > Question about this: > static NS_NAMED_LITERAL_STRING(new_line, "\n"); > static NS_NAMED_LITERAL_STRING(empty, ""); Hmm, static literal strings? aren't those bad? And what about EmptyString()? hm, that code wasn't touched by the patch.... > const nsAString text = aNewlineTerminate ? aText + new_line : aText; nsAString is an abstract class, and can't be instantiated...
(In reply to comment #6) > const nsAString *term = aNewlineTerminate ? &new_line : ∅ Assuming you meant nsAString&, that doesn't compile on at least some of the platforms we want to support (HP-UX) and crashes on others (some gcc versions on Linux). Basically, you can't use ?: with strings in a sane way.
Right, and because of that, and the fact that our string code isn't smart enough to not copy when doing string + EmptyString(), it might be worth not doing the concatenation in the cases where we don't need to. I'll attach a patch that does that...
Attachment #148219 - Flags: superreview?(bzbarsky)
Attachment #148219 - Flags: review?(bzbarsky)
Comment on attachment 148219 [details] [diff] [review] Don't concatenate strings with empty strings. r+sr=bzbarsky
Attachment #148219 - Flags: superreview?(bzbarsky)
Attachment #148219 - Flags: superreview+
Attachment #148219 - Flags: review?(bzbarsky)
Attachment #148219 - Flags: review+
Fix checked in.
This caused bug 244178.
Depends on: 348301
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: