Closed
Bug 295531
Opened 20 years ago
Closed 20 years ago
Crash in [@ nsHTMLEditor::InsertHTMLWithContext] inserting a space because it assumes that there is at least one node to paste
Categories
(Core :: DOM: Editor, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: mrbkap, Assigned: mrbkap)
References
Details
(Keywords: crash)
Crash Data
Attachments
(1 file, 1 obsolete file)
|
1.49 KB,
patch
|
Brade
:
review+
sfraser_bugs
:
superreview+
shaver
:
approval1.8b3+
|
Details | Diff | Splinter Review |
This function, which is called from ther Insert -> HTML dialog box in composer,
assumes in a couple of places that there is at least one node to paste. The
result is that if there isn't, it attempts to dereference nodeList[0], and
crashes for its efforts. I'm not entirely sure of why it makes this assumption,
but I have a patch that fixes it to not crash if there are no nodes to paste.
STEPS TO REPRODUCE:
1. Start composer
2. Click on Insert -> HTML
3. Enter ony a space
4. Click "Insert"
EXPECTED RESULTS: Nothing happens (or a space is inserted).
ACTUAL RESULTS: An assertion (followed by a crash).
| Assignee | ||
Comment 1•20 years ago
|
||
This patch fixes the crash/assertion by bailing early if there is not, in fact,
anything to paste.
I'm not certain this is the right approach, but it seems to make sense in this
context.
Updated•20 years ago
|
Summary: nsHTMLEditor::InsertHTMLWithContext assumes that there is at least one node to paste → Crash in [@ nsHTMLEditor::InsertHTMLWithContext] because it assumes that there is at least one node to paste
Comment 2•20 years ago
|
||
Comment on attachment 184545 [details] [diff] [review]
bail early if there is nothing to paste
r=brade
I'm curious what data is causing there to be no nodes. Is the editor being
asked to insert an empty string or ?
Attachment #184545 -
Flags: review?(brade) → review+
| Assignee | ||
Comment 3•20 years ago
|
||
Comment on attachment 184545 [details] [diff] [review]
bail early if there is nothing to paste
Editor is being asked to insert a space. I guess that at some point, spaces get
stripped out, leading to the crash.
Simon, can you sr?
Attachment #184545 -
Flags: superreview?(sfraser_bugs)
| Assignee | ||
Comment 5•20 years ago
|
||
Comment on attachment 184545 [details] [diff] [review]
bail early if there is nothing to paste
After some more debugging, I no longer like this patch. The issue I was seeing
was _another_ htmlparser bug. I want to add an assertion though.
Attachment #184545 -
Flags: superreview?(sfraser_bugs)
| Assignee | ||
Comment 6•20 years ago
|
||
It's worth adding an assertion, IMO, since we're making the assumption later,
anyway.
Attachment #184545 -
Attachment is obsolete: true
Attachment #184631 -
Flags: review?(brade)
| Assignee | ||
Updated•20 years ago
|
Depends on: 295646
Summary: Crash in [@ nsHTMLEditor::InsertHTMLWithContext] because it assumes that there is at least one node to paste → Crash in [@ nsHTMLEditor::InsertHTMLWithContext] inserting a space because it assumes that there is at least one node to paste
Updated•20 years ago
|
Attachment #184631 -
Flags: superreview+
| Assignee | ||
Updated•20 years ago
|
Severity: critical → normal
Updated•20 years ago
|
Attachment #184631 -
Flags: review?(brade) → review+
Comment 7•20 years ago
|
||
Comment on attachment 184631 [details] [diff] [review]
add an assertion
crasher fix
Attachment #184631 -
Flags: approval1.8b3?
Comment 8•20 years ago
|
||
Comment on attachment 184631 [details] [diff] [review]
add an assertion
oh nevermind this actually adds an assertion only ;)
Attachment #184631 -
Flags: approval1.8b3?
| Assignee | ||
Comment 9•20 years ago
|
||
Comment on attachment 184631 [details] [diff] [review]
add an assertion
This assertion has already helped track down two dataloss problems in the HTML
parser, so it should probably go into 1.8b3
Attachment #184631 -
Flags: approval1.8b3?
Comment 10•20 years ago
|
||
Comment on attachment 184631 [details] [diff] [review]
add an assertion
a=shaver
Attachment #184631 -
Flags: approval1.8b3? → approval1.8b3+
| Assignee | ||
Comment 11•20 years ago
|
||
Assertion checked in.
Status: ASSIGNED → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Verified FIXED using Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8b2)
Gecko/20050602 on Windows XP Seamonkey trunk using comment 0 as my testcase.
No crash, and inserting spaces (by themselves) does nothing, which is expected.
Status: RESOLVED → VERIFIED
Updated•14 years ago
|
Crash Signature: [@ nsHTMLEditor::InsertHTMLWithContext]
You need to log in
before you can comment on or make changes to this bug.
Description
•