Changeset 146845 in webkit


Ignore:
Timestamp:
Mar 25, 2013, 8:13:02 PM (12 years ago)
Author:
mary.wu@torchmobile.com.cn
Message:

[BlackBerry] add needReferer in WebPage load() api
https://bugs.webkit.org/show_bug.cgi?id=113167

Reviewed by Rob Buis.

PR310175, internally reviewed by Joe Mason.
Sometimes when client load request, it need to add referer with current frame like
save link/image in option menu, so we add needRef in load() interface in webpage.

  • Api/WebPage.cpp:

(BlackBerry::WebKit::WebPagePrivate::load):
(BlackBerry::WebKit::WebPage::load):
(BlackBerry::WebKit::WebPage::loadExtended):
(BlackBerry::WebKit::WebPage::loadFile):
(BlackBerry::WebKit::WebPage::download):

  • Api/WebPage.h:
  • Api/WebPage_p.h:

(WebPagePrivate):

Location:
trunk/Source/WebKit/blackberry
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/blackberry/Api/WebPage.cpp

    r146597 r146845  
    664664};
    665665
    666 void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool forceDownload, const BlackBerry::Platform::String& overrideContentType, const BlackBerry::Platform::String& suggestedSaveName)
     666void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally, bool needReferer, bool forceDownload, const BlackBerry::Platform::String& overrideContentType, const BlackBerry::Platform::String& suggestedSaveName)
    667667{
    668668    stopCurrentLoad();
     
    703703    for (unsigned i = 0; i + 1 < headersLength; i += 2)
    704704        request.addHTTPHeaderField(headers[i], headers[i + 1]);
     705    if (needReferer && focusedOrMainFrame() && focusedOrMainFrame()->document())
     706        request.addHTTPHeaderField("Referer", focusedOrMainFrame()->document()->url().string().utf8().data());
    705707
    706708    if (forceDownload)
     
    712714}
    713715
    714 void WebPage::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial)
    715 {
    716     d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false);
     716void WebPage::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial, bool needReferer, bool forceDownload)
     717{
     718    d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false, needReferer, forceDownload);
    717719}
    718720
    719721void WebPage::loadExtended(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy cachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool mustHandleInternally)
    720722{
    721     d->load(url, networkToken, method, cachePolicy, data, dataLength, headers, headersLength, false, mustHandleInternally, false, "");
     723    d->load(url, networkToken, method, cachePolicy, data, dataLength, headers, headersLength, false, mustHandleInternally, false, false, "");
    722724}
    723725
     
    730732        return;
    731733
    732     d->load(fileUrl, BlackBerry::Platform::String::emptyString(), BlackBerry::Platform::String("GET", 3), Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, false, overrideContentType.c_str());
     734    d->load(fileUrl, BlackBerry::Platform::String::emptyString(), BlackBerry::Platform::String("GET", 3), Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, false, false, false, false, overrideContentType.c_str());
    733735}
    734736
     
    741743        headers.push_back(list[i].second.c_str());
    742744    }
    743     d->load(request.getUrlRef(), BlackBerry::Platform::String::emptyString(), "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, true, "", request.getSuggestedSaveName().c_str());
     745    d->load(request.getUrlRef(), BlackBerry::Platform::String::emptyString(), "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, headers.empty() ? 0 : &headers[0], headers.size(), false, false, false, true, "", request.getSuggestedSaveName().c_str());
    744746}
    745747
  • trunk/Source/WebKit/blackberry/Api/WebPage.h

    r146269 r146845  
    9494    WebPageClient* client() const;
    9595
    96     void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial = false);
     96    void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial = false, bool needReferer = false, bool forceDownload = false);
    9797
    9898    void loadExtended(const char* url, const char* networkToken, const char* method, Platform::NetworkRequest::CachePolicy = Platform::NetworkRequest::UseProtocolCachePolicy, const char* data = 0, size_t dataLength = 0, const char* const* headers = 0, size_t headersLength = 0, bool mustHandleInternally = false);
  • trunk/Source/WebKit/blackberry/Api/WebPage_p.h

    r146269 r146845  
    115115    bool handleWheelEvent(WebCore::PlatformWheelEvent&);
    116116
    117     void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool forceDownload = false, const BlackBerry::Platform::String& overrideContentType = BlackBerry::Platform::String::emptyString(), const BlackBerry::Platform::String& suggestedSaveName = BlackBerry::Platform::String::emptyString());
     117    void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, const BlackBerry::Platform::String& method, Platform::NetworkRequest::CachePolicy, const char* data, size_t dataLength, const char* const* headers, size_t headersLength, bool isInitial, bool mustHandleInternally = false, bool needReferer = false, bool forceDownload = false, const BlackBerry::Platform::String& overrideContentType = BlackBerry::Platform::String::emptyString(), const BlackBerry::Platform::String& suggestedSaveName = BlackBerry::Platform::String::emptyString());
    118118    void loadString(const BlackBerry::Platform::String&, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL);
    119119    bool executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
  • trunk/Source/WebKit/blackberry/ChangeLog

    r146674 r146845  
     12013-03-25  Mary Wu  <mary.wu@torchmobile.com.cn>
     2
     3        [BlackBerry] add needReferer in WebPage load() api
     4        https://bugs.webkit.org/show_bug.cgi?id=113167
     5
     6        Reviewed by Rob Buis.
     7
     8        PR310175, internally reviewed by Joe Mason.
     9        Sometimes when client load request, it need to add referer with current frame like
     10        save link/image in option menu, so we add needRef in load() interface in webpage.
     11
     12        * Api/WebPage.cpp:
     13        (BlackBerry::WebKit::WebPagePrivate::load):
     14        (BlackBerry::WebKit::WebPage::load):
     15        (BlackBerry::WebKit::WebPage::loadExtended):
     16        (BlackBerry::WebKit::WebPage::loadFile):
     17        (BlackBerry::WebKit::WebPage::download):
     18        * Api/WebPage.h:
     19        * Api/WebPage_p.h:
     20        (WebPagePrivate):
     21
    1222013-03-22  Nima Ghanavatian  <nghanavatian@blackberry.com>
    223
Note: See TracChangeset for help on using the changeset viewer.