Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge r222220 - createMarkupInternal should protect its pointer to th…
…e Range's common ancestor https://bugs.webkit.org/show_bug.cgi?id=177033 <rdar://problem/34265390> Reviewed by Tim Horton. Source/WebCore: Adds basic safeguarding to codepaths hit while executing an outdent command. Test: editing/execCommand/outdent-with-media-query-listener-in-iframe.html * editing/IndentOutdentCommand.cpp: (WebCore::IndentOutdentCommand::outdentRegion): Avoid an infinite loop if endOfCurrentParagraph is a null position. * editing/markup.cpp: (WebCore::createMarkupInternal): Protect the raw pointer to the Range's common ancestor node. LayoutTests: Adds a test that removes the common ancestor node of a range in the middle of executing an outdent. * editing/execCommand/outdent-with-media-query-listener-in-iframe-expected.txt: Added. * editing/execCommand/outdent-with-media-query-listener-in-iframe.html: Added.
- Loading branch information
1 parent
7104353
commit 5f520ae
Showing
6 changed files
with
93 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
LayoutTests/editing/execCommand/outdent-with-media-query-listener-in-iframe-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
PASS |
49 changes: 49 additions & 0 deletions
49
LayoutTests/editing/execCommand/outdent-with-media-query-listener-in-iframe.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<blockquote> | ||
<div> | ||
<span id="span"> | ||
<i id="i1">a</i> | ||
<i id="i2">b</i> | ||
</span> | ||
</div> | ||
<div>1</div> | ||
</blockquote> | ||
</body> | ||
|
||
<script> | ||
let layoutCount = 0; | ||
|
||
function forceGarbageCollection() { | ||
for (let i = 0; i < 100; i++) | ||
new ArrayBuffer(0x100000); | ||
} | ||
|
||
function listener() { | ||
if (layoutCount === 53) | ||
document.body.insertAdjacentHTML("beforeend", "<input autofocus>"); | ||
|
||
if (layoutCount === 54) { | ||
span.remove(); | ||
forceGarbageCollection(); | ||
return; | ||
} | ||
|
||
frame.contentWindow.matchMedia(`(max-width: ${layoutCount + 1}px)`).addListener(listener); | ||
frame.width = layoutCount++; | ||
} | ||
|
||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
document.designMode = "on"; | ||
document.execCommand("SelectAll"); | ||
|
||
let frame = document.body.appendChild(document.createElement("iframe")); | ||
frame.contentWindow.matchMedia("(max-width: 100px)").addListener(listener); | ||
|
||
document.execCommand("Outdent"); | ||
document.body.innerHTML = "<code style='color: green'>PASS</code>"; | ||
</script> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters