Commit 593ac5a5 authored by darin's avatar darin
Browse files

Reviewed by Geoff.

        - change tests that depend on the order of iteration of built-in properties
          to sort explicitly so they don't depend on the order any more

        * fast/dom/Window/resources/window-appendages-cleared-results.html:
        * fast/dom/Window/window-appendages-cleared-expected.txt:

        * fast/dom/Window/window-properties-expected.txt:
        * fast/dom/Window/window-properties.html:

        * fast/js/regexp-caching-expected.txt:
        * fast/js/regexp-caching.html:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@20023 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent c269fe9b
2007-03-07 Darin Adler <darin@apple.com>
Reviewed by Geoff.
- change tests that depend on the order of iteration of built-in properties
to sort explicitly so they don't depend on the order any more
* fast/dom/Window/resources/window-appendages-cleared-results.html:
* fast/dom/Window/window-appendages-cleared-expected.txt:
* fast/dom/Window/window-properties-expected.txt:
* fast/dom/Window/window-properties.html:
* fast/js/regexp-caching-expected.txt:
* fast/js/regexp-caching.html:
2007-03-07 Alexey Proskuryakov <ap@webkit.org>
 
Reviewed by Darin.
......@@ -8,45 +8,30 @@
<p id="description"></p>
<div id="console"></div>
<script>
for (var prop in window.history) {
shouldBeFalse('history.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in screen) {
shouldBeFalse('screen.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in frames) {
shouldBeFalse('frames.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in location) {
shouldBeFalse('location.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in locationbar) {
shouldBeFalse('locationbar.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in menubar) {
shouldBeFalse('menubar.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in personalbar) {
shouldBeFalse('personalbar.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in scrollbars) {
shouldBeFalse('scrollbars.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in statusbar) {
shouldBeFalse('statusbar.' + prop + ' == "LEFTOVER"', "false");
}
for (var prop in toolbar) {
shouldBeFalse('toolbar.' + prop + ' == "LEFTOVER"', "false");
}
function checkForLeftoverProperties(string, object)
{
var array = new Array;
for (var property in object) {
array.push(property);
}
array.sort();
for (var i = 0; i < array.length; ++i) {
var property = array[i];
shouldBeFalse(string + '.' + property + ' == "LEFTOVER"');
}
}
checkForLeftoverProperties("history", window.history);
checkForLeftoverProperties("frames", frames);
checkForLeftoverProperties("location", location);
checkForLeftoverProperties("locationbar", locationbar);
checkForLeftoverProperties("menubar", menubar);
checkForLeftoverProperties("personalbar", personalbar);
checkForLeftoverProperties("screen", screen);
checkForLeftoverProperties("scrollbars", scrollbars);
checkForLeftoverProperties("statusbar", statusbar);
checkForLeftoverProperties("toolbar", toolbar);
shouldBeUndefined('window.event');
......@@ -59,5 +44,3 @@ if (window.layoutTestController)
</script>
</body>
</html>
PASS history.length == "LEFTOVER" is false
PASS history.back == "LEFTOVER" is false
PASS history.go == "LEFTOVER" is false
PASS history.forward == "LEFTOVER" is false
PASS frames.location == "LEFTOVER" is false
PASS history.go == "LEFTOVER" is false
PASS history.length == "LEFTOVER" is false
PASS frames.length == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false
PASS location.pathname == "LEFTOVER" is false
PASS location.port == "LEFTOVER" is false
PASS location.href == "LEFTOVER" is false
PASS location.search == "LEFTOVER" is false
PASS frames.location == "LEFTOVER" is false
PASS location.assign == "LEFTOVER" is false
PASS location.reload == "LEFTOVER" is false
PASS location.hash == "LEFTOVER" is false
PASS location.host == "LEFTOVER" is false
PASS location.hostname == "LEFTOVER" is false
PASS location.href == "LEFTOVER" is false
PASS location.pathname == "LEFTOVER" is false
PASS location.port == "LEFTOVER" is false
PASS location.protocol == "LEFTOVER" is false
PASS location.toString == "LEFTOVER" is false
PASS location.reload == "LEFTOVER" is false
PASS location.replace == "LEFTOVER" is false
PASS location.search == "LEFTOVER" is false
PASS location.toString == "LEFTOVER" is false
PASS locationbar.visible == "LEFTOVER" is false
PASS menubar.visible == "LEFTOVER" is false
PASS personalbar.visible == "LEFTOVER" is false
......
......@@ -16,7 +16,6 @@ function log(s)
var pre = document.getElementById('pre');
function flushLog()
{
logBuffer.sort();
var logMessage = logBuffer.join("");
pre.appendChild(document.createTextNode(logMessage));
}
......@@ -91,8 +90,15 @@ function logValue(valueName)
function logProperties(object, objectName)
{
for (var property in object)
var array = new Array;
for (var property in object) {
array.push(property);
}
array.sort();
for (var i = 0; i < array.length; i++) {
var property = array[i];
logValue(objectName + "." + property);
}
}
logValue('window');
......
This test checks our implementation of the special RegExp member variables.
Properties of RegExp at startup:
input: {} (read-write)
$5: {} (read-only)
$3: {} (read-only)
$1: {} (read-only)
multiline: {false} (read-write)
lastParen: {} (read-only)
rightContext: {} (read-only)
lastMatch: {} (read-only)
$4: {} (read-only)
leftContext: {} (read-only)
$2: {} (read-only)
$3: {} (read-only)
$4: {} (read-only)
$5: {} (read-only)
$6: {} (read-only)
$7: {} (read-only)
$8: {} (read-only)
$9: {} (read-only)
input: {} (read-write)
lastMatch: {} (read-only)
lastParen: {} (read-only)
leftContext: {} (read-only)
multiline: {false} (read-write)
rightContext: {} (read-only)
Properties of RegExp after /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/.exec(<1234567890>):
input: {<1234567890>}
$5: {5}
$3: {3}
$1: {1}
multiline: {false}
lastParen: {0}
rightContext: {>}
lastMatch: {1234567890}
$4: {4}
leftContext: {<}
$2: {2}
$3: {3}
$4: {4}
$5: {5}
$6: {6}
$7: {7}
$8: {8}
$9: {9}
input: {<1234567890>}
lastMatch: {1234567890}
lastParen: {0}
leftContext: {<}
multiline: {false}
rightContext: {>}
RegExp.$0 does not exist
RegExp.$10 does not exist
RegExp uses RegExp.input
RegExp.multiline coerces values to booleans
RegExp.input coerces values to strings
Properties of RegExp after /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/.exec(XXX):
input: {0}
$5: {}
$3: {}
$1: {}
multiline: {true}
lastParen: {}
rightContext: {}
lastMatch: {}
$4: {}
leftContext: {0}
$2: {}
$3: {}
$4: {}
$5: {}
$6: {}
$7: {}
$8: {}
$9: {}
input: {0}
lastMatch: {}
lastParen: {}
leftContext: {0}
multiline: {true}
rightContext: {}
---------- [Cleared RegExp values] ----------
Properties of RegExp after <1234567890>.search(/(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/):
input: {<1234567890>}
$5: {5}
$3: {3}
$1: {1}
multiline: {true}
lastParen: {0}
rightContext: {>}
lastMatch: {1234567890}
$4: {4}
leftContext: {<}
$2: {2}
$3: {3}
$4: {4}
$5: {5}
$6: {6}
$7: {7}
$8: {8}
$9: {9}
---------- [Cleared RegExp values] ----------
Properties of RegExp after <1234567890>.replace(/(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/):
input: {<1234567890>}
$5: {5}
$3: {3}
$1: {1}
multiline: {true}
lastParen: {0}
rightContext: {>}
lastMatch: {1234567890}
$4: {4}
lastParen: {0}
leftContext: {<}
multiline: {true}
rightContext: {>}
---------- [Cleared RegExp values] ----------
Properties of RegExp after <1234567890>.replace(/(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/):
$1: {1}
$2: {2}
$3: {3}
$4: {4}
$5: {5}
$6: {6}
$7: {7}
$8: {8}
$9: {9}
input: {<1234567890>}
lastMatch: {1234567890}
lastParen: {0}
leftContext: {<}
multiline: {true}
rightContext: {>}
<html>
<head>
<script>
function print(message) {
var paragraph = document.createElement("p");
paragraph.appendChild(document.createTextNode(message));
document.getElementById("console").appendChild(paragraph);
function print(message)
{
var block = document.createElement("div");
block.appendChild(document.createTextNode(message));
block.appendChild(document.createElement("br"));
document.getElementById("console").appendChild(block);
}
function isReadOnly(p) {
var oldValue = RegExp[p];
RegExp[p] = !RegExp[p];
var result = (RegExp[p] == oldValue);
RegExp[p] = oldValue;
function isReadOnly(object, property)
{
var oldValue = object[property];
object[property] = !object[property];
var result = (object[property] == oldValue);
object[property] = oldValue;
return result;
}
function printPropertiesWithReadOnly(object)
{
var array = new Array;
for (var property in object) {
array.push(property);
}
array.sort();
for (var i = 0; i < array.length; i++) {
var property = array[i];
print(property + ": {" + object[property] + "} " + (isReadOnly(object, property) ? "(read-only)" : "(read-write)"));
}
}
function printProperties(object)
{
var array = new Array;
for (var property in object) {
array.push(property);
}
array.sort();
for (var i = 0; i < array.length; i++) {
var property = array[i];
print(property + ": {" + object[property] + "}");
}
}
function test() {
if (window.layoutTestController)
layoutTestController.dumpAsText();
print("Properties of RegExp at startup:");
for (var p in RegExp) {
print(p + ": {" + RegExp[p] + "} " + (isReadOnly(p) ? "(read-only)" : "(read-write)"));
}
printPropertiesWithReadOnly(RegExp);
var r = /(1)(2)(3)(4)(5)(6)(7)(8)(9)(0)/;
var matchingString = "<1234567890>";
......@@ -34,8 +61,7 @@ function test() {
print("");
r.exec(matchingString);
print("Properties of RegExp after " + r + ".exec(" + matchingString + "):");
for (var p in RegExp)
print(p + ": {" + RegExp[p] + "} ");
printProperties(RegExp);
print("");
print("RegExp.$0 " + (RegExp.$0 ? "exists" : "does not exist"));
......@@ -50,8 +76,7 @@ function test() {
print("");
r.exec(unmatchingString);
print("Properties of RegExp after " + r + ".exec(" + unmatchingString + "):");
for (var p in RegExp)
print(p + ": {" + RegExp[p] + "} ");
printProperties(RegExp);
print("");
print("---------- [Cleared RegExp values] ----------");
......@@ -61,8 +86,7 @@ function test() {
matchingString.search(r);
print("Properties of RegExp after " + matchingString + ".search(" + r + "):");
for (var p in RegExp)
print(p + ": {" + RegExp[p] + "} ");
printProperties(RegExp);
print("");
print("---------- [Cleared RegExp values] ----------");
......@@ -70,8 +94,7 @@ function test() {
matchingString.replace(r);
print("Properties of RegExp after " + matchingString + ".replace(" + r + "):");
for (var p in RegExp)
print(p + ": {" + RegExp[p] + "} ");
printProperties(RegExp);
}
</script>
</head>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment