Bug 140188 - HTTP body/bodystream (e.g., POST form data) is missing in WKNavigationDelegate callbacks
Summary: HTTP body/bodystream (e.g., POST form data) is missing in WKNavigationDelegat...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit2 (show other bugs)
Version: 528+ (Nightly build)
Hardware: iPhone / iPad All
: P2 Major
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-07 11:32 PST by Stuart Morgan
Modified: 2018-12-10 00:43 PST (History)
21 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Morgan 2015-01-07 11:32:23 PST
Spun off of bug 1377299, POST data and any other HTTPBody or HTTPBodyStream is missing from NSURLRequest objects provided in the WKNavigationDelegate.

STR:
- Implement a WKNavigationDelegate
- Submit a form
- In webView:decidePolicyForNavigationAction:decisionHandler:, try to extract the form data via navigationAction.request.HTTPBody

None of the data is there (apparently by design, per comment 5 in the other bug).


This is a serious problem for Chromium, since we implement our own back/forward handling (for a variety of reasons, a significant one being the ability to sync tabs with history across devices, and to re-create tabs with full history across cold launches of the app--since there's no way to edit the history of a WKWebView, only read it, maintaining our own stack is our only option). This bug means that going back or forward to a page that includes any kind of HTTP body will fail to work correctly.

This is also filed as rdar://18399639
Comment 1 jason.bugzilla 2015-08-19 14:28:04 PDT
Any update on this? This seems like it is blocking a fair number of people and really making WKWebView incomplete for many developers.

If not, is there a good workaround? This seems pretty terrible to me:
http://stackoverflow.com/questions/26253133/cant-set-headers-on-my-wkwebview-post-request
Comment 2 Stuart Morgan 2015-08-20 06:32:06 PDT
Based on the link, it sounds like you are looking for bug 145410 rather than this one.
Comment 3 David 2016-02-03 13:52:02 PST
Just wanted to add in here that I would like to see some time put into making this work.

I understand why it is not currently implemented.

However, it seems to me that at the point where decidePolicyForNavigationAction is executing, the WebKit process is waiting anyway so getting the process to do a slow copy of some data should not be an issue - could there be a way to have the WKWebView instance get the HTTPBody (presumably requesting it over IPC) then, only if requested. Or does the IPC not work that way?

I have also filed this as rdar://24489009
Comment 4 omejames 2017-11-03 03:42:03 PDT Comment hidden (spam)
Comment 5 rebeccahickshq 2017-12-24 04:32:21 PST Comment hidden (spam)
Comment 6 maria denial 2018-02-06 01:54:03 PST Comment hidden (spam)
Comment 7 CourseworkCamp 2018-02-13 03:04:00 PST Comment hidden (spam)
Comment 8 tnresults 2018-04-09 04:04:49 PDT Comment hidden (spam)
Comment 9 Henna 2018-05-08 11:47:48 PDT Comment hidden (spam)
Comment 10 stephanyortega 2018-05-31 00:31:37 PDT Comment hidden (spam)
Comment 11 Saleonleather 2018-07-16 00:18:43 PDT Comment hidden (spam)
Comment 12 harishsagar 2018-07-26 00:16:25 PDT Comment hidden (spam)
Comment 13 Emma Jason 2018-09-05 13:56:33 PDT Comment hidden (spam)
Comment 14 John Martin 2018-11-22 23:51:31 PST Comment hidden (spam)