[BlackBerry] Dijit crash WebCore::CookieManager::getRawCookies
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 20:56:39 +0000 (20:56 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 20 Mar 2012 20:56:39 +0000 (20:56 +0000)
https://bugs.webkit.org/show_bug.cgi?id=81686

Patch by Jacky Jiang <zhajiang@rim.com> on 2012-03-20
Reviewed by Rob Buis.

Source/WebCore:

HTML plugin element with an empty src caused an ASSERT failure on debug
build and a crash on release build.
When getting cookie, url can be null, so we need to check for it to
avoid the crash.

No new tests as this is covered by
LayoutTests/fast/loader/empty-embed-src-attribute.html.

* platform/network/blackberry/ResourceRequestBlackBerry.cpp:
(WebCore::ResourceRequest::initializePlatformRequest):

Source/WebKit/blackberry:

When deciding the policy for navigation action, if the url of the
request is null, ignore it to avoid the ASSERT failure in
MainResourceLoader::willSendRequest.

* WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
(WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@111434 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp
Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp

index 4de4572a87e5d6879d536eba4795c8655acf91eb..ac02e858ac1443b3053e02e645f214b6ccdcd7d0 100644 (file)
@@ -1,3 +1,21 @@
+2012-03-20  Jacky Jiang  <zhajiang@rim.com>
+
+        [BlackBerry] Dijit crash WebCore::CookieManager::getRawCookies
+        https://bugs.webkit.org/show_bug.cgi?id=81686
+
+        Reviewed by Rob Buis.
+
+        HTML plugin element with an empty src caused an ASSERT failure on debug
+        build and a crash on release build.
+        When getting cookie, url can be null, so we need to check for it to
+        avoid the crash.
+
+        No new tests as this is covered by
+        LayoutTests/fast/loader/empty-embed-src-attribute.html.
+
+        * platform/network/blackberry/ResourceRequestBlackBerry.cpp:
+        (WebCore::ResourceRequest::initializePlatformRequest):
+
 2012-03-20  Vsevolod Vlasov  <vsevik@chromium.org>
 
         Web Inspector: Tabbed pane drop down should be sorted.
index 6567e95803139668e1cd783108f65d8c4ab5c9f5..a92dbda640bd5f40d9a357146a9fda8d5d2172e4 100644 (file)
@@ -189,7 +189,7 @@ void ResourceRequest::initializePlatformRequest(NetworkRequest& platformRequest,
        
         // Redirection's response may contain new cookies, so add cookies again.
         // If there aren't cookies in the header list, we need trying to add cookies.
-        if (cookiesEnabled && (isRedirect || !httpHeaderFields().contains("Cookie"))) {
+        if (cookiesEnabled && (isRedirect || !httpHeaderFields().contains("Cookie")) && !url().isNull()) {
             // Prepare a cookie header if there are cookies related to this url.
             String cookiePairs = cookieManager().getCookie(url(), WithHttpOnlyCookies);
             if (!cookiePairs.isEmpty())
index 08e238639f18d25c4bc6a235538c50c6c0b0a42d..f7c69a6642b772f0c7696a5e8d17266c91948977 100644 (file)
@@ -1,3 +1,17 @@
+2012-03-20  Jacky Jiang  <zhajiang@rim.com>
+
+        [BlackBerry] Dijit crash WebCore::CookieManager::getRawCookies
+        https://bugs.webkit.org/show_bug.cgi?id=81686
+
+        Reviewed by Rob Buis.
+
+        When deciding the policy for navigation action, if the url of the
+        request is null, ignore it to avoid the ASSERT failure in
+        MainResourceLoader::willSendRequest.
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
+
 2012-03-20  Konrad Piascik  <kpiascik@rim.com>
 
         [BlackBerry] BlackBerry can clear cookies and cache from the Web Inspector
index 088f89ff67809582f54c8c7261ecf473d94cd078..084f91b95019aff35258916858522d81be5272a9 100644 (file)
@@ -192,33 +192,33 @@ void FrameLoaderClientBlackBerry::dispatchDecidePolicyForResponse(FramePolicyFun
 
 void FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request, PassRefPtr<FormState>)
 {
-    PolicyAction decision = PolicyUse;
+    PolicyAction decision = PolicyIgnore;
 
     const KURL& url = request.url();
-
-    // Fragment scrolls on the same page should always be handled internally.
-    // (Only count as a fragment scroll if we are scrolling to a #fragment url, not back to the top, and reloading
-    // the same url is not a fragment scroll even if it has a #fragment.)
-    const KURL& currentUrl = m_frame->document()->url();
-    bool isFragmentScroll = url.hasFragmentIdentifier() && url != currentUrl && equalIgnoringFragmentIdentifier(currentUrl, url);
-    if (decision == PolicyUse)
+    if (!url.isNull()) {
+        // Fragment scrolls on the same page should always be handled internally.
+        // (Only count as a fragment scroll if we are scrolling to a #fragment url, not back to the top, and reloading
+        // the same url is not a fragment scroll even if it has a #fragment.)
+        const KURL& currentUrl = m_frame->document()->url();
+        bool isFragmentScroll = url.hasFragmentIdentifier() && url != currentUrl && equalIgnoringFragmentIdentifier(currentUrl, url);
         decision = decidePolicyForExternalLoad(request, isFragmentScroll);
 
-    // Let the client have a chance to say whether this navigation should
-    // be ignored or not.
-    BlackBerry::Platform::NetworkRequest platformRequest;
-    request.initializePlatformRequest(platformRequest, cookiesEnabled());
-    if (isMainFrame() && !m_webPagePrivate->m_client->acceptNavigationRequest(
-        platformRequest, BlackBerry::Platform::NavigationType(action.type()))) {
-        if (action.type() == NavigationTypeFormSubmitted
-            || action.type() == NavigationTypeFormResubmitted)
-            m_frame->loader()->resetMultipleFormSubmissionProtection();
-
-        if (action.type() == NavigationTypeLinkClicked && url.hasFragmentIdentifier()) {
-            ResourceRequest emptyRequest;
-            m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest);
+        // Let the client have a chance to say whether this navigation should
+        // be ignored or not.
+        BlackBerry::Platform::NetworkRequest platformRequest;
+        request.initializePlatformRequest(platformRequest, cookiesEnabled());
+        if (isMainFrame() && !m_webPagePrivate->m_client->acceptNavigationRequest(
+            platformRequest, BlackBerry::Platform::NavigationType(action.type()))) {
+            if (action.type() == NavigationTypeFormSubmitted
+                || action.type() == NavigationTypeFormResubmitted)
+                m_frame->loader()->resetMultipleFormSubmissionProtection();
+
+            if (action.type() == NavigationTypeLinkClicked && url.hasFragmentIdentifier()) {
+                ResourceRequest emptyRequest;
+                m_frame->loader()->activeDocumentLoader()->setLastCheckedRequest(emptyRequest);
+            }
+            decision = PolicyIgnore;
         }
-        decision = PolicyIgnore;
     }
 
     // If we abort here, dispatchDidCancelClientRedirect will not be called.