Closed
Bug 506649
Opened 15 years ago
Closed 15 years ago
nsFocusManager::GetSelectionLocation has unreachable code block due to shadowed local variable
Categories
(Core :: DOM: Core & HTML, enhancement)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
Tracking | Status | |
---|---|---|
status1.9.2 | --- | beta1-fixed |
People
(Reporter: timeless, Assigned: timeless)
References
(Blocks 1 open bug, )
Details
(Keywords: coverity)
Attachments
(1 file)
856 bytes,
patch
|
smaug
:
review+
enndeakin
:
review+
|
Details | Diff | Splinter Review |
1846 nsFocusManager::GetSelectionLocation(nsIDocument* aDocument, 1940 nsIFrame *newCaretFrame = nsnull; 1943 do { 1947 nsIFrame* newCaretFrame = static_cast<nsIFrame*>(frameTraversal->CurrentItem()); 1951 } while (!newCaretContent || newCaretContent == startContent); 1953 if (newCaretFrame && newCaretContent) { 1954 // If the caret is exactly at the same position of the new frame, 1955 // then we can use the newCaretFrame and newCaretContent for our position 1956 nsRefPtr<nsCaret> caret; 1957 aPresShell->GetCaret(getter_AddRefs(caret)); 1958 nsRect caretRect; 1959 nsIView *caretView; 1960 caret->GetCaretCoordinates(nsCaret::eClosestViewCoordinates, 1961 domSelection, &caretRect, 1962 &isCollapsed, &caretView); 1963 nsPoint framePt; 1964 nsIView *frameClosestView = newCaretFrame->GetClosestView(&framePt); 1965 if (caretView == frameClosestView && caretRect.y == framePt.y && 1966 caretRect.x == framePt.x) { 1967 // The caret is at the start of the new element. 1968 startFrame = newCaretFrame; 1969 startContent = newCaretContent; 1970 if (endOfSelectionInStartNode) { 1971 endContent = newCaretContent; // Ensure end of selection is not before start 1972 } 1973 } 1974 } I've intentionally let the last blob collapse, it's unreachable :)
Comment 1•15 years ago
|
||
This is a regression, though, I'm not yet sure what problems this cause. When fixing this, it clearly needs also testcases.
Flags: blocking1.9.2?
i'm not in a position to write tests for this problem. this is the "obvious" patch.
Comment 3•15 years ago
|
||
Ok, this is some kind of copy-paste error. http://mxr.mozilla.org/mozilla1.9.1/source/content/events/src/nsEventStateManager.cpp?mark=5720-5720#5695
Updated•15 years ago
|
Attachment #390919 -
Flags: review+
Updated•15 years ago
|
Attachment #390919 -
Flags: review?(enndeakin)
Comment 4•15 years ago
|
||
Comment on attachment 390919 [details] [diff] [review] the obvious patch Even though this is a trivial patch, could you enn check it.
Comment 5•15 years ago
|
||
Comment on attachment 390919 [details] [diff] [review] the obvious patch Looks OK. Also, the assignment startFrame = newCaretFrame isn't needed.
Attachment #390919 -
Flags: review?(enndeakin) → review+
Updated•15 years ago
|
Assignee: nobody → timeless
http://hg.mozilla.org/mozilla-central/rev/1b368a826f91
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Flags: wanted1.9.2+
Flags: blocking1.9.2?
Flags: blocking1.9.2-
Updated•15 years ago
|
status1.9.2:
--- → beta1-fixed
Updated•6 years ago
|
Blocks: coverity-analysis
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•