-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 272448.253@safari-7618-branch (b417dff). https://bugs.web…
…kit.org/show_bug.cgi?id=267739 Crash in ImageEventListener::handleEvent https://bugs.webkit.org/show_bug.cgi?id=267739 rdar://118761846 Reviewed by Chris Dumez. Use WeakPtr instead of a raw reference. * LayoutTests/fast/images/image-document-event-handler-crash-expected.txt: Added. * LayoutTests/fast/images/image-document-event-handler-crash.html: Added. * Source/WebCore/html/ImageDocument.cpp: (WebCore::ImageEventListener::handleEvent): Canonical link: https://commits.webkit.org/272448.253@safari-7618-branch Canonical link: https://commits.webkit.org/274313.69@webkitglib/2.44
- Loading branch information
Showing
3 changed files
with
47 additions
and
5 deletions.
There are no files selected for viewing
3 changes: 3 additions & 0 deletions
3
LayoutTests/fast/images/image-document-event-handler-crash-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,3 @@ | ||
This test passes if WebKit does not crash in ASAN builds. | ||
|
||
PASS |
38 changes: 38 additions & 0 deletions
38
LayoutTests/fast/images/image-document-event-handler-crash.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,38 @@ | ||
<html> | ||
<body onload="main()"> | ||
<p>This test passes if WebKit does not crash in ASAN builds.</p> | ||
<div id="result"></div> | ||
<script> | ||
|
||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
function main() { | ||
const img_window = window.open(URL.createObjectURL(new Blob([new Uint8Array([0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25, 0xdb, 0x56, 0xca, 0x00, 0x00, 0x00, 0x03, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0xa7, 0x7a, 0x3d, 0xda, 0x00, 0x00, 0x00, 0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00, 0x00, 0x0a, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xe2, 0x21, 0xbc, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82])], {type: 'image/png'}))); | ||
|
||
img_window.onload = () => { | ||
const div = document.createElement('div'); | ||
div.appendChild(img_window.document.body); | ||
|
||
const img = div.querySelector('img'); | ||
img.remove(); | ||
|
||
div.firstChild.remove(); | ||
img_window.location.reload(); | ||
|
||
setTimeout(() => { | ||
if (window.GCController) | ||
GCController.collect(); | ||
img.dispatchEvent(new MouseEvent('click')); | ||
result.textContent = 'PASS'; | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
}, 10); | ||
} | ||
} | ||
|
||
</script> | ||
</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