From 022b77f0ba00c20ef35a48317b1920cdcd1d7283 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Sat, 26 Jan 2013 16:40:06 +0100 Subject: [PATCH] Bug 825379 - Fix JSContext::findVersion to work with Ion frames. r=dvander --- js/src/jit-test/tests/bug825379.js | 8 ++++++++ js/src/jscntxtinlines.h | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 js/src/jit-test/tests/bug825379.js diff --git a/js/src/jit-test/tests/bug825379.js b/js/src/jit-test/tests/bug825379.js new file mode 100644 index 000000000000..a56866de65a6 --- /dev/null +++ b/js/src/jit-test/tests/bug825379.js @@ -0,0 +1,8 @@ +x = this +y = {} +y.v = ""; +[0, 0].forEach(function() { + for (p in y) { + x.eval("function f(){yield e}") + } +}); diff --git a/js/src/jscntxtinlines.h b/js/src/jscntxtinlines.h index 16ea7787de14..94ac3d3213d6 100644 --- a/js/src/jscntxtinlines.h +++ b/js/src/jscntxtinlines.h @@ -463,8 +463,8 @@ JSContext::findVersion() const if (hasVersionOverride) return versionOverride; - if (stack.hasfp()) - return fp()->script()->getVersion(); + if (JSScript *script = stack.currentScript(NULL, js::ContextStack::ALLOW_CROSS_COMPARTMENT)) + return script->getVersion(); return defaultVersion; }