Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 252432.1019@safari-7614-branch (1988807). rdar://103307563
[Clipboard] Explicitly call completion on clearing ClipboardItemTypeLoader rdar://103307563 Reviewed by Jonathan Bedard and Wenson Hsieh. In m_itemTypeLoaders.clear(), ClipboardItemBindingsDataSource::invokeCompletionHandler() is called after all m_itemTypeLoaders released and traverses the itemTypeLoaders after itemTypeLoaders is clear but before the size is updated, causing nullptr accessment. So we should explicitly call completion before itemTypeLoader is released. * LayoutTests/editing/async-clipboard/clipboard-clear-expected.txt: Added. * LayoutTests/editing/async-clipboard/clipboard-clear.html: Added. * Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp: (WebCore::ClipboardItemBindingsDataSource::clearItemTypeLoaders): (WebCore::ClipboardItemBindingsDataSource::collectDataForWriting): (WebCore::ClipboardItemBindingsDataSource::ClipboardItemTypeLoader::~ClipboardItemTypeLoader): * Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.h: Canonical link: https://commits.webkit.org/252432.1019@safari-7614-branch
- Loading branch information
1 parent
6f56628
commit 1cf2bfc
Showing
4 changed files
with
42 additions
and
4 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
LayoutTests/editing/async-clipboard/clipboard-clear-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 if no crash. |
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,27 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script> | ||
function runTest() { | ||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
window.testRunner.dumpAsText(); | ||
} | ||
|
||
var clipboard = window.clientInformation.clipboard; | ||
var textBlob = new Blob([ (new TextEncoder()).encode("a") ], { type : "text/plain" }); | ||
if (typeof ClipBoardItem !== "undefined") { | ||
var cbi = new ClipboardItem({ "text/plain" : textBlob }); | ||
clipboard.write([cbi]); | ||
clipboard.write([cbi]); | ||
} | ||
|
||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
} | ||
</script> | ||
</head> | ||
<body onload=runTest()> | ||
<p>PASS if no crash.</p> | ||
</body> | ||
</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