This repository has been archived by the owner on Jun 16, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Store MutationObserver callback in a hidden property for V8
https://bugs.webkit.org/show_bug.cgi?id=102555 Patch by Elliott Sprehn <esprehn@chromium.org> on 2012-11-20 Reviewed by Adam Barth. .: Test for reference cycle leaks with mutation observers. There doesn't seem to be a way to check this for v8, but if you manually run you can see if it leaks observers. * ManualTests/leak-cycle-observer-wrapper.html: Added. Source/WebCore: To prevent circular reference leaks we should store the MutationObserver callback in a hidden property on the wrapper of the observer. This is done by extending the code generator to support a new owner argument to ::create() that lets you set the owner of the callback where the hidden property should be stored. Test: ManualTests/leak-cycle-observer-wrapper.html * bindings/scripts/CodeGeneratorV8.pm: (GenerateCallbackHeader): (GenerateCallbackImplementation): * bindings/scripts/test/V8/V8TestCallback.cpp: rebaselined. * bindings/scripts/test/V8/V8TestCallback.h: rebaselined. * bindings/v8/V8HiddenPropertyName.h: * bindings/v8/custom/V8MutationObserverCustom.cpp: (WebCore::V8MutationObserver::constructorCallback): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@135305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
commit-queue@webkit.org
committed
Nov 20, 2012
1 parent
7cb9d15
commit f61a46a
Showing
8 changed files
with
95 additions
and
12 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
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,18 @@ | ||
<!DOCTYPE html> | ||
|
||
<p> | ||
Tests that reference cycles between the observer and the callback do not | ||
create leaks. | ||
</p> | ||
|
||
<script> | ||
if (window.testRunner) | ||
testRunner.dumpAsText(); | ||
|
||
function leak() { | ||
var observer = new WebKitMutationObserver(function() { observer.disconnect(); }); | ||
} | ||
|
||
for (i=0; i < 1000; i++) leak(); | ||
gc(); | ||
</script> |
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
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