Show
Ignore:
Timestamp:
09/13/07 07:50:22 (14 months ago)
Author:
antti
Message:

JavaScriptCore:

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:
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/fast/js/window-eval-context.html

    r25534 r25535  
    2727otherWindow.localVar = 2; 
    2828res = otherWindow.eval('localVar == 2'); 
    29 print("Test that otherWindow.eval() is executed with otherWindow in scope " + (res ? "PASS" : "FAIL")) ; 
     29print("Test that otherWindow.eval() is executed with otherWindow in scope: " + (res ? "PASS" : "FAIL")) ; 
    3030 
    3131res = otherWindow.eval('window == otherWindow'); 
    32 print("Test that otherWindow.eval() has otherWindow as the window object : " + (res ? "PASS" : "FAIL")) ; 
     32print("Test that otherWindow.eval() has otherWindow as the window object: " + (res ? "PASS" : "FAIL")) ; 
    3333 
    3434var savedThis = this; 
    3535res = otherWindow.eval('this == savedThis'); 
    3636print("Test that otherWindow.eval() does not change 'this': " + (res ? "PASS" : "FAIL")) ; 
     37 
     38otherWindow.eval('var myObject = new Object()'); 
     39res = (typeof myObject == "undefined"); 
     40print("Test that otherWindow.eval() changes variable context: " + (res ? "PASS" : "FAIL")) ; 
    3741</script>