Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ValidityState object should be the same on each access (JS object get…
…ting GC'd incorrectly) https://bugs.webkit.org/show_bug.cgi?id=33733 Reviewed by Darin Adler. Fixed the bug by making the form associated element an opaque root of ValidityState. * LayoutTests/fast/forms/ValidityState-gc-expected.txt: Added. * LayoutTests/fast/forms/ValidityState-gc.html: Added. * Source/WebCore/html/HTMLFormControlElement.h: * Source/WebCore/html/HTMLObjectElement.h: * Source/WebCore/html/ValidityState.h: (WebCore::ValidityState::element): (WebCore::ValidityState::opaqueRootConcurrently): * Source/WebCore/html/ValidityState.idl: Canonical link: https://commits.webkit.org/251480@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@295475 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
This tests that ValidityState survives garbage collection. | ||
|
||
<button></button>: PASS | ||
<fieldset></fieldset>: PASS | ||
<input type="text">: PASS | ||
<input type="radio">: PASS | ||
<input type="checkbox">: PASS | ||
<object></object>: PASS | ||
<output></output>: PASS | ||
<select></select>: PASS | ||
<textarea></textarea>: PASS | ||
|
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,52 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<body> | ||
<p>This tests that ValidityState survives garbage collection.</p> | ||
<div id="test-cases"> | ||
<button></button> | ||
<fieldset></fieldset> | ||
<input type="text"> | ||
<input type="radio"> | ||
<input type="checkbox"> | ||
<object></object> | ||
<output></output> | ||
<select></select> | ||
<textarea></textarea> | ||
</div> | ||
<pre id="result"></pre> | ||
<script> | ||
function gc() | ||
{ | ||
if (window.GCController) | ||
return GCController.collect(); | ||
|
||
for (var i = 0; i < 1000000; i++) // > force garbage collection (FF requires about 9K allocations before a collect) | ||
var s = new String(''); | ||
} | ||
|
||
const testCases = Array.from(document.getElementById('test-cases').children); | ||
for (const child of testCases) | ||
child.validity.foo = 'PASS'; | ||
|
||
gc(); | ||
|
||
if (window.testRunner) { | ||
testRunner.waitUntilDone(); | ||
testRunner.dumpAsText(); | ||
} | ||
|
||
setTimeout(function () { | ||
gc(); | ||
setTimeout(function () { | ||
gc(); | ||
for (const child of testCases) | ||
result.textContent += `${child.outerHTML}: ${child.validity.foo || 'FAIL'}\n`; | ||
document.getElementById('test-cases').style.display = 'none'; | ||
if (window.testRunner) | ||
testRunner.notifyDone(); | ||
}, 0); | ||
}, 0); | ||
|
||
</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
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