It seems to be impossible to select the root element (i.e. the whole document barring prolog & epilog). As far as I understand all the ways of doing selection require you to get the parent content of the content you would like to select. The root content does not have parent content. Also, we actually get a crash in nsContentSubtreeIterator::Init(), which is called when you do: range->SelectNode(rootNode); selection->AddRange(range); The crash happens because the code QIs a DOM node into nsIContent but does not check the result of this QI. It is null if the DOM node is the document, because the document does not implement nsIContent. This is blocking bug 56858.
18 years ago
Summary: Impossible to select document root element → Impossible to select document root element, crash if you try
18 years ago
setting to moz0.9 and reassign to anthonyd
Assignee: mjudge → anthonyd
Target Milestone: --- → mozilla0.9
accepting bug, would like to have a test case, i will make one and hope it correctly repros bug. anthonyd
Status: NEW → ASSIGNED
i think i have a fix for this. but could the reporter (heikki) please post a test case? thanks, anthonyd
Hmm... I swear I posted a testcase... Seems like it didn't end up here. Anyway, here is a test procedure you can try: 1. Apply my 2nd patch in bug 56858 and set the boolean pref layout.selectanchor to true. 2. Open http://bugzilla.mozilla.org/showattachment.cgi?attach_id=19084 and try the links. It should select the target contents of the link. Also the last link ("root link") should work and select the complete document without crashing. If you'd attach your fix here I could also try it out.
i applied your new patch, but the test case doesnt appear to do anything. need some info anthonyd
Did you add the following line to your all.js file? pref("layout.selectanchor",true);
heikki, ok, sorry. i missed putting that pref in. the test case now works, though im not seeing a crash.
ok, changing status summary, this bug is supposed to be (im guessing here) to fix selection of root element, NOT the crasher. anthonyd
Summary: Impossible to select document root element, crash if you try → Impossible to select document root element
fixed, ill update in a bit to add the patch. anthonyd
changing status whiteboard. got an r= from mjudge, but i need an sr= from attinasi since he owns layout, right? anthonyd
Whiteboard: FIX IN HAND, NEED REVIEW
fix checked in
Status: ASSIGNED → RESOLVED
Last Resolved: 18 years ago
Resolution: --- → FIXED
Whiteboard: FIX IN HAND, NEED REVIEW → FIX IN HAND
catching up on verifications
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.