Commit 9119a9c0 authored by oliver's avatar oliver
Browse files

Reviewed by Darin.

        Patch for http://bugs.webkit.org/show_bug.cgi?id=13707
        REGRESSION: JavaScript exceptions on quotes.burntelectrons.org

        http://bugs.webkit.org/show_bug.cgi?id=12628
        document.body is not supported in XHTML documents

        http://bugs.webkit.org/show_bug.cgi?id=14213
        On page with MIME type application/xhtml+xml, cookie don't work

WebCore:
        Moved a bunch of methods and properties from HTMLDocument down into Document to make
        them available for all documents (xml, svg).
        What was kept in HTMLDocument:
        - some methods and properties that are not in HTML5 (yet?);
        - open/write/writeln/close, as they will need to be modified to work on XML documents, and aren't
        of much use for those anyway;
        - designMode, because its definition in HTML5 is incompatible with our implementation.

        Covered by existing tests.

        * bindings/js/JSDocumentCustom.cpp:
        (WebCore::JSDocument::location):
        (WebCore::JSDocument::setLocation):
        * bindings/js/JSHTMLDocumentCustom.cpp:
        * bindings/objc/PublicDOMInterfaces.h:
        * dom/Document.cpp:
        (WebCore::Document::setBody):
        (WebCore::Document::cookie):
        (WebCore::Document::setCookie):
        (WebCore::Document::lastModified):
        * dom/Document.h:
        (WebCore::Document::title):
        * dom/Document.idl:
        * html/HTMLDocument.cpp:
        * html/HTMLDocument.h:
        * html/HTMLDocument.idl:

LayoutTests:
        * dom/xhtml/level2/html/HTMLBaseElement01-expected.checksum: Removed.
        * dom/xhtml/level2/html/HTMLBaseElement01-expected.png: Removed.
        * dom/xhtml/level2/html/HTMLBaseElement01-expected.txt:
        * dom/xhtml/level2/html/HTMLBaseElement01.xhtml:
        * dom/xhtml/level2/html/HTMLBaseElement02-expected.checksum: Removed.
        * dom/xhtml/level2/html/HTMLBaseElement02-expected.png: Removed.
        * dom/xhtml/level2/html/HTMLBaseElement02-expected.txt:
        * dom/xhtml/level2/html/HTMLBaseElement02.xhtml:
        * dom/xhtml/level2/html/HTMLBodyElement07-expected.txt:
        * dom/xhtml/level2/html/HTMLBodyElement08-expected.txt:
        * dom/xhtml/level2/html/HTMLBodyElement09-expected.txt:
        * dom/xhtml/level2/html/HTMLBodyElement10-expected.txt:
        * dom/xhtml/level2/html/HTMLBodyElement11-expected.txt:
        * dom/xhtml/level2/html/HTMLBodyElement12-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument01-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument02-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument03-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument05-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument07-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument08-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument09-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument10-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument11-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument12-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument13-expected.txt:
        * dom/xhtml/level2/html/HTMLDocument14-expected.txt:
        * dom/xhtml/level2/html/doc01-expected.txt:
        These now pass. Changed HTMLBaseElement* to dump as text.

        * fast/dom/Window/window-properties-expected.txt: Added Document.prototype.getElementsByName



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@26499 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 37123bce
2007-10-06 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
Update tests for http://bugs.webkit.org/show_bug.cgi?id=13707
REGRESSION: JavaScript exceptions on quotes.burntelectrons.org
* dom/xhtml/level2/html/HTMLBaseElement01-expected.checksum: Removed.
* dom/xhtml/level2/html/HTMLBaseElement01-expected.png: Removed.
* dom/xhtml/level2/html/HTMLBaseElement01-expected.txt:
* dom/xhtml/level2/html/HTMLBaseElement01.xhtml:
* dom/xhtml/level2/html/HTMLBaseElement02-expected.checksum: Removed.
* dom/xhtml/level2/html/HTMLBaseElement02-expected.png: Removed.
* dom/xhtml/level2/html/HTMLBaseElement02-expected.txt:
* dom/xhtml/level2/html/HTMLBaseElement02.xhtml:
* dom/xhtml/level2/html/HTMLBodyElement07-expected.txt:
* dom/xhtml/level2/html/HTMLBodyElement08-expected.txt:
* dom/xhtml/level2/html/HTMLBodyElement09-expected.txt:
* dom/xhtml/level2/html/HTMLBodyElement10-expected.txt:
* dom/xhtml/level2/html/HTMLBodyElement11-expected.txt:
* dom/xhtml/level2/html/HTMLBodyElement12-expected.txt:
* dom/xhtml/level2/html/HTMLDocument01-expected.txt:
* dom/xhtml/level2/html/HTMLDocument02-expected.txt:
* dom/xhtml/level2/html/HTMLDocument03-expected.txt:
* dom/xhtml/level2/html/HTMLDocument05-expected.txt:
* dom/xhtml/level2/html/HTMLDocument07-expected.txt:
* dom/xhtml/level2/html/HTMLDocument08-expected.txt:
* dom/xhtml/level2/html/HTMLDocument09-expected.txt:
* dom/xhtml/level2/html/HTMLDocument10-expected.txt:
* dom/xhtml/level2/html/HTMLDocument11-expected.txt:
* dom/xhtml/level2/html/HTMLDocument12-expected.txt:
* dom/xhtml/level2/html/HTMLDocument13-expected.txt:
* dom/xhtml/level2/html/HTMLDocument14-expected.txt:
* dom/xhtml/level2/html/doc01-expected.txt:
These now pass. Changed HTMLBaseElement* to dump as text.
* fast/dom/Window/window-properties-expected.txt: Added Document.prototype.getElementsByName
2007-10-03 Eric Seidel <eric@webkit.org>
 
