Commit e31bb698 authored by mary.wu@torchmobile.com.cn's avatar mary.wu@torchmobile.com.cn
Browse files

[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):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@146845 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 369831ab
......@@ -663,7 +663,7 @@ private:
}
};
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)
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 needReferer, bool forceDownload, const BlackBerry::Platform::String& overrideContentType, const BlackBerry::Platform::String& suggestedSaveName)
{
stopCurrentLoad();
DeferredTaskLoadManualScript::finishOrCancel(this);
......@@ -702,6 +702,8 @@ void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBe
for (unsigned i = 0; i + 1 < headersLength; i += 2)
request.addHTTPHeaderField(headers[i], headers[i + 1]);
if (needReferer && focusedOrMainFrame() && focusedOrMainFrame()->document())
request.addHTTPHeaderField("Referer", focusedOrMainFrame()->document()->url().string().utf8().data());
if (forceDownload)
request.setForceDownload(true);
......@@ -711,14 +713,14 @@ void WebPagePrivate::load(const BlackBerry::Platform::String& url, const BlackBe
m_mainFrame->loader()->load(FrameLoadRequest(m_mainFrame, request));
}
void WebPage::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial)
void WebPage::load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial, bool needReferer, bool forceDownload)
{
d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false);
d->load(url, networkToken, "GET", Platform::NetworkRequest::UseProtocolCachePolicy, 0, 0, 0, 0, isInitial, false, needReferer, forceDownload);
}
void 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)
{
d->load(url, networkToken, method, cachePolicy, data, dataLength, headers, headersLength, false, mustHandleInternally, false, "");
d->load(url, networkToken, method, cachePolicy, data, dataLength, headers, headersLength, false, mustHandleInternally, false, false, "");
}
void WebPage::loadFile(const BlackBerry::Platform::String& path, const BlackBerry::Platform::String& overrideContentType)
......@@ -729,7 +731,7 @@ void WebPage::loadFile(const BlackBerry::Platform::String& path, const BlackBerr
else if (!fileUrl.startsWith("file:///"))
return;
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());
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());
}
void WebPage::download(const Platform::NetworkRequest& request)
......@@ -740,7 +742,7 @@ void WebPage::download(const Platform::NetworkRequest& request)
headers.push_back(list[i].first.c_str());
headers.push_back(list[i].second.c_str());
}
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());
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());
}
void WebPagePrivate::loadString(const BlackBerry::Platform::String& string, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& contentType, const BlackBerry::Platform::String& failingURL)
......
......@@ -93,7 +93,7 @@ public:
WebPageClient* client() const;
void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial = false);
void load(const BlackBerry::Platform::String& url, const BlackBerry::Platform::String& networkToken, bool isInitial = false, bool needReferer = false, bool forceDownload = false);
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);
......
......@@ -114,7 +114,7 @@ public:
bool handleMouseEvent(WebCore::PlatformMouseEvent&);
bool handleWheelEvent(WebCore::PlatformWheelEvent&);
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());
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());
void loadString(const BlackBerry::Platform::String&, const BlackBerry::Platform::String& baseURL, const BlackBerry::Platform::String& mimeType, const BlackBerry::Platform::String& failingURL);
bool executeJavaScript(const BlackBerry::Platform::String& script, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
bool executeJavaScriptInIsolatedWorld(const WebCore::ScriptSourceCode&, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue);
......
2013-03-25 Mary Wu <mary.wu@torchmobile.com.cn>
[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):
2013-03-22 Nima Ghanavatian <nghanavatian@blackberry.com>
 
[BlackBerry] Build fix in InputHandler
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment