зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1453190 - Don't get editing session during destroying docshell. r=masayuki
When closing window / documnet, if content modifies an element that has contenteditable via unload event, it hits assertion in `nsDocShell::EnsureEditorData` due to destroying document. So we should return error before getting editing session. Differential Revision: https://phabricator.services.mozilla.com/D50573 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
8f69271ae4
Коммит
67ecac7a24
|
@ -5066,6 +5066,12 @@ nsresult Document::TurnEditingOff() {
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
bool isBeingDestroyed = false;
|
||||
docshell->IsBeingDestroyed(&isBeingDestroyed);
|
||||
if (isBeingDestroyed) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEditingSession> editSession;
|
||||
nsresult rv = docshell->GetEditingSession(getter_AddRefs(editSession));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
<script>
|
||||
window.onload = function () {
|
||||
document.createElement("frameset").setAttribute("onunload", "go()")
|
||||
}
|
||||
function go() {
|
||||
let a = document.getElementById("a");
|
||||
let b = document.getElementById("b");
|
||||
a.appendChild(b);
|
||||
}
|
||||
</script>
|
||||
<div id="a">
|
||||
<li id="b" contenteditable="true">
|
|
@ -1,7 +1,11 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
file_bug1453190.html
|
||||
|
||||
[test_bug348497.html]
|
||||
[test_bug384147.html]
|
||||
[test_bug389350.html]
|
||||
[test_bug519928.html]
|
||||
[test_bug738440.html]
|
||||
[test_bug1453190.html]
|
||||
skip-if = os == "android"
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1453190
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 1453190</title>
|
||||
<script 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=1453190">Mozilla Bug 1453190</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
let testWindow = window.open("file_bug1453190.html");
|
||||
testWindow.addEventListener("load", () => {
|
||||
SimpleTest.executeSoon(() => {
|
||||
runTest(testWindow);
|
||||
});
|
||||
}, {once: true});
|
||||
|
||||
function runTest(win) {
|
||||
ok(!win.closed, "test window is opened");
|
||||
win.close();
|
||||
ok(win.closed, "test window is closed");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче