JS_WALA
JS_WALA copied to clipboard
Normalization should preserve global variable declarations
Consider an HTML page including two scripts 1.js and 2.js, where 1.js is
var x;
and 2.js is
alert(x);
Loading this page alerts undefined.
Assume we only normalize 1.js and leave 2.js in its original state. Loading the modified page then results in a ReferenceError since global variable x is neither declared nor defined.
To enable normalized and non-normalized code to work together, the normalization should preserve global variable declarations.