cachedscope_2.js 615 B

1234567891011121314151617181920
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. function f() {
  6. var x = { y: 0 };
  7. g.escape();
  8. function g() {
  9. return eval('x.y');
  10. }
  11. }
  12. var foo;
  13. Function.prototype.escape = function () { foo = this; }
  14. f();
  15. if (foo() === 0) {
  16. WScript.Echo('pass');
  17. }