Reset the editing state when the document is removed from the docshell. b=446483 r+sr=peterv

This commit is contained in:
Mats Palmgren 2009-02-21 03:51:48 +01:00
parent f40f49c8a5
commit 44d057623f
5 changed files with 65 additions and 0 deletions

View File

@ -4154,3 +4154,10 @@ nsHTMLDocument::IsEditingOnAfterFlush()
return IsEditingOn();
}
void
nsHTMLDocument::RemovedFromDocShell()
{
mEditingState = eOff;
nsDocument::RemovedFromDocShell();
}

View File

@ -235,6 +235,8 @@ public:
virtual nsresult Clone(nsINodeInfo *aNodeInfo, nsINode **aResult) const;
virtual NS_HIDDEN_(void) RemovedFromDocShell();
protected:
nsresult GetBodySize(PRInt32* aWidth,
PRInt32* aHeight);

View File

@ -81,6 +81,8 @@ _TEST_FILES = test_bug1682.html \
bug445004-outer-abs.html \
bug445004-outer-write.html \
bug445004-inner.html \
test_bug446483.html \
bug446483-iframe.html \
test_bug448564.html \
bug448564-iframe-1.html \
bug448564-iframe-2.html \

View File

@ -0,0 +1,10 @@
<script>
function doe(){
window.focus();
window.getSelection().collapse(document.body, 0);
}
setTimeout(doe,50);
setTimeout(function() {window.location.reload()}, 200);
</script>
<span contenteditable="true"></span>

View File

@ -0,0 +1,44 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=446483
-->
<head>
<title>Test for Bug 446483</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.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=446483">Mozilla Bug 446483</a>
<p id="display">
<iframe src="bug446483-iframe.html"></iframe>
<iframe src="bug446483-iframe.html"></iframe>
</p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript">
/** Test for Bug 446483 **/
function gc() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.garbageCollect();
}
function runTest() {
setInterval(gc, 1000);
setTimeout(function(){document.getElementById('display').innerHTML='';ok(true,''); SimpleTest.finish();}, 4000);
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(runTest);
</script>
</pre>
</body>
</html>