diff options
author | Ujjwal Sharma <usharma1998@gmail.com> | 2019-03-15 18:35:06 +0530 |
---|---|---|
committer | Refael Ackermann <refack@gmail.com> | 2019-03-28 16:36:18 -0400 |
commit | f579e1194046c50f2e6bb54348d48c8e7d1a53cf (patch) | |
tree | 9125787c758358365f74f9fd9673c14f57e67870 /deps/v8/test/inspector/runtime/release-object.js | |
parent | 2c73868b0471fbd4038f500d076df056cbf697fe (diff) | |
download | android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.gz android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.bz2 android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.zip |
deps: update V8 to 7.4.288.13
PR-URL: https://github.com/nodejs/node/pull/26685
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector/runtime/release-object.js')
-rw-r--r-- | deps/v8/test/inspector/runtime/release-object.js | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/deps/v8/test/inspector/runtime/release-object.js b/deps/v8/test/inspector/runtime/release-object.js new file mode 100644 index 0000000000..ae388ff9c4 --- /dev/null +++ b/deps/v8/test/inspector/runtime/release-object.js @@ -0,0 +1,79 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const {Protocol} = InspectorTest.start( + `Tests that Runtime can properly release objects and object groups.`); + +(async function test(){ + await Protocol.Runtime.enable(); + InspectorTest.runAsyncTestSuite([ + async function testReleaseObject() { + await logAndEvaluate('var a = {x:3};'); + await logAndEvaluate('var b = {x:4};'); + const ids = []; + let result = await Protocol.Runtime.evaluate({ expression: 'a' }); + const id1 = result.result.result.objectId; + ids.push({id: id1, name: 'a'}); + result = await Protocol.Runtime.evaluate({ expression: 'b' }); + const id2 = result.result.result.objectId; + ids.push({id: id2, name: 'b'}); + + // Call Function on both objects and log: + await objectGroupHelper(ids); + InspectorTest.log('Release "a"'); + Protocol.Runtime.releaseObject({ objectId: id1 }); + await objectGroupHelper(ids); + InspectorTest.log('Release "b"'); + Protocol.Runtime.releaseObject({ objectId: id2 }); + await objectGroupHelper(ids); + }, + async function testReleaseObjectInvalid() { + const releaseObjectResult = await Protocol.Runtime.releaseObject({}); + InspectorTest.log('ReleaseObject with invalid params.'); + InspectorTest.logMessage(releaseObjectResult); + }, + async function testObjectGroups() { + await logAndEvaluate('var a = {x:3};'); + await logAndEvaluate('var b = {x:4};'); + const ids = []; + InspectorTest.log('Evaluate "a" in objectGroup "x"'); + let result = await Protocol.Runtime.evaluate({ expression: 'a', objectGroup: 'x' }); + const id1 = result.result.result.objectId; + ids.push({id: id1, name: 'a'}); + InspectorTest.log('Evaluate "b" in objectGroup "y"'); + result = await Protocol.Runtime.evaluate({ expression: 'b', objectGroup: 'y' }); + const id2 = result.result.result.objectId; + ids.push({id: id2, name: 'b'}); + + // Call Function on both objects and log: + await objectGroupHelper(ids); + InspectorTest.log('Release objectGroup "x"'); + Protocol.Runtime.releaseObjectGroup({ objectGroup: 'x' }); + await objectGroupHelper(ids); + InspectorTest.log('Release objectGroup "y"'); + Protocol.Runtime.releaseObjectGroup({ objectGroup: 'y' }); + await objectGroupHelper(ids); + }, + async function testReleaseObjectGroupInvalid() { + const releaseObjectGroupResult = await Protocol.Runtime.releaseObjectGroup({}); + InspectorTest.log('ReleaseObjectGroup with invalid params'); + InspectorTest.logMessage(releaseObjectGroupResult); + } + ]); + + // Helper to log and evaluate an expression + async function logAndEvaluate(expression) { + InspectorTest.logMessage(`Evaluating '${expression}'`); + await Protocol.Runtime.evaluate({ expression }); + } + + // Helper function that calls a function on all objects with ids in objectIds, then returns + async function objectGroupHelper(objectIds) { + for (const {id , name } of objectIds) { + InspectorTest.log(`Evaluate 'this' for object ${name}`); + const result = await Protocol.Runtime.callFunctionOn({ objectId: id, functionDeclaration: 'function(){ return this;}' }); + InspectorTest.logMessage(result); + } + } +})(); |