Closed Bug 262964 Opened 20 years ago Closed 20 years ago

nsRange::InsertNode fails because of nsGenericDOMDataNode::SplitText

Categories

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

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: atremon, Unassigned)

Details

Attachments

(2 files)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040927
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8a4) Gecko/20040927

SplitText calls CloneContent.
CloneContent implementation has been changed (see bug 27382)

Reproducible: Always
Steps to Reproduce:
In an app embedding Gecko:

#include "nsIDOMDocument.h"
#include "nsIDOMDocumentRange.h"
#include "nsIDOMElement.h"
#include "nsIDOMRange.h"
#include "nsIDOMNode.h"
#include "nsIDOMText.h"
#include "nsISelection.h"
#include "nsIDOMWindow.h"

nsresult rv;
nsIDOMDocument* domDoc;
mWebNav->GetDocument(&domDoc);
//
nsCOMPtr<nsIDOMElement> domElement;
domDoc->CreateElement(NS_LITERAL_STRING("b"), getter_AddRefs(domElement));
nsCOMPtr<nsIDOMText> domText;
domDoc->CreateTextNode(NS_LITERAL_STRING("insert me"), getter_AddRefs(domText));
//
nsCOMPtr<nsIDOMWindow> domWindow;
mWebBrowser->GetContentDOMWindow(getter_AddRefs(domWindow));
nsCOMPtr<nsISelection> selection;
domWindow->GetSelection(getter_AddRefs(selection));
//
nsCOMPtr<nsIDOMRange> domRange;
PRInt32 c;
selection->GetRangeCount(&c);
selection->GetRangeAt(0, getter_AddRefs(domRange));
//
domRange->InsertNode(domElement);
nsCOMPtr<nsIDOMNode> dummyNode;
domElement->AppendChild(domText, getter_AddRefs(dummyNode));
Actual Results:  
InsertNode calls nsGenericDOMDataNode::SplitText that fails on
nsGenericDOMDataNode::CloneContent.
Attached patch wrong fileSplinter Review
Attachment #161141 - Flags: review?(bzbarsky)
That patch has been on the trunk since September 16.  See revision 3.90 of
nsGenericDOMDataNode.h.
Status: NEW → RESOLVED
Closed: 20 years ago
Resolution: --- → FIXED
Comment on attachment 161141 [details] [diff] [review]
wrong file

For future reference, you would need to fix the whitespace so the lines line up
right too...
Attachment #161141 - Flags: review?(bzbarsky) → review-
Component: DOM: Traversal-Range → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: