| Index: test/webkit/fast/js/kde/scope.js
|
| diff --git a/test/webkit/do-while-semicolon.js b/test/webkit/fast/js/kde/scope.js
|
| similarity index 66%
|
| copy from test/webkit/do-while-semicolon.js
|
| copy to test/webkit/fast/js/kde/scope.js
|
| index cd7cf4c1028ce794b17dbb326b77804aec0d5ac1..cead049be8e79df27c4f19a70274096eaea19f65 100644
|
| --- a/test/webkit/do-while-semicolon.js
|
| +++ b/test/webkit/fast/js/kde/scope.js
|
| @@ -21,47 +21,38 @@
|
| // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
| // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
| -description(
|
| -"This test checks that toString() round-trip on a function that has do..while in JavaScript does not insert extra semicolon."
|
| -);
|
| +description("KDE JS Test");
|
| +var b = new Boolean();
|
| +b.x = 11;
|
|
|
| -function f1() {
|
| - do {} while(0);
|
| +with (b) {
|
| + f = function(a) { return a*x; } // remember scope chain
|
| }
|
|
|
| -function f2() {
|
| - do {} while(0)
|
| -}
|
| +shouldBe("f(2)", "22");
|
|
|
| -function f3() {
|
| - do {} while(0) ;
|
| +var OBJECT = new MyObject( "hello" );
|
| +function MyObject(value) {
|
| + this.value = value;
|
| + this.toString = new Function( "return this.value+''" );
|
| + return this;
|
| }
|
| -
|
| -function f4() {
|
| - do {} while(0) /*empty*/ ;
|
| +shouldBe("OBJECT.toString()", "'hello'");
|
| +var s;
|
| +with (OBJECT) {
|
| + s = toString();
|
| }
|
| +shouldBe("s", "'hello'");
|
|
|
|
|
| +// Make sure that for ... in reevaluates the scoping every time!
|
| +P = { foo : 1, bar : 2, baz : 3 }
|
|
|
| -if (typeof uneval == "undefined")
|
| - uneval = function(x) { return '(' + x.toString()+ ')'; }
|
| -
|
| -
|
| -uf1 = uneval(f1);
|
| -ueuf1 = uneval(eval(uneval(f1)));
|
| -
|
| -uf2 = uneval(f2);
|
| -ueuf2 = uneval(eval(uneval(f2)));
|
| -
|
| -uf3 = uneval(f3);
|
| -ueuf3 = uneval(eval(uneval(f3)));
|
| -
|
| -uf4 = uneval(f4);
|
| -ueuf4 = uneval(eval(uneval(f4)));
|
| -
|
| -
|
| +function testForIn() {
|
| + for (g in P) {
|
| + eval("var g;") //Change the scope of g half-ways through the loop
|
| + }
|
| +}
|
|
|
| -shouldBe("ueuf1", "uf1");
|
| -shouldBe("ueuf2", "uf2");
|
| -shouldBe("ueuf3", "uf3");
|
| -shouldBe("ueuf4", "uf4");
|
| +testForIn();
|
| +shouldBe("g", "'foo'"); //Before the eval, g was in outer scope, but not after!
|
|
|