Closed
Bug 243034
Opened 21 years ago
Closed 21 years ago
Make nsWyciwygChannel suck less
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
People
(Reporter: jst, Unassigned)
References
Details
Attachments
(2 files)
15.44 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
2.19 KB,
patch
|
bzbarsky
:
review+
bzbarsky
:
superreview+
|
Details | Diff | Splinter Review |
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.
Reporter | ||
Comment 1•21 years ago
|
||
Reporter | ||
Comment 2•21 years ago
|
||
Comment on attachment 147994 [details] [diff] [review]
Like so?
bz, whaddayathink?
Attachment #147994 -
Flags: superreview?(bzbarsky)
Attachment #147994 -
Flags: review?(bzbarsky)
![]() |
||
Comment 3•21 years ago
|
||
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+
Reporter | ||
Comment 4•21 years ago
|
||
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.
Reporter | ||
Comment 5•21 years ago
|
||
FIXED.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Comment 6•21 years ago
|
||
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?
Comment 7•21 years ago
|
||
(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...
![]() |
||
Comment 8•21 years ago
|
||
(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.
Reporter | ||
Comment 9•21 years ago
|
||
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...
Reporter | ||
Comment 10•21 years ago
|
||
Reporter | ||
Updated•21 years ago
|
Attachment #148219 -
Flags: superreview?(bzbarsky)
Attachment #148219 -
Flags: review?(bzbarsky)
![]() |
||
Comment 11•21 years ago
|
||
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+
Reporter | ||
Comment 12•21 years ago
|
||
Fix checked in.
Reporter | ||
Comment 13•21 years ago
|
||
This caused bug 244178.
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•