Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Side by Side Diff: test/mjsunit/es6/debug-liveedit-new-target-1.js

Issue 2503293002: [debug-wrapper] LiveEdit, frame.restart(), breakpoints (Closed)
Patch Set: Address comments Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/debug-liveedit-utils.js ('k') | test/mjsunit/es6/debug-liveedit-new-target-2.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --expose-debug-as debug --allow-natives-syntax
6
7 // Test that live-editing a frame that uses new.target fails.
8
9 Debug = debug.Debug
10 var calls = 0;
11 var exceptions = 0;
12 var results = [];
13 var replace_again;
14
15 eval(`
16 function LogNewTarget() {
17 calls++;
18 ReplaceOnce();
19 results.push(true);
20 results.push(new.target);
21 }
22 `);
23
24 function Dummy() {}
25
26 function Replace(fun, original, patch) {
27 %ExecuteInDebugContext(function() {
28 var change_log = [];
29 try {
30 var script = Debug.findScript(fun);
31 var patch_pos = script.source.indexOf(original);
32 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(
33 script, patch_pos, original.length, patch, change_log);
34 } catch (e) {
35 assertEquals("BLOCKED_NO_NEW_TARGET_ON_RESTART",
36 change_log[0].functions_on_stack[0].replace_problem);
37 assertInstanceof(e, Debug.LiveEdit.Failure);
38 exceptions++;
39 }
40 });
41 }
42
43 function ReplaceOnce() {
44 if (replace_again) {
45 replace_again = false;
46 Replace(LogNewTarget, "true", "false");
47 }
48 }
49
50 function Revert() {
51 Replace(LogNewTarget, "false", "true");
52 }
53
54 replace_again = true;
55 ReplaceOnce();
56 new LogNewTarget();
57 Revert();
58 assertEquals(1, calls);
59 assertEquals(0, exceptions);
60 assertEquals([false, LogNewTarget], results);
61
62 replace_again = true;
63 LogNewTarget();
64
65 replace_again = true;
66 new LogNewTarget();
67
68 replace_again = true;
69 Reflect.construct(LogNewTarget, [], Dummy);
70
71 assertEquals(
72 [false, LogNewTarget, true, undefined, true, LogNewTarget, true, Dummy],
73 results);
74 assertEquals(4, calls); // No restarts
75 assertEquals(3, exceptions); // Replace failed.
OLDNEW
« no previous file with comments | « test/mjsunit/debug-liveedit-utils.js ('k') | test/mjsunit/es6/debug-liveedit-new-target-2.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698