diff options
author | Michaël Zasso <targos@protonmail.com> | 2018-12-04 08:20:37 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2018-12-06 15:23:33 +0100 |
commit | 9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3 (patch) | |
tree | 2b0c843168dafb939d8df8a15b2aa72b76dee51d /deps/v8/test/inspector/runtime/stable-object-id.js | |
parent | b8fbe69db1292307adb2c2b2e0d5ef48c4ab2faf (diff) | |
download | android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.gz android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.tar.bz2 android-node-v8-9b4bf7de6c9a7c25f116c7a502384c20b5cfaea3.zip |
deps: update V8 to 7.1.302.28
PR-URL: https://github.com/nodejs/node/pull/23423
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/v8/test/inspector/runtime/stable-object-id.js')
-rw-r--r-- | deps/v8/test/inspector/runtime/stable-object-id.js | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/deps/v8/test/inspector/runtime/stable-object-id.js b/deps/v8/test/inspector/runtime/stable-object-id.js new file mode 100644 index 0000000000..944bae0d3a --- /dev/null +++ b/deps/v8/test/inspector/runtime/stable-object-id.js @@ -0,0 +1,87 @@ +// Copyright 2018 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. + +let {session, contextGroup, Protocol} = InspectorTest.start( + 'Checks that protocol returns the same RemoteObjectId for the same object'); + +InspectorTest.runAsyncTestSuite([ + async function testGlobal() { + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare global evaluated twice: ${firstStableId === secondStableId}`); + }, + + async function testObject() { + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a = {}, this.a'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare object evaluated twice: ${firstStableId === secondStableId}`); + }, + + async function testObjectInArray() { + await Protocol.Runtime.evaluate({expression: 'this.b = [this.a, this.a]'}); + const {result:{result:{objectId:firstId}}} = + await Protocol.Runtime.evaluate({expression: 'this.b[0]'}); + const firstStableId = await stableObjectId(firstId); + const {result:{result:{objectId:secondId}}} = + await Protocol.Runtime.evaluate({expression: 'this.b[1]'}); + const secondStableId = await stableObjectId(secondId); + InspectorTest.log( + `Compare first and second element: ${firstStableId === secondStableId}`); + }, + + async function testObjectOnPause() { + const {result:{result:{objectId:globalId}}} = + await Protocol.Runtime.evaluate({expression: 'this'}); + const globalStableId = await stableObjectId(globalId); + const {result:{result:{objectId:aId}}} = + await Protocol.Runtime.evaluate({expression: 'this.a'}); + const aStableId = await stableObjectId(aId); + await Protocol.Debugger.enable(); + Protocol.Runtime.evaluate({expression: 'debugger'}); + const {params:{callFrames:[topFrame]}} = + await Protocol.Debugger.oncePaused(); + const topFrameThisStableId = await stableObjectId(topFrame.this.objectId); + InspectorTest.log( + `Compare global and this: ${globalStableId === topFrameThisStableId}`); + + const {result:{result:{objectId:globalIdOnPause}}} = + await Protocol.Debugger.evaluateOnCallFrame({ + callFrameId: topFrame.callFrameId, + expression: 'this' + }); + const globalStableIdOnPause = await stableObjectId(globalIdOnPause); + InspectorTest.log( + `Compare global and global on pause: ${ + globalStableId === globalStableIdOnPause}`); + + const {result:{result: props}} = await Protocol.Runtime.getProperties({ + objectId: topFrame.scopeChain[0].object.objectId + }); + const {value:{objectId: aIdOnPause}} = props.find(prop => prop.name === 'a'); + const aStableIdOnPause = await stableObjectId(aIdOnPause); + InspectorTest.log(`Compare a and a on pause: ${ + aStableId === aStableIdOnPause}`); + } +]); + +async function stableObjectId(objectId) { + const {result:{ + internalProperties: props + }} = await Protocol.Runtime.getProperties({ + objectId, + ownProperties: true, + generatePreview: false + }); + return props.find(prop => prop.name === '[[StableObjectId]]').value.value; +} |