зеркало из https://github.com/mozilla/gecko-dev.git
Bug 488417. Need to hold strong refs to ranges across calling RemoveRange. r+sr=roc
This commit is contained in:
Родитель
dd7d7ac671
Коммит
d631c2329b
|
@ -213,6 +213,8 @@ public:
|
|||
nsresult Collapse(nsINode* aParentNode, PRInt32 aOffset);
|
||||
nsresult Extend(nsINode* aParentNode, PRInt32 aOffset);
|
||||
nsresult AddRange(nsIRange* aRange);
|
||||
// The nsIRange version of RemoveRange assumes the caller is holding
|
||||
// a strong reference to aRange.
|
||||
nsresult RemoveRange(nsIRange* aRange);
|
||||
nsIRange* GetRangeAt(PRInt32 aIndex);
|
||||
nsresult GetTableSelectionType(nsIRange* aRange,
|
||||
|
@ -2711,7 +2713,9 @@ printf("HandleTableSelection: Unselecting mUnselectCellOnMouseUp; rangeCount=%d\
|
|||
#endif
|
||||
for( PRInt32 i = 0; i < rangeCount; i++)
|
||||
{
|
||||
nsIRange* range = mDomSelections[index]->GetRangeAt(i);
|
||||
// Strong reference, because sometimes we want to remove
|
||||
// this range, and then we might be the only owner.
|
||||
nsCOMPtr<nsIRange> range = mDomSelections[index]->GetRangeAt(i);
|
||||
if (!range) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsINode* parent = range->GetStartParent();
|
||||
|
@ -2799,7 +2803,8 @@ nsFrameSelection::SelectBlockOfCells(nsIContent *aStartCell, nsIContent *aEndCel
|
|||
if (!mDomSelections[index])
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIRange* range = GetFirstCellRange();
|
||||
// Strong reference because we sometimes remove the range
|
||||
nsCOMPtr<nsIRange> range = GetFirstCellRange();
|
||||
nsIContent* cellNode = GetFirstSelectedContent(range);
|
||||
NS_PRECONDITION(!range || cellNode, "Must have cellNode if had a range");
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ _TEST_FILES = \
|
|||
test_bug468167.html \
|
||||
test_bug469613.xul \
|
||||
test_bug470212.html \
|
||||
test_bug488417.html \
|
||||
test_movement_by_characters.html \
|
||||
test_movement_by_words.html \
|
||||
test_plugin_clipping.xhtml \
|
||||
|
|
|
@ -0,0 +1,57 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=488417
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 488417</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=488417">Mozilla Bug 488417</a>
|
||||
<div id="display">
|
||||
<table border="1">
|
||||
<tr>
|
||||
<td id="a">A1</td>
|
||||
<td id="b">B1</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>A2</td>
|
||||
<td>B2</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
function clickIt(node) {
|
||||
synthesizeMouse(node, node.getBoundingClientRect().width/2,
|
||||
node.getBoundingClientRect().height/2,
|
||||
{ accelKey: 1 });
|
||||
}
|
||||
|
||||
/** Test for Bug 488417 **/
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
// Do the test async so we can unsuppress painting
|
||||
SimpleTest.executeSoon(function() {
|
||||
clickIt($("a"));
|
||||
clickIt($("b"));
|
||||
clickIt($("a"));
|
||||
ok(1, "Got here");
|
||||
SimpleTest.finish();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче