Title: [106810] trunk/Source/WebCore
Revision
106810
Author
[email protected]
Date
2012-02-06 08:39:23 -0800 (Mon, 06 Feb 2012)

Log Message

[Blackberry] Non-supported about: operations never stops loading
https://bugs.webkit.org/show_bug.cgi?id=76366

Patch by Chris Guan <[email protected]> on 2012-02-06
Reviewed by Rob Buis.

If user typed a non-supported "about:" scheme such as "about:nonsupport",
the loadAboutURL() function in NetworkManger should recognize and handle it as
an error of invalid url.

* platform/network/blackberry/NetworkJob.cpp:
(WebCore::NetworkJob::loadAboutURL):
(WebCore::NetworkJob::handleAbout):
* platform/network/blackberry/NetworkJob.h:
(NetworkJob):
* platform/network/blackberry/NetworkManager.cpp:
(WebCore::NetworkManager::startJob):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106809 => 106810)


--- trunk/Source/WebCore/ChangeLog	2012-02-06 16:26:58 UTC (rev 106809)
+++ trunk/Source/WebCore/ChangeLog	2012-02-06 16:39:23 UTC (rev 106810)
@@ -1,3 +1,22 @@
+2012-02-06  Chris Guan  <[email protected]>
+
+        [Blackberry] Non-supported about: operations never stops loading
+        https://bugs.webkit.org/show_bug.cgi?id=76366
+
+        Reviewed by Rob Buis.
+
+        If user typed a non-supported "about:" scheme such as "about:nonsupport",
+        the loadAboutURL() function in NetworkManger should recognize and handle it as 
+        an error of invalid url.
+
+        * platform/network/blackberry/NetworkJob.cpp:
+        (WebCore::NetworkJob::loadAboutURL):
+        (WebCore::NetworkJob::handleAbout):
+        * platform/network/blackberry/NetworkJob.h:
+        (NetworkJob):
+        * platform/network/blackberry/NetworkManager.cpp:
+        (WebCore::NetworkManager::startJob):
+
 2012-02-06  Alexander Pavlov  <[email protected]>
 
         Web Inspector: Remove unused disabledComputedProperties from methods in StylesSidebarPane

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


--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-02-06 16:26:58 UTC (rev 106809)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.cpp	2012-02-06 16:39:23 UTC (rev 106810)
@@ -157,30 +157,9 @@
     return true;
 }
 
-bool NetworkJob::loadAboutURL()
+void NetworkJob::loadAboutURL()
 {
-    // First 6 chars are "about:".
-    String aboutWhat(m_response.url().string().substring(6));
-
-    if (!aboutWhat.isEmpty()
-            && !equalIgnoringCase(aboutWhat, "blank")
-            && !equalIgnoringCase(aboutWhat, "credits")
-#if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD
-            && !aboutWhat.startsWith("cache?query=", false)
-            && !equalIgnoringCase(aboutWhat, "cache")
-            && !equalIgnoringCase(aboutWhat, "cache/enable")
-            && !equalIgnoringCase(aboutWhat, "cache/disable")
-            && !equalIgnoringCase(aboutWhat, "version")
-            && (!BlackBerry::Platform::debugSetting()
-                || (!equalIgnoringCase(aboutWhat, "config")
-                    && !equalIgnoringCase(aboutWhat, "build")
-                    && !equalIgnoringCase(aboutWhat, "memory")))
-#endif
-            )
-        return false;
-
     m_loadAboutTimer.startOneShot(0);
-    return true;
 }
 
 int NetworkJob::cancelJob()
@@ -979,13 +958,18 @@
 #endif
     }
 
-    CString resultString = result.utf8();
-
-    notifyStatusReceived(handled ? 404 : 200, 0);
-    notifyStringHeaderReceived("Content-Length", String::number(resultString.length()));
-    notifyStringHeaderReceived("Content-Type", "text/html");
-    notifyDataReceivedPlain(resultString.data(), resultString.length());
-    notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess);
+    if (handled) {
+        CString resultString = result.utf8();
+        notifyStatusReceived(404, 0);
+        notifyStringHeaderReceived("Content-Length", String::number(resultString.length()));
+        notifyStringHeaderReceived("Content-Type", "text/html");
+        notifyDataReceivedPlain(resultString.data(), resultString.length());
+        notifyClose(BlackBerry::Platform::FilterStream::StatusSuccess);
+    } else {
+        // If we can not handle it, we take it as an error of invalid URL.
+        notifyStatusReceived(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl, 0);
+        notifyClose(BlackBerry::Platform::FilterStream::StatusErrorInvalidUrl);
+    }
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h (106809 => 106810)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h	2012-02-06 16:26:58 UTC (rev 106809)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkJob.h	2012-02-06 16:39:23 UTC (rev 106810)
@@ -60,7 +60,7 @@
     bool isCancelled() const { return m_cancelled; }
     bool clientIsOk() const { return !m_cancelled && m_handle && m_handle->client(); }
     void loadDataURL() { m_loadDataTimer.startOneShot(0); }
-    bool loadAboutURL();
+    void loadAboutURL();
     int cancelJob();
     bool isDeferringLoading() const { return m_deferLoadingCount > 0; }
     void updateDeferLoadingCount(int delta);

Modified: trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp (106809 => 106810)


--- trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp	2012-02-06 16:26:58 UTC (rev 106809)
+++ trunk/Source/WebCore/platform/network/blackberry/NetworkManager.cpp	2012-02-06 16:39:23 UTC (rev 106810)
@@ -150,9 +150,9 @@
     }
 
     if (url.protocolIs("about")) {
-        // Try to handle the url internally; if it isn't recognized, continue and pass it to the client.
-        if (networkJob->loadAboutURL())
-            return true;
+        // If the protocol matches "about", loadAboutURL should recognize and handle it.
+        networkJob->loadAboutURL();
+        return true;
     }
 
     int result = networkJob->streamOpen();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to