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

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

Issue 1492393003: Reland of [debugger] do not restart frames that reference new.target for liveedit. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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
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 above one that uses new.target succeeds.
8
9 Debug = debug.Debug
10 var wrapper_calls = 0;
11 var construct_calls = 0;
12 var exceptions = 0;
13 var results = [];
14 var replace_again;
15
16 eval(`
17 function LogNewTarget(arg) {
18 construct_calls++;
19 results.push(new.target);
20 }
21 function Wrapper() {
22 wrapper_calls++;
23 ReplaceOnce();
24 new LogNewTarget(true);
25 }
26 `);
27
28 function Replace(fun, original, patch) {
29 %ExecuteInDebugContext(function() {
30 var change_log = [];
31 try {
32 var script = Debug.findScript(fun);
33 var patch_pos = script.source.indexOf(original);
34 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(
35 script, patch_pos, original.length, patch, change_log);
36 } catch (e) {
37 exceptions++;
38 }
39 });
40 }
41
42 function ReplaceOnce(x) {
43 if (replace_again) {
44 replace_again = false;
45 Replace(Wrapper, "true", "false");
46 }
47 }
48
49 function Revert() {
50 Replace(Wrapper, "false", "true");
51 }
52
53 replace_again = true;
54 ReplaceOnce();
55 Wrapper();
56 Revert();
57 assertEquals(1, construct_calls);
58 assertEquals(1, wrapper_calls);
59 assertEquals(0, exceptions); // Replace succeeds
60 assertEquals([LogNewTarget], results);
61
62 Wrapper();
63 assertEquals(2, construct_calls);
64 assertEquals(2, wrapper_calls);
65 assertEquals(0, exceptions); // Replace succeeds
66 assertEquals([LogNewTarget, LogNewTarget], results);
67
68 replace_again = true;
69 Wrapper();
70 assertEquals(3, construct_calls);
71 assertEquals(4, wrapper_calls); // Restarts
72 assertEquals(0, exceptions); // Replace succeeds
73 assertEquals([LogNewTarget, LogNewTarget, LogNewTarget], results);
OLDNEW
« no previous file with comments | « test/mjsunit/es6/debug-liveedit-new-target-2.js ('k') | test/mjsunit/regress/regress-crbug-390925.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698