mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 19:26:42 +08:00
Updated weak event listener tests for v8 6.5 (#5697)
* Updated weak event listener tests for v8 6.5 * added missing parentheses
This commit is contained in:
@ -101,7 +101,11 @@ export function test_listenerDoesNotRetainTarget(done) {
|
|||||||
const sourceRef = getSourceAsWeakRef();
|
const sourceRef = getSourceAsWeakRef();
|
||||||
const targetRef = getTargetAsWeakRef();
|
const targetRef = getTargetAsWeakRef();
|
||||||
|
|
||||||
|
// with the v8 6.5 the GC does not release WeakRefs so fast if you pass them to a method
|
||||||
|
// that's why we are making the call to the addWeakEventListener in a closure so that the WeakRef will be easier released
|
||||||
|
(function() {
|
||||||
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, emptyHandler, targetRef.get());
|
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, emptyHandler, targetRef.get());
|
||||||
|
})();
|
||||||
forceGC();
|
forceGC();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -117,7 +121,11 @@ export function test_listenerDoesNotRetainSource(done) {
|
|||||||
const sourceRef = getSourceAsWeakRef();
|
const sourceRef = getSourceAsWeakRef();
|
||||||
const targetRef = getTargetAsWeakRef();
|
const targetRef = getTargetAsWeakRef();
|
||||||
|
|
||||||
|
// with the v8 6.5 the GC does not release WeakRefs so fast if you pass them to a method
|
||||||
|
// that's why we are making the call to the addWeakEventListener in a closure so that the WeakRef will be easier released
|
||||||
|
(function() {
|
||||||
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, targetRef.get().onEvent, targetRef.get());
|
addWeakEventListener(sourceRef.get(), Observable.propertyChangeEvent, targetRef.get().onEvent, targetRef.get());
|
||||||
|
})();
|
||||||
forceGC();
|
forceGC();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Reference in New Issue
Block a user