Title: [112940] trunk/Source
Revision
112940
Author
[email protected]
Date
2012-04-02 14:15:23 -0700 (Mon, 02 Apr 2012)

Log Message

[BlackBerry] Set ResourceRequest TargetType in WebPagePrivate::load()
https://bugs.webkit.org/show_bug.cgi?id=80519

Source/WebCore:

Stop asserting in platformCachePolicyForRequest() as now it is expected
that the ResourceRequest might not have the right TargetType setup at
this time for main loads.

Patch by Lianghui Chen <[email protected]> on 2012-04-02
Reviewed by Rob Buis.

No new tests as no change in behaviour.

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

Source/WebKit/blackberry:

Set the right TargetType for main loads if they are not already set in
dispatchWillSendRequest().

Also adjust NetworkRequest TargetType for decidePolicyForExternalLoad()
and dispatchDecidePolicyForNavigationAction() as they are called before
dispatchWillSendRequest() is called. Patch to change ResourceRequest
TargetType earlier has been rejected as in WebKit bug
https://bugs.webkit.org/show_bug.cgi?id=80713

Patch by Lianghui Chen <[email protected]> on 2012-04-02
Reviewed by Rob Buis.

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (112939 => 112940)


--- trunk/Source/WebCore/ChangeLog	2012-04-02 21:10:28 UTC (rev 112939)
+++ trunk/Source/WebCore/ChangeLog	2012-04-02 21:15:23 UTC (rev 112940)
@@ -1,3 +1,19 @@
+2012-04-02  Lianghui Chen  <[email protected]>
+
+        [BlackBerry] Set ResourceRequest TargetType in WebPagePrivate::load()
+        https://bugs.webkit.org/show_bug.cgi?id=80519
+
+        Stop asserting in platformCachePolicyForRequest() as now it is expected
+        that the ResourceRequest might not have the right TargetType setup at
+        this time for main loads.
+
+        Reviewed by Rob Buis.
+
+        No new tests as no change in behaviour.
+
+        * platform/network/blackberry/ResourceRequestBlackBerry.cpp:
+        (WebCore::platformCachePolicyForRequest):
+
 2012-04-02  Simon Fraser  <[email protected]>
 
         Fix issue with reflections and composited layers

Modified: trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp (112939 => 112940)


--- trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp	2012-04-02 21:10:28 UTC (rev 112939)
+++ trunk/Source/WebCore/platform/network/blackberry/ResourceRequestBlackBerry.cpp	2012-04-02 21:15:23 UTC (rev 112940)
@@ -46,7 +46,6 @@
     case WebCore::ReturnCacheDataDontLoad:
         return NetworkRequest::ReturnCacheDataDontLoad;
     default:
-        ASSERT_NOT_REACHED();
         return NetworkRequest::UseProtocolCachePolicy;
     }
 }

Modified: trunk/Source/WebKit/blackberry/ChangeLog (112939 => 112940)


--- trunk/Source/WebKit/blackberry/ChangeLog	2012-04-02 21:10:28 UTC (rev 112939)
+++ trunk/Source/WebKit/blackberry/ChangeLog	2012-04-02 21:15:23 UTC (rev 112940)
@@ -1,3 +1,24 @@
+2012-04-02  Lianghui Chen  <[email protected]>
+
+        [BlackBerry] Set ResourceRequest TargetType in WebPagePrivate::load()
+        https://bugs.webkit.org/show_bug.cgi?id=80519
+
+        Set the right TargetType for main loads if they are not already set in
+        dispatchWillSendRequest().
+
+        Also adjust NetworkRequest TargetType for decidePolicyForExternalLoad()
+        and dispatchDecidePolicyForNavigationAction() as they are called before
+        dispatchWillSendRequest() is called. Patch to change ResourceRequest
+        TargetType earlier has been rejected as in WebKit bug
+        https://bugs.webkit.org/show_bug.cgi?id=80713
+
+        Reviewed by Rob Buis.
+
+        * WebCoreSupport/FrameLoaderClientBlackBerry.cpp:
+        (WebCore::FrameLoaderClientBlackBerry::dispatchDecidePolicyForNavigationAction):
+        (WebCore::FrameLoaderClientBlackBerry::dispatchWillSendRequest):
+        (WebCore::FrameLoaderClientBlackBerry::decidePolicyForExternalLoad):
+
 2012-04-01  Arvid Nilsson  <[email protected]>
 
         [BlackBerry] Simplify the code that gets accelerated compositing output onto the screen

Modified: trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp (112939 => 112940)


--- trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-04-02 21:10:28 UTC (rev 112939)
+++ trunk/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp	2012-04-02 21:15:23 UTC (rev 112940)
@@ -72,6 +72,7 @@
 using WTF::String;
 using namespace WebCore;
 using namespace BlackBerry::WebKit;
+using BlackBerry::Platform::NetworkRequest;
 
 // This was copied from file "WebKit/Source/WebKit/mac/Misc/WebKitErrors.h".
 enum {
@@ -209,8 +210,11 @@
 
         // Let the client have a chance to say whether this navigation should
         // be ignored or not.
-        BlackBerry::Platform::NetworkRequest platformRequest;
+        NetworkRequest platformRequest;
         request.initializePlatformRequest(platformRequest, cookiesEnabled());
+        if (platformRequest.getTargetType() == NetworkRequest::TargetIsUnknown)
+            platformRequest.setTargetType(isMainFrame() ? NetworkRequest::TargetIsMainFrame : NetworkRequest::TargetIsSubframe);
+
         if (isMainFrame() && !m_webPagePrivate->m_client->acceptNavigationRequest(
             platformRequest, BlackBerry::Platform::NavigationType(action.type()))) {
             if (action.type() == NavigationTypeFormSubmitted
@@ -931,12 +935,16 @@
     // it is a new top level request which has not been commited.
     bool isMainResourceLoad = docLoader && docLoader == docLoader->frameLoader()->provisionalDocumentLoader();
 
+    // TargetType for subresource loads should have been set in CachedResource::load().
+    if (isMainResourceLoad && request.targetType() == ResourceRequest::TargetIsUnspecified)
+        request.setTargetType(isMainFrame() ? ResourceRequest::TargetIsMainFrame : ResourceRequest::TargetIsSubframe);
+
     // Any processing which is done for all loads (both main and subresource) should go here.
-    BlackBerry::Platform::NetworkRequest platformRequest;
+    NetworkRequest platformRequest;
     request.initializePlatformRequest(platformRequest, cookiesEnabled());
     m_webPagePrivate->m_client->populateCustomHeaders(platformRequest);
-    const BlackBerry::Platform::NetworkRequest::HeaderList& headerLists = platformRequest.getHeaderListRef();
-    for (BlackBerry::Platform::NetworkRequest::HeaderList::const_iterator it = headerLists.begin(); it != headerLists.end(); ++it) {
+    const NetworkRequest::HeaderList& headerLists = platformRequest.getHeaderListRef();
+    for (NetworkRequest::HeaderList::const_iterator it = headerLists.begin(); it != headerLists.end(); ++it) {
         std::string headerString = it->first;
         std::string headerValueString = it->second;
         request.setHTTPHeaderField(String::fromUTF8WithLatin1Fallback(headerString.data(), headerString.length()), String::fromUTF8WithLatin1Fallback(headerValueString.data(), headerValueString.length()));
@@ -1091,8 +1099,11 @@
             && isMainFrame()
             && !request.mustHandleInternally()
             && !isFragmentScroll) {
-        BlackBerry::Platform::NetworkRequest platformRequest;
+        NetworkRequest platformRequest;
         request.initializePlatformRequest(platformRequest, cookiesEnabled());
+        if (platformRequest.getTargetType() == NetworkRequest::TargetIsUnknown)
+            platformRequest.setTargetType(isMainFrame() ? NetworkRequest::TargetIsMainFrame : NetworkRequest::TargetIsSubframe);
+
         m_webPagePrivate->m_client->handleExternalLink(platformRequest, request.anchorText().characters(), request.anchorText().length(), m_clientRedirectIsPending);
         return PolicyIgnore;
     }
@@ -1159,7 +1170,7 @@
 void FrameLoaderClientBlackBerry::startDownload(const ResourceRequest& request, const String& /*suggestedName*/)
 {
     // FIXME: use the suggestedName?
-    m_webPagePrivate->load(request.url().string().utf8().data(), 0, "GET", BlackBerry::Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, "");
+    m_webPagePrivate->load(request.url().string().utf8().data(), 0, "GET", NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, true, "");
 }
 
 void FrameLoaderClientBlackBerry::download(ResourceHandle* handle, const ResourceRequest&, const ResourceRequest&, const ResourceResponse& r)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to