Reviewed by Maciej.
Small addition to previous path to cover
http://bugs.webkit.org/show_bug.cgi?id=11399
window.eval runs in the global scope of the calling window
Switch variable scope as well.
* kjs/function.cpp:
(KJS::GlobalFuncImp::callAsFunction):
LayoutTests:
Reviewed by Maciej.
Change test case to cover
http://bugs.webkit.org/show_bug.cgi?id=11399
too.
* fast/js/window-eval-context-expected.txt:
* fast/js/window-eval-context.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@25535
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-09-13 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej.
+
+ Small addition to previous path to cover
+ http://bugs.webkit.org/show_bug.cgi?id=11399
+ window.eval runs in the global scope of the calling window
+
+ Switch variable scope as well.
+
+ * kjs/function.cpp:
+ (KJS::GlobalFuncImp::callAsFunction):
+
2007-09-12 Antti Koivisto <antti@apple.com>
Reviewed by Geoff, Maciej.
newExec.setException(exec->exception());
ctx.setExecState(&newExec);
- if (switchGlobal)
+ if (switchGlobal) {
ctx.pushScope(thisObj);
+ ctx.setVariableObject(thisObj);
+ }
// execute the code
progNode->processVarDecls(&newExec);
+2007-09-13 Antti Koivisto <antti@apple.com>
+
+ Reviewed by Maciej.
+
+ Change test case to cover
+ http://bugs.webkit.org/show_bug.cgi?id=11399
+ too.
+
+ * fast/js/window-eval-context-expected.txt:
+ * fast/js/window-eval-context.html:
+
2007-09-12 Antti Koivisto <antti@apple.com>
Reviewed by Geoff, Maciej.
Test that otherWindow.eval() keeps variables of calling context visible: PASS
-Test that otherWindow.eval() is executed with otherWindow in scope PASS
-Test that otherWindow.eval() has otherWindow as the window object : PASS
+Test that otherWindow.eval() is executed with otherWindow in scope: PASS
+Test that otherWindow.eval() has otherWindow as the window object: PASS
Test that otherWindow.eval() does not change 'this': PASS
+Test that otherWindow.eval() changes variable context: PASS
otherWindow.localVar = 2;
res = otherWindow.eval('localVar == 2');
-print("Test that otherWindow.eval() is executed with otherWindow in scope " + (res ? "PASS" : "FAIL")) ;
+print("Test that otherWindow.eval() is executed with otherWindow in scope: " + (res ? "PASS" : "FAIL")) ;
res = otherWindow.eval('window == otherWindow');
-print("Test that otherWindow.eval() has otherWindow as the window object : " + (res ? "PASS" : "FAIL")) ;
+print("Test that otherWindow.eval() has otherWindow as the window object: " + (res ? "PASS" : "FAIL")) ;
var savedThis = this;
res = otherWindow.eval('this == savedThis');
print("Test that otherWindow.eval() does not change 'this': " + (res ? "PASS" : "FAIL")) ;
+
+otherWindow.eval('var myObject = new Object()');
+res = (typeof myObject == "undefined");
+print("Test that otherWindow.eval() changes variable context: " + (res ? "PASS" : "FAIL")) ;
</script>