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

Side by Side Diff: test/mjsunit/debug-liveedit-2.js

Issue 1697016: LiveEdit: clean JS sources a bit (Closed)
Patch Set: tab Created 10 years, 8 months 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-1.js ('k') | test/mjsunit/debug-liveedit-check-stack.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 var orig_animal = "'Cat'"; 52 var orig_animal = "'Cat'";
53 var patch_pos = script.source.indexOf(orig_animal); 53 var patch_pos = script.source.indexOf(orig_animal);
54 var new_animal_patch = "'Capybara' + p"; 54 var new_animal_patch = "'Capybara' + p";
55 55
56 // We patch innermost function "Chooser". 56 // We patch innermost function "Chooser".
57 // However, this does not actually patch existing "Chooser" instances, 57 // However, this does not actually patch existing "Chooser" instances,
58 // because old value of parameter "p" was not saved. 58 // because old value of parameter "p" was not saved.
59 // Instead it patches ChooseAnimal. 59 // Instead it patches ChooseAnimal.
60 var change_log = new Array(); 60 var change_log = new Array();
61 Debug.LiveEdit.ApplyPatch(script, patch_pos, orig_animal.length, new_animal_patc h, change_log); 61 Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, orig_animal.leng th, new_animal_patch, change_log);
62 print("Change log: " + JSON.stringify(change_log) + "\n"); 62 print("Change log: " + JSON.stringify(change_log) + "\n");
63 63
64 var new_closure = ChooseAnimal(19); 64 var new_closure = ChooseAnimal(19);
65 // New instance of closure is patched. 65 // New instance of closure is patched.
66 assertEquals("Capybara19", new_closure()); 66 assertEquals("Capybara19", new_closure());
67 67
68 // Old instance of closure is not patched. 68 // Old instance of closure is not patched.
69 assertEquals("Cat", old_closure()); 69 assertEquals("Cat", old_closure());
70 70
OLDNEW
« no previous file with comments | « test/mjsunit/debug-liveedit-1.js ('k') | test/mjsunit/debug-liveedit-check-stack.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698