New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 3 users
Status: Assigned
Owner:
User never visited
HW: ----
OS: ----
Priority: 2
Type: Bug



Sign in to add a comment
LiveEdit leaves closures in incorrect state.
Project Member Reported by prybin@chromium.org, Sep 5 2013 Back to list
If edit to closure changes heap context structure in outer function (for example, when closure starts to access variable from outside, that previously was used only locally), it leaves code of other closures untouched. That will expect the old scope structure, while it is in fact new.

This can cause incorrect program behaviour or a crash.
 
JS unit test that demonstrates the problem:

Debug = debug.Debug

eval(
"function TestFunction() {\n"
+ "  var a = 'a';\n"
+ "  var b = 'b';\n"
+ "  var c = 'c';\n"
+ "  function A() {\n"
+ "    return 2013;\n"
+ "  }\n"
+ "  function B() {\n"
+ "    return String([a, c]);\n"
+ "  }\n"
+ "  return B();\n"
+ "}\n"
);

var res = TestFunction(); 
assertEquals('a,c', res);

var script = Debug.findScript(TestFunction);
var new_source = script.source.replace("2013", "b");
var result = Debug.LiveEdit.SetScriptSource(script, new_source, false, []);

var res = TestFunction(); 
assertEquals('a,c', res); // This currently fails.

Comment 2 by habl...@google.com, Apr 29 2015
Status: Assigned
Comment 3 Deleted
Comment 4 Deleted
Labels: Priority-2
Sign in to add a comment