Index: test/webkit/fast/js/kde/eval.js |
diff --git a/test/webkit/array-sort-small-sparse-array-with-large-length.js b/test/webkit/fast/js/kde/eval.js |
similarity index 67% |
copy from test/webkit/array-sort-small-sparse-array-with-large-length.js |
copy to test/webkit/fast/js/kde/eval.js |
index 05478d6f8ca2117838ae59702e01ea6d76e19fa7..7c4b5d4b928da31c29772cfb12404dcc4fc782e7 100644 |
--- a/test/webkit/array-sort-small-sparse-array-with-large-length.js |
+++ b/test/webkit/fast/js/kde/eval.js |
@@ -21,20 +21,36 @@ |
// (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( |
-"Tests that we can quickly sort a small sparse array that has a large length." |
-); |
+description("KDE JS Test"); |
+shouldBe("eval.length", "1"); |
+shouldBe("eval('this')", "this"); |
-var array = []; |
-array[10000000] = 42; |
-array.sort(); |
-var result = ""; |
-for (var s in array) { |
- debug("array[" + s + "] = " + array[s]); |
- if (result) |
- result += ","; |
- result += array[s]; |
+function MyObject() { |
+ this.x = 99; |
} |
-shouldBe("result", "\"42\""); |
-shouldBe("array.length", "10000001"); |
-shouldBe("array[0]", "42"); |
+ |
+eval("b = new MyObject();"); |
+var bx = b.x // rule out side effects of eval() in shouldBe() test function |
+shouldBe("bx", "99"); |
+ |
+ |
+eval("var c = new MyObject();"); // the 'var' makes a difference |
+var cx = c.x; |
+shouldBe("cx", "99"); |
+ |
+// KDE bug #45679 |
+if (true.eval) { |
+ var o = { str:1 }; |
+ shouldBe("o.eval('str')", "1"); |
+ shouldBe("o.eval('this')", "this"); |
+} else { |
+ testPassed("Skipping test for deprecated Object.prototype.eval()"); |
+} |
+ |
+// problem from within khtml |
+function lotto() { |
+ // j must be accessible to eval() |
+ for (var j = 0; j < 1; j++) |
+ return eval('j'); |
+} |
+shouldBe("lotto()", "0"); |