[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 14:14:20 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3835ae38723b7f6a75d09822359367390ad26378
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Oct 5 20:13:46 2010 +0000
2010-10-05 Daniel Cheng <dcheng at chromium.org>
Reviewed by Tony Chang.
[chromium] getData('text/uri-list') should return the same thing that was passed to setData('text/uri-list')
https://bugs.webkit.org/show_bug.cgi?id=46943
Update the layout test to check that getData('text/uri-list') returns
the same thing that was passed to setData('text/uri-list').
* editing/pasteboard/dataTransfer-setData-getData-expected.txt:
* editing/pasteboard/script-tests/dataTransfer-setData-getData.js:
(doDrop):
(test):
(runTest):
* fast/js/resources/js-test-pre.js:
(shouldBeEqualToString): Updated to allow '\n' and '\r' in expected argument.
2010-10-05 Daniel Cheng <dcheng at chromium.org>
Reviewed by Tony Chang.
[chromium] getData('text/uri-list') should return the same thing that was passed to setData('text/uri-list')
https://bugs.webkit.org/show_bug.cgi?id=46943
We no longer parse the input of setData('text/uri-list') and only store
the valid URLs that were parsed out.
Test: editing/pasteboard/dataTransfer-setData-getData.html
* platform/chromium/ChromiumDataObject.cpp:
(WebCore::ChromiumDataObject::clearData):
(WebCore::ChromiumDataObject::clearAllExceptFiles):
(WebCore::ChromiumDataObject::types):
(WebCore::ChromiumDataObject::getData):
(WebCore::ChromiumDataObject::setData):
* platform/chromium/ChromiumDataObject.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69138 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index dfc28cc..4032476 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-10-05 Daniel Cheng <dcheng at chromium.org>
+
+ Reviewed by Tony Chang.
+
+ [chromium] getData('text/uri-list') should return the same thing that was passed to setData('text/uri-list')
+ https://bugs.webkit.org/show_bug.cgi?id=46943
+
+ Update the layout test to check that getData('text/uri-list') returns
+ the same thing that was passed to setData('text/uri-list').
+
+ * editing/pasteboard/dataTransfer-setData-getData-expected.txt:
+ * editing/pasteboard/script-tests/dataTransfer-setData-getData.js:
+ (doDrop):
+ (test):
+ (runTest):
+ * fast/js/resources/js-test-pre.js:
+ (shouldBeEqualToString): Updated to allow '\n' and '\r' in expected argument.
+
2010-10-05 David Hyatt <hyatt at apple.com>
Reviewed by Anders Carlsson.
diff --git a/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt b/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt
index 063a6bb..9e58298 100644
--- a/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt
+++ b/LayoutTests/editing/pasteboard/dataTransfer-setData-getData-expected.txt
@@ -5,30 +5,38 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
--- Test set/get 'URL':
PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
+--- Test set/get 'URL' with multiple URLs:
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com/"
--- Test set/get 'text/uri-list':
PASS getDataResultType is "string"
-PASS getDataLines.length is 2
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
-PASS getDataLines[1].replace(/\/$/, '') is "http://check.com"
+PASS getDataResult is "http://test.com\r\nhttp://check.com"
+--- Test set/get 'text/uri-list' using '\n':
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com\nhttp://check.com"
--- Test set 'text/uri-list', get 'URL':
PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
+--- Test set 'URL', get 'text/uri-list':
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com\r\nhttp://check.com"
--- Test set 'text/uri-list', get 'URL', using only '\n':
PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
+PASS getDataResult is "http://test.com/"
--- Test set/get 'text/uri-list' with comments:
PASS getDataResultType is "string"
-PASS getDataLines.length is 2
-PASS getDataLines[0].replace(/\/$/, '') is "http://test.com"
-PASS getDataLines[1].replace(/\/$/, '') is "http://check.com"
+PASS getDataResult is "# comment\r\nhttp://test.com\r\nhttp://check.com"
+--- Test set 'text/uri-list', get 'URL' with comments:
+PASS getDataResultType is "string"
+PASS getDataResult is "http://test.com/"
+--- Test set 'text/uri-list', get 'URL' with only comments:
+FAIL getDataResultType should be string. Was undefined.
+FAIL getDataResult should be (of type string). Was undefined (of type undefined).
--- Test set/get 'text/plain':
PASS getDataResultType is "string"
-PASS getDataLines.length is 1
-PASS getDataLines[0].replace(/\/$/, '') is "Lorem ipsum dolor sit amet."
+PASS getDataResult is "Lorem ipsum dolor sit amet."
PASS successfullyParsed is true
TEST COMPLETE
+
diff --git a/LayoutTests/editing/pasteboard/script-tests/dataTransfer-setData-getData.js b/LayoutTests/editing/pasteboard/script-tests/dataTransfer-setData-getData.js
index f10d785..8d23251 100644
--- a/LayoutTests/editing/pasteboard/script-tests/dataTransfer-setData-getData.js
+++ b/LayoutTests/editing/pasteboard/script-tests/dataTransfer-setData-getData.js
@@ -12,17 +12,15 @@ dragTarget.style.height = "100px";
document.body.insertBefore(dragTarget, dragMe);
var setDataType;
-var setDataValues;
+var setDataValue;
var getDataType;
-var getDataValues;
+var getDataValue;
var getDataResult;
var getDataResultType;
var getDataLines;
-var CRLF = "\r\n";
-
dragMe.addEventListener("dragstart", function() {
- event.dataTransfer.setData(setDataType, setDataValues.join(CRLF));
+ event.dataTransfer.setData(setDataType, setDataValue);
}, false);
dragTarget.addEventListener("dragenter", function() {
@@ -62,51 +60,63 @@ function dragOntoDragTarget() {
function doDrop() {
getDataResult = event.dataTransfer.getData(getDataType);
getDataResultType = typeof getDataResult;
- shouldBeEqualToString("getDataResultType", "string");
- getDataLines = getDataResult.split(CRLF);
- // remove potential comments
- getDataLines = getDataLines.filter(function(line) {
- return line[0] !== '#';
- });
- shouldEvaluateTo("getDataLines.length", getDataValues.length);
- for (i = 0; i < getDataLines.length && i < getDataValues.length; ++i) {
- shouldBeEqualToString("getDataLines[" + i + "].replace(/\\/$/, '')", getDataValues[i]);
- }
+ shouldBeEqualToString("getDataResultType", typeof getDataValue);
+ shouldBeEqualToString("getDataResult", getDataValue);
}
function test(setType, setValues, getType, getValues) {
setDataType = setType;
- setDataValues = setValues;
+ setDataValue = setValues;
getDataType = getType;
- getDataValues = getValues;
+ getDataValue = getValues;
dragOntoDragTarget();
}
function runTest()
{
debug("--- Test set/get 'URL':");
- test("URL", ["http://test.com"],
- "URL", ["http://test.com"]);
+ test("URL", "http://test.com",
+ "URL", "http://test.com/");
+
+ debug("--- Test set/get 'URL' with multiple URLs:");
+ test("URL", "http://test.com\r\nhttp://check.com",
+ "URL", "http://test.com/");
debug("--- Test set/get 'text/uri-list':");
- test("text/uri-list", ["http://test.com", "http://check.com"],
- "text/uri-list", ["http://test.com", "http://check.com"]);
+ test("text/uri-list", "http://test.com\r\nhttp://check.com",
+ "text/uri-list", "http://test.com\r\nhttp://check.com");
+
+ debug("--- Test set/get 'text/uri-list' using '\\n':");
+ test("text/uri-list", "http://test.com\nhttp://check.com",
+ "text/uri-list", "http://test.com\nhttp://check.com");
debug("--- Test set 'text/uri-list', get 'URL':");
- test("text/uri-list", ["http://test.com", "http://check.com"],
- "URL", ["http://test.com"]);
+ test("text/uri-list", "http://test.com\r\nhttp://check.com",
+ "URL", "http://test.com/");
+
+ debug("--- Test set 'URL', get 'text/uri-list':");
+ test("URL", "http://test.com\r\nhttp://check.com",
+ "text/uri-list", "http://test.com\r\nhttp://check.com");
debug("--- Test set 'text/uri-list', get 'URL', using only '\\n':");
- test("text/uri-list", ["http://test.com\nhttp://check.com"],
- "URL", ["http://test.com"]);
+ test("text/uri-list", "http://test.com\nhttp://check.com",
+ "URL", "http://test.com/");
debug("--- Test set/get 'text/uri-list' with comments:");
- test("text/uri-list", ["# comment", "http://test.com", "http://check.com"],
- "text/uri-list", ["http://test.com", "http://check.com"]);
+ test("text/uri-list", "# comment\r\nhttp://test.com\r\nhttp://check.com",
+ "text/uri-list", "# comment\r\nhttp://test.com\r\nhttp://check.com");
+
+ debug("--- Test set 'text/uri-list', get 'URL' with comments:");
+ test("text/uri-list", "# comment\r\nhttp://test.com\r\nhttp://check.com",
+ "URL", "http://test.com/");
+
+ debug("--- Test set 'text/uri-list', get 'URL' with only comments:");
+ test("text/uri-list", "# comment\r\n# comment 2\r\n# comment 3",
+ "URL", "");
debug("--- Test set/get 'text/plain':");
- test("text/plain", ["Lorem ipsum dolor sit amet."],
- "text/plain", ["Lorem ipsum dolor sit amet."]);
+ test("text/plain", "Lorem ipsum dolor sit amet.",
+ "text/plain", "Lorem ipsum dolor sit amet.");
}
if (window.eventSender) {
diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js
index 87db5d4..3536a89 100644
--- a/LayoutTests/fast/js/resources/js-test-pre.js
+++ b/LayoutTests/fast/js/resources/js-test-pre.js
@@ -124,7 +124,7 @@ function shouldBeNull(_a) { shouldBe(_a, "null"); }
function shouldBeEqualToString(a, b)
{
- var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"") + '"';
+ var unevaledString = '"' + b.replace(/\\/g, "\\\\").replace(/"/g, "\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r") + '"';
shouldBe(a, unevaledString);
}
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 09e96e9..742f369 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-10-05 Daniel Cheng <dcheng at chromium.org>
+
+ Reviewed by Tony Chang.
+
+ [chromium] getData('text/uri-list') should return the same thing that was passed to setData('text/uri-list')
+ https://bugs.webkit.org/show_bug.cgi?id=46943
+
+ We no longer parse the input of setData('text/uri-list') and only store
+ the valid URLs that were parsed out.
+
+ Test: editing/pasteboard/dataTransfer-setData-getData.html
+
+ * platform/chromium/ChromiumDataObject.cpp:
+ (WebCore::ChromiumDataObject::clearData):
+ (WebCore::ChromiumDataObject::clearAllExceptFiles):
+ (WebCore::ChromiumDataObject::types):
+ (WebCore::ChromiumDataObject::getData):
+ (WebCore::ChromiumDataObject::setData):
+ * platform/chromium/ChromiumDataObject.h:
+
2010-10-05 Martin Robinson <mrobinson at igalia.com>
Reviewed by Xan Lopez.
diff --git a/WebCore/platform/chromium/ChromiumDataObject.cpp b/WebCore/platform/chromium/ChromiumDataObject.cpp
index c579cec..73e6f48 100644
--- a/WebCore/platform/chromium/ChromiumDataObject.cpp
+++ b/WebCore/platform/chromium/ChromiumDataObject.cpp
@@ -48,7 +48,7 @@ void ChromiumDataObject::clearData(const String& type)
}
if (type == mimeTypeURL || type == mimeTypeTextURIList) {
- m_uriList.clear();
+ m_uriList = "";
m_url = KURL();
m_urlTitle = "";
return;
@@ -76,7 +76,7 @@ void ChromiumDataObject::clearAllExceptFiles()
{
m_urlTitle = "";
m_url = KURL();
- m_uriList.clear();
+ m_uriList = "";
m_downloadMetadata = "";
m_fileExtension = "";
m_plainText = "";
@@ -109,10 +109,11 @@ HashSet<String> ChromiumDataObject::types() const
results.add(mimeTypeTextPlain);
}
- if (!m_url.isEmpty()) {
+ if (m_url.isValid())
results.add(mimeTypeURL);
+
+ if (!m_uriList.isEmpty())
results.add(mimeTypeTextURIList);
- }
if (!m_textHtml.isEmpty())
results.add(mimeTypeTextHTML);
@@ -140,24 +141,13 @@ String ChromiumDataObject::getData(const String& type, bool& success)
}
if (type == mimeTypeURL) {
- ASSERT(m_url.isEmpty() == m_uriList.isEmpty());
success = !m_url.isEmpty();
return m_url.string();
}
if (type == mimeTypeTextURIList) {
- ASSERT(m_url.isEmpty() == m_uriList.isEmpty());
- if (m_uriList.isEmpty()) {
- success = false;
- return "";
- }
- String uriListString(m_uriList[0]);
- for (size_t i = 1; i < m_uriList.size(); i++) {
- uriListString.append(textMIMETypeLineSeparator);
- uriListString.append(m_uriList[i]);
- }
- success = true;
- return uriListString;
+ success = !m_uriList.isEmpty();
+ return m_uriList;
}
if (type == mimeTypeTextHTML) {
@@ -194,34 +184,29 @@ bool ChromiumDataObject::setData(const String& type, const String& data)
if (type == mimeTypeURL || type == mimeTypeTextURIList) {
m_url = KURL();
- // Line separator is \r\n per RFC 2483 - however, for compatibility reasons
- // we also allow just \n here.
- data.split('\n', m_uriList);
- // Strip white space on all lines, including trailing \r from above split.
- // If this leaves a line empty, remove it completely.
- //
- // Also, copy the first valid URL into the 'url' member as well.
- // In case no entry is a valid URL (i.e., remarks only), then we leave 'url' empty.
- // I.e., in that case subsequent calls to getData("URL") will get an empty string.
- // This is in line with the HTML5 spec (see "The DragEvent and DataTransfer interfaces").
- for (size_t i = 0; i < m_uriList.size(); /**/) {
- String& line = m_uriList[i];
+ Vector<String> uriList;
+ // Line separator is \r\n per RFC 2483 - however, for compatibility
+ // reasons we also allow just \n here.
+ data.split('\n', uriList);
+ // Process the input and copy the first valid URL into the url member.
+ // In case no URLs can be found, subsequent calls to getData("URL")
+ // will get an empty string. This is in line with the HTML5 spec (see
+ // "The DragEvent and DataTransfer interfaces").
+ for (size_t i = 0; i < uriList.size(); ++i) {
+ String& line = uriList[i];
line = line.stripWhiteSpace();
if (line.isEmpty()) {
- m_uriList.remove(i);
continue;
}
- ++i;
- // Only copy the first valid URL.
- if (m_url.isValid())
- continue;
if (line[0] == '#')
continue;
KURL url = KURL(ParsedURLString, line);
- if (url.isValid())
+ if (url.isValid()) {
m_url = url;
+ break;
+ }
}
- ASSERT(m_url.isEmpty() == m_uriList.isEmpty());
+ m_uriList = data;
return true;
}
diff --git a/WebCore/platform/chromium/ChromiumDataObject.h b/WebCore/platform/chromium/ChromiumDataObject.h
index 1562422..cd58ecb 100644
--- a/WebCore/platform/chromium/ChromiumDataObject.h
+++ b/WebCore/platform/chromium/ChromiumDataObject.h
@@ -111,7 +111,7 @@ namespace WebCore {
// string value; setting m_uriList will cause its contents to be parsed
// according to RFC 2483 and the first URL found will be set in m_url.
KURL m_url;
- Vector<String> m_uriList;
+ String m_uriList;
};
} // namespace WebCore
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list