Skip to content
This repository has been archived by the owner on Dec 9, 2017. It is now read-only.

Overwriting process global when recording in browser and replaying under node #63

Open
msridhar opened this issue Apr 15, 2014 · 1 comment

Comments

@msridhar
Copy link
Contributor

Consider the following code:

if (typeof process !== "undefined") {
  console.log("foo");
} else {
  console.log("baz");
}

Say we record the above script in the browser, and then replay under node.js. In the browser, process is undefined, so this gets recorded to the trace. During replay, we read in the trace and overwrite the real process global with undefined, which seems bad. While replay itself seems to proceed, replay.js reads process at the end, which causes a crash.

Not sure of the right fix for this one. Maybe replay.js should stash away a pointer to the process object before starting actual replay?

@msridhar msridhar changed the title Don't overwrite process when recording in browser and replaying under node Overwriting process global when recording in browser and replaying under node Apr 15, 2014
@msridhar
Copy link
Contributor Author

Actually, stashing away the pointer in replay.js is insufficient; all analyses (and dependent libraries) that refer to process would have to do something different, which seems impossible to enforce.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant