| OLD | NEW |
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 print("Tests that Runtime.evaluate will generate correct previews."); | 5 print("Tests that Runtime.evaluate will generate correct previews."); |
| 6 | 6 |
| 7 InspectorTest.addScript( | 7 InspectorTest.addScript( |
| 8 ` | 8 ` |
| 9 var sym = Symbol(123); |
| 10 |
| 9 Object.prototype[0] = 'default-first'; | 11 Object.prototype[0] = 'default-first'; |
| 10 var obj = {p1: {a:1}, p2: {b:'foo'}}; | 12 var obj = {p1: {a:1}, p2: {b:'foo'}, p3: sym}; |
| 11 Object.defineProperties(obj, { | 13 Object.defineProperties(obj, { |
| 12 p3: { | 14 p4: { |
| 13 get() { return 2 } | 15 get() { return 2 } |
| 14 }, | 16 }, |
| 15 p4: { | 17 p5: { |
| 16 set(x) { return x } | 18 set(x) { return x } |
| 17 }, | 19 }, |
| 18 p5: { | 20 p6: { |
| 19 get() { return 2 }, | 21 get() { return 2 }, |
| 20 set(x) { return x } | 22 set(x) { return x } |
| 21 } | 23 } |
| 22 }); | 24 }); |
| 25 obj[sym] = 'baz'; |
| 23 | 26 |
| 24 Array.prototype[0] = 'default-first'; | 27 Array.prototype[0] = 'default-first'; |
| 25 var arr = [,, 1, [2]]; | 28 var arr = [,, 1, [2], sym]; |
| 26 Object.defineProperties(arr, { | 29 Object.defineProperties(arr, { |
| 27 4: { | 30 5: { |
| 28 get() { return 2 } | 31 get() { return 2 } |
| 29 }, | 32 }, |
| 30 5: { | 33 6: { |
| 31 set(x) { return x } | 34 set(x) { return x } |
| 32 }, | 35 }, |
| 33 6: { | 36 7: { |
| 34 get() { return 2 }, | 37 get() { return 2 }, |
| 35 set(x) { return x } | 38 set(x) { return x } |
| 36 } | 39 } |
| 37 }); | 40 }); |
| 41 arr[sym] = 'baz'; |
| 38 `); | 42 `); |
| 39 | 43 |
| 40 InspectorTest.runTestSuite([ | 44 InspectorTest.runTestSuite([ |
| 41 function testObjectPropertiesPreview(next) | 45 function testObjectPropertiesPreview(next) |
| 42 { | 46 { |
| 43 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) | 47 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) |
| 44 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 48 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 45 .then(next); | 49 .then(next); |
| 46 }, | 50 }, |
| 47 | 51 |
| 48 function testArrayPropertiesPreview(next) | 52 function testArrayPropertiesPreview(next) |
| 49 { | 53 { |
| 50 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) | 54 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) |
| 51 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 55 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 52 .then(next); | 56 .then(next); |
| 53 } | 57 } |
| 54 ]); | 58 ]); |
| OLD | NEW |