| Index: third_party/WebKit/LayoutTests/netinfo/gc-unused-listeners.html
|
| diff --git a/third_party/WebKit/LayoutTests/netinfo/gc-unused-listeners.html b/third_party/WebKit/LayoutTests/netinfo/gc-unused-listeners.html
|
| index da73c390937e66afc74a345e28ae58c4fa336f76..e5cda4e75837597004c0c8abd73918e8b30d993c 100644
|
| --- a/third_party/WebKit/LayoutTests/netinfo/gc-unused-listeners.html
|
| +++ b/third_party/WebKit/LayoutTests/netinfo/gc-unused-listeners.html
|
| @@ -16,17 +16,23 @@ var callback = function(e) {
|
| };
|
|
|
| // Add a listener.
|
| -// Do not pass the object directly to observeGC function. This may
|
| +var callbackObserver;
|
| +// Do not pass the object directly to observeGC function. It may
|
| // remain live on this function's stack preventing GC from collecting
|
| // it. Accessing the object inside an inner function will prevent any
|
| -// unneeded references on this function's stack.
|
| -var callbackObserver = internals.observeGC((() => {return callback;})());
|
| -connection.addEventListener('typechange', callback);
|
| +// unneeded references on this function's stack. (http://crbug.com/595672/)
|
| +(function() {
|
| + callbackObserver = internals.observeGC(callback);
|
| + connection.addEventListener('typechange', callback);
|
| +})();
|
| +
|
| gc();
|
| shouldBeFalse('callbackObserver.wasCollected');
|
|
|
| // Remove the listener and its callback reference.
|
| -connection.removeEventListener('typechange', callback);
|
| +// Access objects in an inner function to avoid references to objects
|
| +// remaining live on this function's stack frame (http://crbug.com/595672/).
|
| +(() => {connection.removeEventListener('typechange', callback);})();
|
| callback = null;
|
| gc();
|
| shouldBeTrue('callbackObserver.wasCollected');
|
|
|