[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 18:19:38 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit e06098776e59223a29b41e3a01427928b489eb2c
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Mar 5 05:35:39 2010 +0000
2010-03-04 MORITA Hajime <morrita at google.com>
Reviewed by Alexey Proskuryakov.
Refactoring: XMLHTTPRequest.open() should have all overloaded implementations
https://bugs.webkit.org/show_bug.cgi?id=35630
* http/tests/xmlhttprequest/open-async-overload-expected.txt: Added.
* http/tests/xmlhttprequest/open-async-overload.html: Added.
2010-03-04 MORITA Hajime <morrita at google.com>
Reviewed by Alexey Proskuryakov.
Refactoring: XMLHTTPRequest.open() should have all overloaded implementations
https://bugs.webkit.org/show_bug.cgi?id=35630
Test: http/tests/xmlhttprequest/open-async-overload.html
* bindings/js/JSXMLHttpRequestCustom.cpp:
(WebCore::JSXMLHttpRequest::open):
* bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
(WebCore::V8XMLHttpRequest::openCallback):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::open):
* xml/XMLHttpRequest.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55569 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 86f7c85..ff7573a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-04 MORITA Hajime <morrita at google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Refactoring: XMLHTTPRequest.open() should have all overloaded implementations
+ https://bugs.webkit.org/show_bug.cgi?id=35630
+
+ * http/tests/xmlhttprequest/open-async-overload-expected.txt: Added.
+ * http/tests/xmlhttprequest/open-async-overload.html: Added.
+
2010-03-04 Tony Chang <tony at chromium.org>
Reviewed by Eric Seidel.
diff --git a/LayoutTests/http/tests/xmlhttprequest/open-async-overload-expected.txt b/LayoutTests/http/tests/xmlhttprequest/open-async-overload-expected.txt
new file mode 100644
index 0000000..bbe8534
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/open-async-overload-expected.txt
@@ -0,0 +1,7 @@
+XMLHttpRequest.open() should be correctly overloaded
+
+PASS: if async argument is true, send() should behave asynchronously
+PASS: if async argument is false, send() should behave synchronously
+PASS: if async argument is not given, send() should behave like as async=true
+PASS: if async argument is undefined, send() should behave like as async=false
+PASS: if async argument is a non-empty string, send() should behave like as async=true
diff --git a/LayoutTests/http/tests/xmlhttprequest/open-async-overload.html b/LayoutTests/http/tests/xmlhttprequest/open-async-overload.html
new file mode 100644
index 0000000..f4952d3
--- /dev/null
+++ b/LayoutTests/http/tests/xmlhttprequest/open-async-overload.html
@@ -0,0 +1,53 @@
+<html>
+<body>
+<p>XMLHttpRequest.open() should be correctly overloaded</p>
+<script>
+
+ var console_messages = document.createElement("ol");
+ document.body.appendChild(console_messages);
+
+ function log(message)
+ {
+ var item = document.createElement("li");
+ item.appendChild(document.createTextNode(message));
+ console_messages.appendChild(item);
+ }
+
+ function shouldSendBehaveAs(req, async, description)
+ {
+ var expectedState = async ? 1 : 4;
+
+ req.send();
+
+ if (req.readyState == expectedState)
+ log("PASS: " + description);
+ else
+ log("FAIL: " + description + " (expected:" + expectedState + ", actual:" + req.readyState +")");
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ req = new XMLHttpRequest();
+ req.open("GET", "methods.cgi", true);
+ shouldSendBehaveAs(req, true, "if async argument is true, send() should behave asynchronously");
+
+ req = new XMLHttpRequest();
+ req.open("GET", "methods.cgi", false);
+ shouldSendBehaveAs(req, false, "if async argument is false, send() should behave synchronously");
+
+ req = new XMLHttpRequest();
+ req.open("GET", "methods.cgi");
+ shouldSendBehaveAs(req, true, "if async argument is not given, send() should behave like as async=true");
+
+ req = new XMLHttpRequest();
+ req.open("GET", "methods.cgi", undefined);
+ shouldSendBehaveAs(req, false, "if async argument is undefined, send() should behave like as async=false");
+
+ req = new XMLHttpRequest();
+ req.open("GET", "methods.cgi", "OK");
+ shouldSendBehaveAs(req, true, "if async argument is a non-empty string, send() should behave like as async=true");
+
+</script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index c4ce613..32d1585 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,20 @@
+2010-03-04 MORITA Hajime <morrita at google.com>
+
+ Reviewed by Alexey Proskuryakov.
+
+ Refactoring: XMLHTTPRequest.open() should have all overloaded implementations
+ https://bugs.webkit.org/show_bug.cgi?id=35630
+
+ Test: http/tests/xmlhttprequest/open-async-overload.html
+
+ * bindings/js/JSXMLHttpRequestCustom.cpp:
+ (WebCore::JSXMLHttpRequest::open):
+ * bindings/v8/custom/V8XMLHttpRequestCustom.cpp:
+ (WebCore::V8XMLHttpRequest::openCallback):
+ * xml/XMLHttpRequest.cpp:
+ (WebCore::XMLHttpRequest::open):
+ * xml/XMLHttpRequest.h:
+
2010-03-04 James Robinson <jamesr at google.com>
Reviewed by Eric Seidel.
diff --git a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
index e20b6d9..684de91 100644
--- a/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/js/JSXMLHttpRequestCustom.cpp
@@ -67,21 +67,23 @@ JSValue JSXMLHttpRequest::open(ExecState* exec, const ArgList& args)
const KURL& url = impl()->scriptExecutionContext()->completeURL(args.at(1).toString(exec));
String method = args.at(0).toString(exec);
- bool async = true;
- if (args.size() >= 3)
- async = args.at(2).toBoolean(exec);
ExceptionCode ec = 0;
- if (args.size() >= 4 && !args.at(3).isUndefined()) {
- String user = valueToStringWithNullCheck(exec, args.at(3));
-
- if (args.size() >= 5 && !args.at(4).isUndefined()) {
- String password = valueToStringWithNullCheck(exec, args.at(4));
- impl()->open(method, url, async, user, password, ec);
+ if (args.size() >= 3) {
+ bool async = args.at(2).toBoolean(exec);
+
+ if (args.size() >= 4 && !args.at(3).isUndefined()) {
+ String user = valueToStringWithNullCheck(exec, args.at(3));
+
+ if (args.size() >= 5 && !args.at(4).isUndefined()) {
+ String password = valueToStringWithNullCheck(exec, args.at(4));
+ impl()->open(method, url, async, user, password, ec);
+ } else
+ impl()->open(method, url, async, user, ec);
} else
- impl()->open(method, url, async, user, ec);
+ impl()->open(method, url, async, ec);
} else
- impl()->open(method, url, async, ec);
+ impl()->open(method, url, ec);
setDOMException(exec, ec);
return jsUndefined();
diff --git a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
index a6a0c98..dce2d21 100644
--- a/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8XMLHttpRequestCustom.cpp
@@ -73,20 +73,23 @@ v8::Handle<v8::Value> V8XMLHttpRequest::openCallback(const v8::Arguments& args)
KURL url = context->completeURL(urlstring);
- bool async = (args.Length() < 3) ? true : args[2]->BooleanValue();
-
ExceptionCode ec = 0;
- String user, passwd;
- if (args.Length() >= 4 && !args[3]->IsUndefined()) {
- user = toWebCoreStringWithNullCheck(args[3]);
- if (args.Length() >= 5 && !args[4]->IsUndefined()) {
- passwd = toWebCoreStringWithNullCheck(args[4]);
- xmlHttpRequest->open(method, url, async, user, passwd, ec);
+ if (args.Length() >= 3) {
+ bool async = args[2]->BooleanValue();
+
+ if (args.Length() >= 4 && !args[3]->IsUndefined()) {
+ String user = toWebCoreStringWithNullCheck(args[3]);
+
+ if (args.Length() >= 5 && !args[4]->IsUndefined()) {
+ String passwd = toWebCoreStringWithNullCheck(args[4]);
+ xmlHttpRequest->open(method, url, async, user, passwd, ec);
+ } else
+ xmlHttpRequest->open(method, url, async, user, ec);
} else
- xmlHttpRequest->open(method, url, async, user, ec);
+ xmlHttpRequest->open(method, url, async, ec);
} else
- xmlHttpRequest->open(method, url, async, ec);
+ xmlHttpRequest->open(method, url, ec);
if (ec)
return throwError(ec);
diff --git a/WebCore/xml/XMLHttpRequest.cpp b/WebCore/xml/XMLHttpRequest.cpp
index 32818df..0e04ccb 100644
--- a/WebCore/xml/XMLHttpRequest.cpp
+++ b/WebCore/xml/XMLHttpRequest.cpp
@@ -292,6 +292,11 @@ void XMLHttpRequest::setWithCredentials(bool value, ExceptionCode& ec)
m_includeCredentials = value;
}
+void XMLHttpRequest::open(const String& method, const KURL& url, ExceptionCode& ec)
+{
+ open(method, url, true, ec);
+}
+
void XMLHttpRequest::open(const String& method, const KURL& url, bool async, ExceptionCode& ec)
{
internalAbort();
diff --git a/WebCore/xml/XMLHttpRequest.h b/WebCore/xml/XMLHttpRequest.h
index 2cea5c6..5e47d41 100644
--- a/WebCore/xml/XMLHttpRequest.h
+++ b/WebCore/xml/XMLHttpRequest.h
@@ -66,6 +66,7 @@ public:
State readyState() const;
bool withCredentials() const { return m_includeCredentials; }
void setWithCredentials(bool, ExceptionCode&);
+ void open(const String& method, const KURL&, ExceptionCode&);
void open(const String& method, const KURL&, bool async, ExceptionCode&);
void open(const String& method, const KURL&, bool async, const String& user, ExceptionCode&);
void open(const String& method, const KURL&, bool async, const String& user, const String& password, ExceptionCode&);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list