Closed Bug 454904 Opened 16 years ago Closed 8 years ago

Error: uncaught exception in nsISelection.toString when root node is selected and toString() method is used

Categories

(Core :: DOM: Selection, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: martijn.martijn, Unassigned)

References

Details

(Keywords: regression, testcase)

Attachments

(1 file)

Attached file testcase
See testcase, I get this error in the error console with it:
Error: uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsISelection.toString]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "JS frame :: file:///C:/Documents%20and%20Settings/mw/Bureaublad/selectioncopy.htm :: doe :: line 16"  data: no]

I'm getting this same error when trying to copy with the "Copy" item in the context menu.
Hmm, appears to be a regression, the alert just shows up fine in a 1.8 branch build of mine.
A regression range might be useful.
Keywords: regression
When I use "Copy" from the main menu, I see these warnings and errors in my debug build:
 data: no]
WARNING: NS_ENSURE_TRUE(content) failed: file c:/mozilla-build-1.3/mozilla-centr
al/content/base/src/nsDocumentEncoder.cpp, line 666
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file c:/mozill
a-build-1.3/mozilla-central/content/base/src/nsDocumentEncoder.cpp, line 887
WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005: file c:/mozill
a-build-1.3/mozilla-central/content/base/src/nsDocumentEncoder.cpp, line 953
An error occurred executing the cmd_copy command
[Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [n
sIController.doCommand]"  nsresult: "0x80004005 (NS_ERROR_FAILURE)"  location: "
JS frame :: chrome://global/content/globalOverlay.js :: goDoCommand :: line 86"
 data: no]
The stack trace (for the STR in comment 0) is:
#0  nsDocumentEncoder::SerializeRangeNodes (this=0x18503e10, aRange=0x184995bc, aNode=0x1dd97e8c, aString=@0xbfffb924, aDepth=0) at /Users/uri/mozilla/central/mozilla/content/base/src/nsDocumentEncoder.cpp:666
#1  0x1169410f in nsDocumentEncoder::SerializeRangeToString (this=0x18503e10, aRange=0x184995bc, aOutputString=@0xbfffb924) at /Users/uri/mozilla/central/mozilla/content/base/src/nsDocumentEncoder.cpp:886
#2  0x11694a15 in nsDocumentEncoder::EncodeToString (this=0x18503e10, aOutputString=@0xbfffb924) at /Users/uri/mozilla/central/mozilla/content/base/src/nsDocumentEncoder.cpp:952
#3  0x114b0ee0 in nsTypedSelection::ToStringWithFormat (this=0x1c1a3460, aFormatType=0x11c89230 "text/plain", aFlags=1, aWrapCol=0, aReturn=0xbfffbd04) at /Users/uri/mozilla/central/mozilla/layout/generic/nsSelection.cpp:1503
#4  0x114a629c in nsTypedSelection::ToString (this=0x1c1a3460, aReturn=0xbfffbd04) at /Users/uri/mozilla/central/mozilla/layout/generic/nsSelection.cpp:1461
#5  0x004ed6fd in NS_InvokeByIndex_P (that=0x1c1a3460, methodIndex=21, paramCount=1, params=0xbfffbd04) at /Users/uri/mozilla/central/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_unixish_x86.cpp:179
(More stack frames follow...)

The problem is that the node passed to SerializeRangeNodes() is a nsHTMLDocument, which cannot be QI'ed into a nsIContent.
Regression range is 2006-10-20 to 2006-10-21, so probably bug 357445.
Blocks: 357445
User Agent 	Mozilla/5.0 (Windows NT 5.1; rv:49.0) Gecko/20100101 Firefox/49.0
Build ID 	20160516030211

Works for me on latest release and latest Nightly (49.0a1) so I will close the bug. If anyone can still reproduce the error, feel free to reopen it.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: