Commit 88d5ca47 authored by ap's avatar ap

Reviewed by Rob (yay!).

        http://bugs.webkit.org/show_bug.cgi?id=11640
        XMLHttpRequest produces undefined:undefined HTTP authentication

WebCore:
        * bindings/js/JSXMLHttpRequest.cpp:
        (KJS::JSXMLHttpRequestProtoFunc::callAsFunction):
        Treat undefined credentials as missing ones.

LayoutTests:
        * http/tests/xmlhttprequest/basic-auth-expected.txt:
        * http/tests/xmlhttprequest/basic-auth.html:
        Added tests for undefined.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@17842 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3677cb06
2006-11-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Rob (yay!).
http://bugs.webkit.org/show_bug.cgi?id=11640
XMLHttpRequest produces undefined:undefined HTTP authentication
* http/tests/xmlhttprequest/basic-auth-expected.txt:
* http/tests/xmlhttprequest/basic-auth.html:
Added tests for undefined.
2006-11-17 Justin Garcia <justin.garcia@apple.com>
Reviewed by harrison
Tests for bug 7877: XMLHttpRequest ignores username/password passed to open()
Tests for XMLHttpRequest authentication.
sync: User: sync, password: 123.
sync2: User: sync2, password: 123.
sync3: User: sync3, password: 123.
sync4: User: sync4, password: 123.
sync5: User: sync5, password: 123.
sync6: User: sync6, password: 123.
sync7: User: sync7, password: 123.
async: User: async, password: 123.
async2: User: async2, password: 123.
async3: User: async3, password: 123.
async4: User: async4, password: 123.
async5: User: async5, password: 123.
async6: User: async6, password: 123.
async7: User: async7, password: 123.
<html>
<body>
<p>Tests for <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=7877">bug 7877</a>:
XMLHttpRequest ignores username/password passed to open()
<p>Tests for XMLHttpRequest authentication.
<script>
if (window.layoutTestController) {
layoutTestController.dumpAsText();
......@@ -36,6 +35,18 @@ XMLHttpRequest ignores username/password passed to open()
req.send("");
log('sync4: ' + req.responseText);
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync5").replace("http://", "http://sync5:123@"), false, undefined, undefined);
req.send("");
log('sync5: ' + req.responseText);
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync6").replace("http://", "http://sync6:123@"), false, undefined);
req.send("");
log('sync6: ' + req.responseText);
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=sync7").replace("http://", "http://sync7:123@"), false, undefined, "incorrect");
req.send("");
log('sync7: ' + req.responseText);
// async
var asyncStep = 1;
......@@ -66,7 +77,25 @@ XMLHttpRequest ignores username/password passed to open()
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async4").replace("http://", "http://incorrect:incorrect@"), true, "async4", "123");
req.send("");
} else if (asyncStep == 4) {
asyncStep = 5;
log('async4: ' + req.responseText);
req.onreadystatechange = processStateChange;
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async5").replace("http://", "http://async5:123@"), true, undefined, undefined);
req.send("");
} else if (asyncStep == 5) {
asyncStep = 6;
log('async5: ' + req.responseText);
req.onreadystatechange = processStateChange;
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async6").replace("http://", "http://async6:123@"), true, undefined);
req.send("");
} else if (asyncStep == 6) {
asyncStep = 7;
log('async6: ' + req.responseText);
req.onreadystatechange = processStateChange;
req.open("GET", document.URL.replace("basic-auth.html", "resources/basic-auth.php?uid=async7").replace("http://", "http://async7:123@"), true, undefined, "incorrect");
req.send("");
} else if (asyncStep == 7) {
log('async7: ' + req.responseText);
if (window.layoutTestController)
layoutTestController.notifyDone();
}
......
2006-11-18 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Rob (yay!).
http://bugs.webkit.org/show_bug.cgi?id=11640
XMLHttpRequest produces undefined:undefined HTTP authentication
* bindings/js/JSXMLHttpRequest.cpp:
(KJS::JSXMLHttpRequestProtoFunc::callAsFunction):
Treat undefined credentials as missing ones.
2006-11-17 Lars Naesbye Christensen <larsnaesbye@stud.ku.dk>
Reviewed by Tim H.
......@@ -205,12 +205,13 @@ JSValue* JSXMLHttpRequestProtoFunc::callAsFunction(ExecState* exec, JSObject* th
async = args[2]->toBoolean(exec);
String user;
if (args.size() >= 4)
String password;
if (args.size() >= 4 && !args[3]->isUndefined()) {
user = args[3]->toString(exec);
String password;
if (args.size() >= 5)
password = args[4]->toString(exec);
if (args.size() >= 5 && !args[4]->isUndefined())
password = args[4]->toString(exec);
}
request->m_impl->open(method, url, async, user, password, ec);
setDOMException(exec, ec);
......
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