summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js
diff options
context:
space:
mode:
authoroliver@apple.com <oliver@apple.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2010-05-08 03:19:14 +0000
committeroliver@apple.com <oliver@apple.com@bbb929c8-8fbe-4397-9dbb-9b2b20218538>2010-05-08 03:19:14 +0000
commitea34b7d7a94412735bc294264ee8f2221ef57e20 (patch)
tree54d062e51a520b73b3c2ed7eaeb09c8189d58ed3 /third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js
parentf3e74c38796fc0e952cac49da9b224b9bf2cdc7c (diff)
downloadchromium_src-ea34b7d7a94412735bc294264ee8f2221ef57e20.zip
chromium_src-ea34b7d7a94412735bc294264ee8f2221ef57e20.tar.gz
chromium_src-ea34b7d7a94412735bc294264ee8f2221ef57e20.tar.bz2
Optimize access to the global object from a function that uses eval
https://bugs.webkit.org/show_bug.cgi?id=38644 Reviewed by Gavin Barraclough. JavaScriptCore: Fix bug where cross scope access to a global var (vs. property) would be allowed without checking for intervening dynamic scopes. * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitResolve): LayoutTests: Add test case to ensure we don't incorrectly allow dynamic scopes to be skipped when doing direct var access. * fast/js/global-resolve-through-eval-expected.txt: Added. * fast/js/global-resolve-through-eval.html: Added. * fast/js/script-tests/global-resolve-through-eval.js: Added. (accessGlobal): (accessLocal): git-svn-id: svn://svn.chromium.org/blink/trunk@58993 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Diffstat (limited to 'third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js')
-rw-r--r--third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js b/third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js
new file mode 100644
index 0000000..f8a2cf1
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/js/script-tests/global-resolve-through-eval.js
@@ -0,0 +1,12 @@
+description("Make sure we do a correct property resolution of a global object property when contained by eval.");
+
+var pass = false;
+
+var accessGlobal = (function() { return eval("var pass=true; (function(){ return pass; })"); })();
+var accessLocal = (function() { var pass = false; return (function() { return eval("var pass=true; (function(){ return pass; })"); })(); })();
+
+shouldBeTrue("accessGlobal()");
+shouldBeTrue("accessLocal()");
+
+
+var successfullyParsed = true;