Title: [125718] trunk/Source/WebCore
Revision
125718
Author
[email protected]
Date
2012-08-15 15:42:52 -0700 (Wed, 15 Aug 2012)

Log Message

[BlackBerry] Show custom error page when 407 is received
https://bugs.webkit.org/show_bug.cgi?id=94138

 Reviewed by George Staikos.
 Internally reviewed by Lianghui Chen

 Adding a new custom error page when the browser receieves
 a Wifi proxy authentication error. The previous behaviour
 is to ask for user credentials everytime, and silently fails
 when the username and password fields in the Wifi settings
 are not empty. UX suggests modifying the behaviour to simply
 asks the user to change their credentials in the Wifi settings
 when we receive such an error.

 The fix is to prevent notifyAuthReceived from sending another
 networkjob when authCallbacks are called, and to listen to any 407
 calls in notifyStatusReceived. Once we hit a 407, tell the frame we
 failed and should load the custom error page.

 Also removed checking functions in sendRequestWithCredentials because
 proxy auth requests won't get into that function anymore.

 #PR163400

 Tested by loading on device and loading/reloading pages under
 these scenarios:
 - Connected to wifi (no proxy)
 - Connected to wifi (proxy with no credentials)
 - Connected to wifi (proxy with invalid credentials)
 - Connected to wifi (proxy with valid credentials)

 * platform/network/blackberry/NetworkJob.cpp:
 (WebCore::NetworkJob::handleNotifyStatusReceived):
 (WebCore::NetworkJob::notifyAuthReceived):
 (WebCore::NetworkJob::sendRequestWithCredentials):

Patch by Otto Derek Cheung <[email protected]> on 2012-08-15

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (125717 => 125718)


--- trunk/Source/WebCore/ChangeLog	2012-08-15 22:37:00 UTC (rev 125717)
+++ trunk/Source/WebCore/ChangeLog	2012-08-15 22:42:52 UTC (rev 125718)
@@ -1,3 +1,41 @@
+2012-08-15  Otto Derek Cheung  <[email protected]>
+
+        [BlackBerry] Show custom error page when 407 is received
+        https://bugs.webkit.org/show_bug.cgi?id=94138
+
+         Reviewed by George Staikos.
+         Internally reviewed by Lianghui Chen
+
+         Adding a new custom error page when the browser receieves
+         a Wifi proxy authentication error. The previous behaviour
+         is to ask for user credentials everytime, and silently fails
+         when the username and password fields in the Wifi settings
+         are not empty. UX suggests modifying the behaviour to simply
+         asks the user to change their credentials in the Wifi settings
+         when we receive such an error.
+
+         The fix is to prevent notifyAuthReceived from sending another
+         networkjob when authCallbacks are called, and to listen to any 407
+         calls in notifyStatusReceived. Once we hit a 407, tell the frame we
+         failed and should load the custom error page.
+
+         Also removed checking functions in sendRequestWithCredentials because
+         proxy auth requests won't get into that function anymore.
+
+         #PR163400
+
+         Tested by loading on device and loading/reloading pages under
+         these scenarios:
+         - Connected to wifi (no proxy)
+         - Connected to wifi (proxy with no credentials)
+         - Connected to wifi (proxy with invalid credentials)
+         - Connected to wifi (proxy with valid credentials)
+
+         * platform/network/blackberry/NetworkJob.cpp:
+         (WebCore::NetworkJob::handleNotifyStatusReceived):
+         (WebCore::NetworkJob::notifyAuthReceived):
+         (WebCore::NetworkJob::sendRequestWithCredentials):
+
 2012-08-15  Dan Carney  <[email protected]>
 
         Refactor away IsolatedWorld

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp (125717 => 125718)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-08-15 22:37:00 UTC (rev 125717)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-08-15 22:42:52 UTC (rev 125718)
@@ -173,6 +173,12 @@
     if (isInfo(status))
         return; // ignore
 
+    // Load up error page and ask the user to change their wireless proxy settings
+    if (status == 407) {
+        const ResourceError error = ResourceError(ResourceError::httpErrorDomain, BlackBerry::Platform::FilterStream::StatusWifiProxyAuthError, m_response.url().string(), emptyString());
+        m_handle->client()->didFail(m_handle.get(), error);
+    }
+
     m_statusReceived = true;
 
     // Convert non-HTTP status codes to generic HTTP codes.
@@ -277,9 +283,9 @@
         }
         storeCredentials();
         return;
-    }
-
-    m_newJobWithCredentialsStarted = sendRequestWithCredentials(serverType, scheme, realm, requireCredentials);
+    } else if (serverType != ProtectionSpaceProxyHTTP)
+        // If a wifi proxy auth failed, there is no point of trying anymore because the credentials are wrong.
+        m_newJobWithCredentialsStarted = sendRequestWithCredentials(serverType, scheme, realm, requireCredentials);
 }
 
 void NetworkJob::notifyStringHeaderReceived(const String& key, const String& value)
@@ -707,15 +713,8 @@
 
     String host;
     int port;
-    if (type == ProtectionSpaceProxyHTTP) {
-        String proxyAddress = BlackBerry::Platform::Client::get()->getProxyAddress(newURL.string().ascii().data()).c_str();
-        KURL proxyURL(KURL(), proxyAddress);
-        host = proxyURL.host();
-        port = proxyURL.port();
-    } else {
-        host = m_response.url().host();
-        port = m_response.url().port();
-    }
+    host = m_response.url().host();
+    port = m_response.url().port();
 
     ProtectionSpace protectionSpace(host, port, type, realm, scheme);
 
@@ -742,11 +741,6 @@
         String username;
         String password;
 
-        if (type == ProtectionSpaceProxyHTTP) {
-            username = BlackBerry::Platform::Client::get()->getProxyUsername().c_str();
-            password = BlackBerry::Platform::Client::get()->getProxyPassword().c_str();
-        }
-
         if (username.isEmpty() || password.isEmpty()) {
             // Before asking the user for credentials, we check if the URL contains that.
             if (!m_handle->getInternal()->m_user.isEmpty() && !m_handle->getInternal()->m_pass.isEmpty()) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to