Junwei,

If we look at the Android web view cookie related API, there are bunch of 
functions under android.webkit.Cookie[Sync]Manager. It seems you intent to 
expose very raw level at resource loading phase, could you explain benefits on 
that?

Thanks,
Halton.
On Nov 18, 2015, at 16:12, Fu, Junwei 
<junwei...@intel.com<mailto:junwei...@intel.com>> wrote:

Description:
A requirement from Cloudbox that is an Android Web browser based on Crosswalk, 
It can be download from 
http://cloudbox.tinydust.cn<http://cloudbox.tinydust.cn/> . They have a cloud 
sync feature that allow users to sync their web apps, web app’s view states. 
Therefore the ability to access the cookies is essential. The 
XWalkCookieManager is useful for manipulating   cookies,  however Name and 
Value property of cookie is stored, they also need to get the Domain, Path, 
HttpOnly  properties and so on.
Another requirement is able to access the set-cookie header from an 
XMLHttpRequest, The refused message of “Refused to get unsafe header 
"set-cookie"” will be shown to block the ability.
The API getResponseHeader(header) is described in 
http://www.w3.org/TR/XMLHttpRequest/#the-getresponseheader()-method
        Returns the header field value from the response of which the field 
name matches header, unless the field name is Set-Cookie or Set-Cookie2.

So I intent to implement the new API in XWalkResourceClient to get resource 
response headers
public void onResourceResponseHeadersReceived(XWalkView view, String url, 
Map<String, String> headers) {
// Customer can get Set-Cookies as blow
String cookies = headers.get(“Set-Cookie”);
}

Related feature: XWALK-4267, XWALK-4643

Target release: Crosswalk-18

Implementation details:
Resources response header will be received in 
xwalk/runtime/browser/runtime_network_delegate.cc
int RuntimeNetworkDelegate::OnHeadersReceived(
    net::URLRequest* request,
    const net::CompletionCallback& callback,
    const net::HttpResponseHeaders* original_response_headers,
    scoped_refptr<net::HttpResponseHeaders>* override_response_headers,
GURL* allowed_unsafe_redirect_url) {
Io_thread_client->OnResourcesResponseHeaderReceived(original_response_headers)
   return net::OK;
}

Add a new function named OnResourcesResponseHeaderReceived in 
xwalkContentsIOThreadClient.h
Void OnResourcesResponseHeaderReceived (net::HttpResponseHeaders headers){
  //Get All of headers and store it in jStringArray
  //call Java function
}

Add new callback in XWalkResourceClient in order to be called by 
XWalkContentsClientBridge.java
public void onResourceResponseHeadersReceived(XWalkView view, String url, 
Map<String, String> headers) {
}

Thanks,
Junwei

_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org<mailto:Crosswalk-dev@lists.crosswalk-project.org>
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

_______________________________________________
Crosswalk-dev mailing list
Crosswalk-dev@lists.crosswalk-project.org
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-dev

Reply via email to