Remove some write-only variable assignments in HTMLEditor::DoInsertHTMLWithContext()

NEW
Unassigned

Status

()

P3
normal
a year ago
a year ago

People

(Reporter: Ehsan, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

a year ago
No code ever reads the result of these assignments.
(Reporter)

Comment 1

a year ago
Created attachment 8905342 [details] [diff] [review]
Remove some write-only variable assignments in HTMLEditor::DoInsertHTMLWithContext()
Attachment #8905342 - Flags: review?(masayuki)
Comment on attachment 8905342 [details] [diff] [review]
Remove some write-only variable assignments in HTMLEditor::DoInsertHTMLWithContext()

>@@ -553,20 +553,16 @@ HTMLEditor::DoInsertHTMLWithContext(const nsAString& aInputString,
>               bDidInsert = true;
>               insertedContextParent = parent;
>               lastInsertNode = GetChildAt(parentNode, offsetOfNewNode);
>             }
>           }
>           curNode = parent;
>         }
>       }
>-      if (lastInsertNode) {
>-        parentNode = GetNodeLocation(lastInsertNode, &offsetOfNewNode);
>-        offsetOfNewNode++;
>-      }

I don't understand this change. Here is in a for loop:
https://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/editor/libeditor/HTMLEditorDataTransfer.cpp#440,565

And both parentNode may be referred in next time.
https://searchfox.org/mozilla-central/rev/44c693914255638d74bcf1ec3b0bcd448dfab2fd/editor/libeditor/HTMLEditorDataTransfer.cpp#440,460,462,483-484

So, looks like that this breaks something.
Attachment #8905342 - Flags: review?(masayuki) → review-
I forget to omit |both|. only parentNode may be referred.
Priority: -- → P3
You need to log in before you can comment on or make changes to this bug.