[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198
chang.shu at nokia.com
chang.shu at nokia.com
Sun Feb 20 23:30:07 UTC 2011
The following commit has been merged in the webkit-1.3 branch:
commit a73b559f6371aa3dcea24815464cfa11dea2b8ec
Author: chang.shu at nokia.com <chang.shu at nokia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Thu Jan 20 23:57:46 2011 +0000
2011-01-20 Chang Shu <chang.shu at nokia.com>
Reviewed by Darin Adler.
setContentEditable with invalid string should throw exception.
https://bugs.webkit.org/show_bug.cgi?id=52057
Updated expected results after the fix. Also corrected test cases.
* editing/editability/set-invalid-value-expected.txt:
* editing/editability/set-invalid-value.html: 1. Fixed the getAttribute expectation as "abc" was failed to set. 2. Added additional check for setting empty string.
* editing/editability/set-value-caseinsensitive-expected.txt:
* editing/editability/set-value-caseinsensitive.html: Fixed the getAttribute expectations as all strings should be converted to lower cases.
* fast/dom/element-attribute-js-null-expected.txt:
* fast/dom/element-attribute-js-null.html: Fixed this existing test as the expectation for setting with null should throw exception instead of "false". Also added handling code when exception was thrown.
2011-01-20 Chang Shu <chang.shu at nokia.com>
Reviewed by Darin Adler.
setContentEditable with invalid string should throw exception.
https://bugs.webkit.org/show_bug.cgi?id=52057
Implemented exception throwing for setContentEditable according to the following spec:
http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#attr-contenteditable
Related quotas: "On setting, if the new value is an ASCII case-insensitive match for the
string 'inherit' then the content attribute must be removed, if the new value is an ASCII
case-insensitive match for the string 'true' then the content attribute must be set to the
string 'true', if the new value is an ASCII case-insensitive match for the string 'false'
then the content attribute must be set to the string 'false', and otherwise the attribute
setter must raise a SYNTAX_ERR exception."
* html/HTMLElement.cpp:
(WebCore::HTMLElement::setContentEditable): Throw exception on invalid input strings; Make setting values case-insensitive and also convert them to lower cases according to the spec.
* html/HTMLElement.h: Add additional parameter ExceptionCode& for function setContentEditable.
* html/HTMLElement.idl: Add exception throwing support for contentEditable setter.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76301 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index b8b2f78..67d539c 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2011-01-20 Chang Shu <chang.shu at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ setContentEditable with invalid string should throw exception.
+ https://bugs.webkit.org/show_bug.cgi?id=52057
+
+ Updated expected results after the fix. Also corrected test cases.
+
+ * editing/editability/set-invalid-value-expected.txt:
+ * editing/editability/set-invalid-value.html: 1. Fixed the getAttribute expectation as "abc" was failed to set. 2. Added additional check for setting empty string.
+ * editing/editability/set-value-caseinsensitive-expected.txt:
+ * editing/editability/set-value-caseinsensitive.html: Fixed the getAttribute expectations as all strings should be converted to lower cases.
+ * fast/dom/element-attribute-js-null-expected.txt:
+ * fast/dom/element-attribute-js-null.html: Fixed this existing test as the expectation for setting with null should throw exception instead of "false". Also added handling code when exception was thrown.
+
2011-01-20 Adrienne Walker <enne at google.com>
Reviewed by James Robinson.
diff --git a/LayoutTests/editing/editability/set-invalid-value-expected.txt b/LayoutTests/editing/editability/set-invalid-value-expected.txt
index 9349c8e..3652666 100644
--- a/LayoutTests/editing/editability/set-invalid-value-expected.txt
+++ b/LayoutTests/editing/editability/set-invalid-value-expected.txt
@@ -6,12 +6,16 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
-FAIL exceptionThrown should be true. Was false.
-FIXME: setContentEditable with invalid string should throw exception. https://bugs.webkit.org/show_bug.cgi?id=52057
-PASS document.getElementById("div").getAttribute("contentEditable") is "abc"
-FAIL document.getElementById("div").contentEditable should be true. Was inherit.
+PASS document.getElementById('div').contentEditable = 'abc' threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS document.getElementById("div").getAttribute("contentEditable") is "true"
+PASS document.getElementById("div").contentEditable is "true"
PASS document.getElementById("div").isContentEditable is true
-FAIL window.getComputedStyle(div, "").getPropertyValue("-webkit-user-modify") should be read-write. Was read-only.
+PASS window.getComputedStyle(div, "").getPropertyValue("-webkit-user-modify") is "read-write"
+PASS document.getElementById('div').contentEditable = '' threw exception Error: SYNTAX_ERR: DOM Exception 12.
+PASS document.getElementById("div").getAttribute("contentEditable") is "true"
+PASS document.getElementById("div").contentEditable is "true"
+PASS document.getElementById("div").isContentEditable is true
+PASS window.getComputedStyle(div, "").getPropertyValue("-webkit-user-modify") is "read-write"
PASS successfullyParsed is true
diff --git a/LayoutTests/editing/editability/set-invalid-value.html b/LayoutTests/editing/editability/set-invalid-value.html
index 900ac98..381d457 100644
--- a/LayoutTests/editing/editability/set-invalid-value.html
+++ b/LayoutTests/editing/editability/set-invalid-value.html
@@ -11,18 +11,14 @@
<script>
description('When contentEditable is set to invalid string, SYNTAX_ERR exception (code: 12) must be raised.')
-exceptionThrown = false;
-
-try {
- document.getElementById("div").contentEditable = "abc";
-} catch (e) {
- if (e.code == 12)
- exceptionThrown = true;
-}
+shouldThrow("document.getElementById('div').contentEditable = 'abc'", '"Error: SYNTAX_ERR: DOM Exception 12"');
+shouldBe('document.getElementById("div").getAttribute("contentEditable")','"true"');
+shouldBe('document.getElementById("div").contentEditable', '"true"');
+shouldBe('document.getElementById("div").isContentEditable', 'true');
+shouldBe('window.getComputedStyle(div, "").getPropertyValue("-webkit-user-modify")', '"read-write"');
-shouldBe('exceptionThrown', 'true');
-debug("FIXME: setContentEditable with invalid string should throw exception. https://bugs.webkit.org/show_bug.cgi?id=52057");
-shouldBe('document.getElementById("div").getAttribute("contentEditable")','"abc"');
+shouldThrow("document.getElementById('div').contentEditable = ''", '"Error: SYNTAX_ERR: DOM Exception 12"');
+shouldBe('document.getElementById("div").getAttribute("contentEditable")','"true"');
shouldBe('document.getElementById("div").contentEditable', '"true"');
shouldBe('document.getElementById("div").isContentEditable', 'true');
shouldBe('window.getComputedStyle(div, "").getPropertyValue("-webkit-user-modify")', '"read-write"');
diff --git a/LayoutTests/editing/editability/set-value-caseinsensitive-expected.txt b/LayoutTests/editing/editability/set-value-caseinsensitive-expected.txt
index 029e920..caa5162 100644
--- a/LayoutTests/editing/editability/set-value-caseinsensitive-expected.txt
+++ b/LayoutTests/editing/editability/set-value-caseinsensitive-expected.txt
@@ -8,19 +8,19 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
-PASS document.getElementById("div1").getAttribute("contentEditable") is "TRue"
+PASS document.getElementById("div1").getAttribute("contentEditable") is "true"
PASS document.getElementById("div1").contentEditable is "true"
FAIL document.getElementById("div1").isContentEditable should be true. Was false.
+FIXME: isContentEditable is not working properly. Related to https://bugs.webkit.org/show_bug.cgi?id=52058
PASS window.getComputedStyle(div1, "").getPropertyValue("-webkit-user-modify") is "read-write"
-PASS document.getElementById("p1").getAttribute("contentEditable") is "faLSE"
+PASS document.getElementById("p1").getAttribute("contentEditable") is "false"
PASS document.getElementById("p1").contentEditable is "false"
PASS document.getElementById("p1").isContentEditable is false
PASS window.getComputedStyle(p1, "").getPropertyValue("-webkit-user-modify") is "read-only"
-FAIL document.getElementById("p2").hasAttribute("contentEditable") should be false. Was true.
+PASS document.getElementById("p2").hasAttribute("contentEditable") is false
PASS document.getElementById("p2").contentEditable is "inherit"
-FAIL document.getElementById("p2").isContentEditable should be true. Was false.
-FAIL window.getComputedStyle(p2, "").getPropertyValue("-webkit-user-modify") should be read-write. Was read-only.
-FIXME: setContentEditable should be case insensitive. https://bugs.webkit.org/show_bug.cgi?id=52059
+PASS document.getElementById("p2").isContentEditable is true
+PASS window.getComputedStyle(p2, "").getPropertyValue("-webkit-user-modify") is "read-write"
PASS successfullyParsed is true
diff --git a/LayoutTests/editing/editability/set-value-caseinsensitive.html b/LayoutTests/editing/editability/set-value-caseinsensitive.html
index d7afc86..6029066 100644
--- a/LayoutTests/editing/editability/set-value-caseinsensitive.html
+++ b/LayoutTests/editing/editability/set-value-caseinsensitive.html
@@ -19,12 +19,13 @@ document.getElementById("div1").contentEditable = "TRue";
document.getElementById("p1").contentEditable = "faLSE";
document.getElementById("p2").contentEditable = "inHERIT";
-shouldBe('document.getElementById("div1").getAttribute("contentEditable")','"TRue"');
+shouldBe('document.getElementById("div1").getAttribute("contentEditable")','"true"');
shouldBe('document.getElementById("div1").contentEditable', '"true"');
shouldBe('document.getElementById("div1").isContentEditable', 'true');
+debug("FIXME: isContentEditable is not working properly. Related to https://bugs.webkit.org/show_bug.cgi?id=52058");
shouldBe('window.getComputedStyle(div1, "").getPropertyValue("-webkit-user-modify")', '"read-write"');
-shouldBe('document.getElementById("p1").getAttribute("contentEditable")','"faLSE"');
+shouldBe('document.getElementById("p1").getAttribute("contentEditable")','"false"');
shouldBe('document.getElementById("p1").contentEditable', '"false"');
shouldBe('document.getElementById("p1").isContentEditable', 'false');
shouldBe('window.getComputedStyle(p1, "").getPropertyValue("-webkit-user-modify")', '"read-only"');
@@ -34,8 +35,6 @@ shouldBe('document.getElementById("p2").contentEditable', '"inherit"');
shouldBe('document.getElementById("p2").isContentEditable', 'true');
shouldBe('window.getComputedStyle(p2, "").getPropertyValue("-webkit-user-modify")', '"read-write"');
-debug("FIXME: setContentEditable should be case insensitive. https://bugs.webkit.org/show_bug.cgi?id=52059");
-
document.getElementById("div1").style.display= 'none';
document.getElementById("p1").style.display= 'none';
document.getElementById("div2").style.display= 'none';
diff --git a/LayoutTests/fast/dom/element-attribute-js-null-expected.txt b/LayoutTests/fast/dom/element-attribute-js-null-expected.txt
index 53c015f..df58541 100644
--- a/LayoutTests/fast/dom/element-attribute-js-null-expected.txt
+++ b/LayoutTests/fast/dom/element-attribute-js-null-expected.txt
@@ -11,7 +11,7 @@ TEST SUCCEEDED: The value was the empty string. [tested HTMLElement.dir]
TEST SUCCEEDED: The value was the empty string. [tested HTMLElement.className]
TEST SUCCEEDED: The value was the empty string. [tested HTMLElement.innerHTML]
TEST SUCCEEDED: The value was the empty string. [tested HTMLElement.innerText]
-TEST FAILED: The value should have been the string 'false' but was the string 'true'. [tested HTMLElement.contentEditable]
+TEST SUCCEEDED: Exception (Error: SYNTAX_ERR: DOM Exception 12) was thrown as expected. [tested HTMLElement.contentEditable]
TEST SUCCEEDED: The value was the empty string. [tested HTMLAnchorElement.accessKey]
TEST SUCCEEDED: The value was the empty string. [tested HTMLAnchorElement.charset]
diff --git a/LayoutTests/fast/dom/element-attribute-js-null.html b/LayoutTests/fast/dom/element-attribute-js-null.html
index 437a5d2..813597d 100644
--- a/LayoutTests/fast/dom/element-attribute-js-null.html
+++ b/LayoutTests/fast/dom/element-attribute-js-null.html
@@ -26,14 +26,26 @@
function nullTestElementAttribute(elementType, element, attr, expected)
{
- element[attr] = null;
-
+ var exceptionThrown;
+ try {
+ element[attr] = null;
+ } catch (ec) {
+ exceptionThrown = ec;
+ }
var result;
- if (element[attr] === expected)
- result = "<span class='pass'>TEST SUCCEEDED:</span> The value was " + resultStringifier(expected) + ".";
- else
- result = "<span class='fail'>TEST FAILED:</span> The value should have been " + resultStringifier(expected) + " but was " + resultStringifier(element[attr]) + ".";
-
+ if (exceptionThrown) {
+ if (expected === 'exception')
+ result = "<span class='pass'>TEST SUCCEEDED:</span> Exception (" + exceptionThrown + ") was thrown as expected.";
+ else
+ result = "<span class='fail'>TEST FAILED:</span> An exception was thrown unexpectedly.";
+ } else {
+ if (expected === 'exception')
+ result = "<span class='fail'>TEST FAILED:</span> An exception should have been thrown.";
+ else if (element[attr] === expected)
+ result = "<span class='pass'>TEST SUCCEEDED:</span> The value was " + resultStringifier(expected) + ".";
+ else
+ result = "<span class='fail'>TEST FAILED:</span> The value should have been " + resultStringifier(expected) + " but was " + resultStringifier(element[attr]) + ".";
+ }
result += " [tested " + elementType + "." + attr + "]";
printOut(result);
}
@@ -57,7 +69,7 @@
attributes: [
{name: 'nodeValue', expectedNull: null},
// 'prefix' only works because this is an HTMLElement type node, if it were an
- // XML node (created using createElementNS()) this would throw an excection. We
+ // XML node (created using createElementNS()) this would throw an exception. We
// should test this further as Firefox has a different behavior.
{name: 'prefix', expectedNull: null},
{name: 'textContent', expectedNull: ''}
@@ -77,7 +89,7 @@
// FIXME: TEST THESE
// {name: 'outerHTML', expectedNull: ''},
// {name: 'outerText', expectedNull: ''},
- {name: 'contentEditable', expectedNull: 'false'}
+ {name: 'contentEditable', expectedNull: 'exception'}
]
},
{
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index fe29eb6..60c7c97 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,24 @@
+2011-01-20 Chang Shu <chang.shu at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ setContentEditable with invalid string should throw exception.
+ https://bugs.webkit.org/show_bug.cgi?id=52057
+
+ Implemented exception throwing for setContentEditable according to the following spec:
+ http://www.whatwg.org/specs/web-apps/current-work/multipage/editing.html#attr-contenteditable
+ Related quotas: "On setting, if the new value is an ASCII case-insensitive match for the
+ string 'inherit' then the content attribute must be removed, if the new value is an ASCII
+ case-insensitive match for the string 'true' then the content attribute must be set to the
+ string 'true', if the new value is an ASCII case-insensitive match for the string 'false'
+ then the content attribute must be set to the string 'false', and otherwise the attribute
+ setter must raise a SYNTAX_ERR exception."
+
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::setContentEditable): Throw exception on invalid input strings; Make setting values case-insensitive and also convert them to lower cases according to the spec.
+ * html/HTMLElement.h: Add additional parameter ExceptionCode& for function setContentEditable.
+ * html/HTMLElement.idl: Add exception throwing support for contentEditable setter.
+
2011-01-19 Adrienne Walker <enne at google.com>
Reviewed by James Robinson.
diff --git a/Source/WebCore/html/HTMLElement.cpp b/Source/WebCore/html/HTMLElement.cpp
index 9ba7678..b7eca06 100644
--- a/Source/WebCore/html/HTMLElement.cpp
+++ b/Source/WebCore/html/HTMLElement.cpp
@@ -729,14 +729,16 @@ void HTMLElement::setContentEditable(Attribute* attr)
}
}
-void HTMLElement::setContentEditable(const String &enabled)
+void HTMLElement::setContentEditable(const String& enabled, ExceptionCode& ec)
{
- if (enabled == "inherit") {
- ExceptionCode ec;
+ if (equalIgnoringCase(enabled, "true"))
+ setAttribute(contenteditableAttr, "true", ec);
+ else if (equalIgnoringCase(enabled, "false"))
+ setAttribute(contenteditableAttr, "false", ec);
+ else if (equalIgnoringCase(enabled, "inherit"))
removeAttribute(contenteditableAttr, ec);
- }
else
- setAttribute(contenteditableAttr, enabled.isEmpty() ? "true" : enabled);
+ ec = SYNTAX_ERR;
}
bool HTMLElement::draggable() const
diff --git a/Source/WebCore/html/HTMLElement.h b/Source/WebCore/html/HTMLElement.h
index 3356bab..ad84f5d 100644
--- a/Source/WebCore/html/HTMLElement.h
+++ b/Source/WebCore/html/HTMLElement.h
@@ -61,7 +61,7 @@ public:
virtual bool isContentRichlyEditable() const;
String contentEditable() const;
- void setContentEditable(const String&);
+ void setContentEditable(const String&, ExceptionCode&);
virtual bool draggable() const;
void setDraggable(bool);
diff --git a/Source/WebCore/html/HTMLElement.idl b/Source/WebCore/html/HTMLElement.idl
index 77423fc..cd400c4 100644
--- a/Source/WebCore/html/HTMLElement.idl
+++ b/Source/WebCore/html/HTMLElement.idl
@@ -59,7 +59,8 @@ module html {
readonly attribute HTMLCollection children;
- attribute [ConvertNullToNullString] DOMString contentEditable;
+ attribute [ConvertNullToNullString] DOMString contentEditable
+ setter raises(DOMException);
readonly attribute boolean isContentEditable;
attribute boolean spellcheck;
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list