diff --git a/content/base/src/nsRange.cpp b/content/base/src/nsRange.cpp index c5b2faa07d0f..4db9b35b4d48 100644 --- a/content/base/src/nsRange.cpp +++ b/content/base/src/nsRange.cpp @@ -2071,18 +2071,20 @@ static nsresult GetPartialTextRect(nsLayoutUtils::RectCallback* aCallback, nsIFrame* relativeTo = nsLayoutUtils::GetContainingBlockForClientRect(textFrame); for (nsTextFrame* f = textFrame; f; f = static_cast(f->GetNextContinuation())) { PRInt32 fstart = f->GetContentOffset(), fend = f->GetContentEnd(); - PRBool rtl = f->GetTextRun()->IsRightToLeft(); if (fend <= aStartOffset || fstart >= aEndOffset) continue; - //overlaping with the offset we want + // overlapping with the offset we want + f->EnsureTextRun(); + NS_ENSURE_TRUE(f->GetTextRun(), NS_ERROR_OUT_OF_MEMORY); + PRBool rtl = f->GetTextRun()->IsRightToLeft(); nsRect r(f->GetOffsetTo(relativeTo), f->GetSize()); if (fstart < aStartOffset) { - //aStartOffset is within this frame + // aStartOffset is within this frame ExtractRectFromOffset(f, relativeTo, aStartOffset, &r, rtl); } if (fend > aEndOffset) { - //aEndOffset is in the middle of this frame + // aEndOffset is in the middle of this frame ExtractRectFromOffset(f, relativeTo, aEndOffset, &r, !rtl); } aCallback->AddRect(r); diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 10edfbc9b500..ee59ba3e4c3e 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -378,7 +378,8 @@ _TEST_FILES = test_bug5141.html \ file_csp_redirects_page.sjs \ file_csp_redirects_main.html \ file_csp_redirects_resource.sjs \ - test_bug346485.html \ + test_bug346485.html \ + test_bug560780.html \ $(NULL) # This test fails on the Mac for some reason diff --git a/content/base/test/test_bug560780.html b/content/base/test/test_bug560780.html new file mode 100644 index 000000000000..05f592e457e4 --- /dev/null +++ b/content/base/test/test_bug560780.html @@ -0,0 +1,100 @@ + + + + + Test for Bug 560780 + + + + + + + + + +Mozilla Bug 560780 +

abcdefghijklmnabcdefghijklmn

+ +
+  1.Start Minefield with New Profile.
+  2.Select texts by alt + mouse dragging horizontaly from 'd' in the link above to far right of window.
+  3.Click on the selected text
+  4.Click empty area of page
+  5.Repeat STEP 2 to 4 till browser crashes. (at least 5 times)
+
+
+
+ +