-
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.
CachedString::m_jsString is not protected from GC in CloneDeserializer.
https://bugs.webkit.org/show_bug.cgi?id=267971 rdar://120531481 Reviewed by Chris Dumez. The fix is simply to protect it with the m_keepAliveBuffer. Also moved the m_keepAliveBuffer from CloneSerializer to CloneBase. Previously, I thought that only the serializer needs it. Now, we have a case where the deserializer does too. * LayoutTests/js/structuredClone/structured-clone-of-CachedString-in-map-expected.txt: Added. * LayoutTests/js/structuredClone/structured-clone-of-CachedString-in-map.html: Added. * Source/WebCore/bindings/js/SerializedScriptValue.cpp: (WebCore::CloneDeserializer::CachedString::jsString): (WebCore::CloneDeserializer::readTerminal): Originally-landed-as: 272448.347@safari-7618-branch (5546b2e). rdar://124555235 Canonical link: https://commits.webkit.org/276167@main
- Loading branch information
1 parent
1e46cd5
commit 442482a
Showing
3 changed files
with
49 additions
and
6 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
LayoutTests/js/structuredClone/structured-clone-of-CachedString-in-map-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,2 @@ | ||
CONSOLE MESSAGE: PASS | ||
|
38 changes: 38 additions & 0 deletions
38
LayoutTests/js/structuredClone/structured-clone-of-CachedString-in-map.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 @@ | ||
<body> | ||
<script> | ||
|
||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
function main() { | ||
const string = 'Expected result'; | ||
|
||
const map = new Map(); | ||
map.set('free', string); | ||
|
||
map.set('tmp', { | ||
get a() { | ||
map.delete('free'); | ||
map.set('free', 0x1234); | ||
|
||
for (let i = 0; i < 0x10; i++) | ||
map.set('gc1_' + i, new ArrayBuffer(1024 * 1024 * 0x10)); | ||
|
||
for (let i = 0; i < 0x2000; i++) | ||
map.set('gc2_' + i, new Date()); | ||
|
||
map.set('expected', string); | ||
} | ||
}); | ||
|
||
const result = structuredClone(map); | ||
|
||
if (result.get('expected') != "Expected result") | ||
console.log("FAIL"); | ||
else | ||
console.log("PASS"); | ||
} | ||
|
||
main(); | ||
</script> | ||
</body> |
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