Changeset 25535 in webkit


Ignore:
Timestamp:
Sep 13, 2007 7:50:22 AM (17 years 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:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r25534 r25535  
     12007-09-13  Antti Koivisto  <antti@apple.com>
     2
     3        Reviewed by Maciej.
     4       
     5        Small addition to previous path to cover
     6        http://bugs.webkit.org/show_bug.cgi?id=11399
     7        window.eval runs in the global scope of the calling window
     8       
     9        Switch variable scope as well.
     10
     11        * kjs/function.cpp:
     12        (KJS::GlobalFuncImp::callAsFunction):
     13
    1142007-09-12  Antti Koivisto  <antti@apple.com>
    215
  • trunk/JavaScriptCore/kjs/function.cpp

    r25534 r25535  
    834834        ctx.setExecState(&newExec);
    835835         
    836         if (switchGlobal)
     836        if (switchGlobal) {
    837837            ctx.pushScope(thisObj);
     838            ctx.setVariableObject(thisObj);
     839        }
    838840       
    839841        // execute the code
  • trunk/LayoutTests/ChangeLog

    r25534 r25535  
     12007-09-13  Antti Koivisto  <antti@apple.com>
     2
     3        Reviewed by Maciej.
     4       
     5        Change test case to cover
     6        http://bugs.webkit.org/show_bug.cgi?id=11399
     7        too.
     8
     9        * fast/js/window-eval-context-expected.txt:
     10        * fast/js/window-eval-context.html:
     11
    1122007-09-12  Antti Koivisto  <antti@apple.com>
    213
  • trunk/LayoutTests/fast/js/window-eval-context-expected.txt

    r25534 r25535  
    11
    22Test that otherWindow.eval() keeps variables of calling context visible: PASS
    3 Test that otherWindow.eval() is executed with otherWindow in scope PASS
    4 Test that otherWindow.eval() has otherWindow as the window object : PASS
     3Test that otherWindow.eval() is executed with otherWindow in scope: PASS
     4Test that otherWindow.eval() has otherWindow as the window object: PASS
    55Test that otherWindow.eval() does not change 'this': PASS
     6Test that otherWindow.eval() changes variable context: PASS
  • 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>
Note: See TracChangeset for help on using the changeset viewer.