Reviewed by Maciej.
......@@ -17,6 +17,15 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
//
// WebKit modification: 13-May-2007
//
// Inform the test controller that this test has a text-format result and so should
// be dumped as text.
//
if (window.layoutTestController)
layoutTestController.dumpAsText();
function assertSize(descr, expected, actual) {
var actualSize;
assertNotNull(descr, actual);
......@@ -25,15 +34,15 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
function assertEqualsAutoCase(context, descr, expected, actual) {
if (builder.contentType == "text/html") {
if(context == "attribute") {
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
} else {
assertEquals(descr, expected.toUpperCase(), actual);
}
} else {
assertEquals(descr, expected, actual);
}
if (builder.contentType == "text/html") {
if(context == "attribute") {
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
} else {
assertEquals(descr, expected.toUpperCase(), actual);
}
} else {
assertEquals(descr, expected, actual);
}
}
......@@ -55,19 +64,19 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
matches = 0;
expectedValue = expected[i];
for(j = 0; j < actualLen; j++) {
if (builder.contentType == "text/html") {
if (context == "attribute") {
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
matches++;
}
} else {
if (expectedValue.toUpperCase() == actual[j]) {
matches++;
}
}
} else {
if(expectedValue == actual[j]) {
matches++;
if (builder.contentType == "text/html") {
if (context == "attribute") {
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
matches++;
}
} else {
if (expectedValue.toUpperCase() == actual[j]) {
matches++;
}
}
} else {
if(expectedValue == actual[j]) {
matches++;
}
}
}
......@@ -112,13 +121,13 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
function assertEqualsListAutoCase(context, descr, expected, actual) {
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
//
for(var i = 0; i < minLength; i++) {
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
}
//
// if they aren't the same size, they aren't equal
......@@ -127,14 +136,14 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
function assertEqualsList(descr, expected, actual) {
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
//
for(var i = 0; i < minLength; i++) {
if(expected[i] != actual[i]) {
assertEquals(descr, expected[i], actual[i]);
assertEquals(descr, expected[i], actual[i]);
}
}
//
......@@ -248,13 +257,13 @@ function same(expected, actual)
}
function equalsAutoCase(context, expected, actual) {
if (builder.contentType == "text/html") {
if (context == "attribute") {
return expected.toLowerCase() == actual;
}
return expected.toUpperCase() == actual;
}
return expected == actual;
if (builder.contentType == "text/html") {
if (context == "attribute") {
return expected.toLowerCase() == actual;
}
return expected.toUpperCase() == actual;
}
return expected == actual;
}
function toLowerArray(src) {
......@@ -268,7 +277,7 @@ function toLowerArray(src) {
function createTempURI(scheme) {
if (scheme == "http") {
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
}
return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
}
......@@ -336,7 +345,7 @@ function UserDataNotification(operation, key, data, src, dst) {
}
function UserDataMonitor() {
this.allNotifications = new Array();
this.allNotifications = new Array();
}
UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
......@@ -440,7 +449,7 @@ HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
return document;
}
//
//
......@@ -478,7 +487,7 @@ HTMLBuilder.prototype.load = function(frame, varname, url) {
var srcNode = document.firstChild;
while(srcNode != null && srcNode.nodeType != 1) {
if (srcNode.nodeType != 10) {
var cloneNode = this.cloneNode(srcNode, clone);
var cloneNode = this.cloneNode(srcNode, clone);
clone.insertBefore(cloneNode, clone.documentElement);
}
srcNode = srcNode.nextSibling;
......@@ -567,19 +576,19 @@ function setResult(resultType, message) {
var statusDiv2 = statusRow.insertCell(-1);
var style = "color:green";
if (resultType == null) {
statusDiv2.appendChild(document.createTextNode("Success"));
statusDiv2.appendChild(document.createTextNode("Success"));
} else {
statusDiv2.appendChild(document.createTextNode(resultType));
if (resultType == "skip") {
style = "color:blue";
} else {
style = "color:red";
}
statusDiv2.appendChild(document.createTextNode(resultType));
if (resultType == "skip") {
style = "color:blue";
} else {
style = "color:red";
}
}
newTable.setAttributeNS(null, "style", style);
if (message != null) {
var messageRow = newTable.insertRow(-1);
var messageDiv1 = messageRow.insertCell(-1);
var messageDiv1 = messageRow.insertCell(-1);
messageDiv1.appendChild(document.createTextNode("Message"));
var messageDiv2 = messageRow.insertCell(-1);
messageDiv2.appendChild(document.createTextNode(message));
......@@ -693,7 +702,7 @@ function getResourceURI(name, scheme, contentType) {
if (base == null) {
base = "";
} else {
base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
}
return base + name + getSuffix(contentType);
}
......@@ -701,20 +710,20 @@ function getResourceURI(name, scheme, contentType) {
function startTest() {
//
// invoke test setup
//
setUpPage();
try {
runTest();
if (builder.initializationError == null) {
setResult(null, null);
} else {
setResult("skip", builder.initializationError);
}
} catch(ex) {
if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") {
//
// invoke test setup
//
setUpPage();
try {
runTest();
if (builder.initializationError == null) {
setResult(null, null);
} else {
setResult("skip", builder.initializationError);
}
} catch(ex) {
if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") {
setResult("failure", ex.substring(8));
} else {
setResult("error", ex);
......@@ -774,7 +783,7 @@ function setUpPage() {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
......
......@@ -17,6 +17,15 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
*/
//
// WebKit modification: 13-May-2007
//
// Inform the test controller that this test has a text-format result and so should
// be dumped as text.
//
if (window.layoutTestController)
layoutTestController.dumpAsText();
function assertSize(descr, expected, actual) {
var actualSize;
assertNotNull(descr, actual);
......@@ -25,15 +34,15 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
}
function assertEqualsAutoCase(context, descr, expected, actual) {
if (builder.contentType == "text/html") {
if(context == "attribute") {
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
} else {
assertEquals(descr, expected.toUpperCase(), actual);
}
} else {
assertEquals(descr, expected, actual);
}
if (builder.contentType == "text/html") {
if(context == "attribute") {
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
} else {
assertEquals(descr, expected.toUpperCase(), actual);
}
} else {
assertEquals(descr, expected, actual);
}
}
......@@ -55,19 +64,19 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
matches = 0;
expectedValue = expected[i];
for(j = 0; j < actualLen; j++) {
if (builder.contentType == "text/html") {
if (context == "attribute") {
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
matches++;
}
} else {
if (expectedValue.toUpperCase() == actual[j]) {
matches++;
}
}
} else {
if(expectedValue == actual[j]) {
matches++;
if (builder.contentType == "text/html") {
if (context == "attribute") {
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
matches++;
}
} else {
if (expectedValue.toUpperCase() == actual[j]) {
matches++;
}
}
} else {
if(expectedValue == actual[j]) {
matches++;
}
}
}
......@@ -112,13 +121,13 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
function assertEqualsListAutoCase(context, descr, expected, actual) {
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
//
for(var i = 0; i < minLength; i++) {
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
}
//
// if they aren't the same size, they aren't equal
......@@ -127,14 +136,14 @@ the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
function assertEqualsList(descr, expected, actual) {
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
var minLength = expected.length;
if (actual.length < minLength) {
minLength = actual.length;
}
//
for(var i = 0; i < minLength; i++) {
if(expected[i] != actual[i]) {
assertEquals(descr, expected[i], actual[i]);
assertEquals(descr, expected[i], actual[i]);
}
}
//
......@@ -248,13 +257,13 @@ function same(expected, actual)
}
function equalsAutoCase(context, expected, actual) {
if (builder.contentType == "text/html") {
if (context == "attribute") {
return expected.toLowerCase() == actual;
}
return expected.toUpperCase() == actual;
}
return expected == actual;
if (builder.contentType == "text/html") {
if (context == "attribute") {
return expected.toLowerCase() == actual;
}
return expected.toUpperCase() == actual;
}
return expected == actual;
}
function toLowerArray(src) {
......@@ -268,7 +277,7 @@ function toLowerArray(src) {
function createTempURI(scheme) {
if (scheme == "http") {
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
return "http://localhost:8080/webdav/tmp" + Math.floor(Math.random() * 100000) + ".xml";
}
return "file:///tmp/domts" + Math.floor(Math.random() * 100000) + ".xml";
}
......@@ -336,7 +345,7 @@ function UserDataNotification(operation, key, data, src, dst) {
}
function UserDataMonitor() {
this.allNotifications = new Array();
this.allNotifications = new Array();
}
UserDataMonitor.prototype.handle = function(operation, key, data, src, dst) {
......@@ -440,7 +449,7 @@ HTMLBuilder.prototype.cloneNode = function(srcNode, doc) {
HTMLBuilder.prototype.load = function(frame, varname, url) {
if (this.documentVarnames[0] == varname) {
return document;
return document;
}
//
//
......@@ -478,7 +487,7 @@ HTMLBuilder.prototype.load = function(frame, varname, url) {
var srcNode = document.firstChild;
while(srcNode != null && srcNode.nodeType != 1) {
if (srcNode.nodeType != 10) {
var cloneNode = this.cloneNode(srcNode, clone);
var cloneNode = this.cloneNode(srcNode, clone);
clone.insertBefore(cloneNode, clone.documentElement);
}
srcNode = srcNode.nextSibling;
......@@ -567,19 +576,19 @@ function setResult(resultType, message) {
var statusDiv2 = statusRow.insertCell(-1);
var style = "color:green";
if (resultType == null) {
statusDiv2.appendChild(document.createTextNode("Success"));
statusDiv2.appendChild(document.createTextNode("Success"));
} else {
statusDiv2.appendChild(document.createTextNode(resultType));
if (resultType == "skip") {
style = "color:blue";
} else {
style = "color:red";
}
statusDiv2.appendChild(document.createTextNode(resultType));
if (resultType == "skip") {
style = "color:blue";
} else {
style = "color:red";
}
}
newTable.setAttributeNS(null, "style", style);
if (message != null) {
var messageRow = newTable.insertRow(-1);
var messageDiv1 = messageRow.insertCell(-1);
var messageDiv1 = messageRow.insertCell(-1);
messageDiv1.appendChild(document.createTextNode("Message"));
var messageDiv2 = messageRow.insertCell(-1);
messageDiv2.appendChild(document.createTextNode(message));
......@@ -693,7 +702,7 @@ function getResourceURI(name, scheme, contentType) {
if (base == null) {
base = "";
} else {
base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
base = base.substring(0, base.lastIndexOf('/') + 1) + "files/";
}
return base + name + getSuffix(contentType);
}
......@@ -701,20 +710,20 @@ function getResourceURI(name, scheme, contentType) {
function startTest() {
//
// invoke test setup
//
setUpPage();
try {
runTest();
if (builder.initializationError == null) {
setResult(null, null);
} else {
setResult("skip", builder.initializationError);
}
} catch(ex) {
if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") {
//
// invoke test setup
//
setUpPage();
try {
runTest();
if (builder.initializationError == null) {
setResult(null, null);
} else {
setResult("skip", builder.initializationError);
}
} catch(ex) {
if (typeof(ex.substring) != 'undefined' && ex.substring(0, 8) == "failure:") {
setResult("failure", ex.substring(8));
} else {
setResult("error", ex);
......@@ -774,7 +783,7 @@ function setUpPage() {
setUpPage = 'complete';
}
} catch(ex) {
catchInitializationError(builder, ex);
catchInitializationError(builder, ex);
setUpPage = 'complete';
}
}
......
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement07
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement08
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement09
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement10
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement11
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLBodyElement12
Status error
Message TypeError: Undefined value
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument01
Status failure
Message titleLink: assertEquals failed, actual null, expected NIST DOM HTML Test - DOCUMENT.
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument02
Status failure
Message referrerLink: assertEquals failed, actual null, expected .
Status Success
Test http://www.w3.org/2001/DOM-Test-Suite/level2/html/HTMLDocument03