<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>140214</bug_id>
          
          <creation_ts>2015-01-07 14:40:03 -0800</creation_ts>
          <short_desc>WKNavigation.initialRequest is always nil in -[WKNavigationDelegate webView:didReceiveServerRedirectForProvisionalNavigation:]</short_desc>
          <delta_ts>2015-02-04 03:52:20 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit2</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Eugene But">eugenebut</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>dieter</cc>
    
    <cc>stuartmorgan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1059546</commentid>
    <comment_count>0</comment_count>
    <who name="Eugene But">eugenebut</who>
    <bug_when>2015-01-07 14:40:03 -0800</bug_when>
    <thetext>Summary:
The initialRequest property of the WKNavigation object passed to -[WKNavigationDelegate webView:didReceiveServerRedirectForProvisionalNavigation:] is always nil. I expected this to be in the request that triggered the redirect.

Steps to Reproduce:
1) Create a WKWebView instance and load browsingtest.appspot.com.
2) Click on &quot;redirect301&quot; from the page in the row &quot;Window34&quot;.

Sample Code:
- (void)viewDidLoad {
  [super viewDidLoad];
  WKWebViewConfiguration* config = [[WKWebViewConfiguration alloc] init];
  self.webView =
  [[WKWebView alloc] initWithFrame:self.view.bounds configuration:config];
  [self.view addSubview:self.webView];
  self.webView.navigationDelegate = self;
  NSURLRequest* request = [[NSURLRequest alloc]
      initWithURL:[NSURL URLWithString:@&quot;http://browsingtest.appspot.com&quot;]];
  [self.webView loadRequest:request];
  // click redirect301 on the page.
}

- (void)webView:(WKWebView *)webView
didReceiveServerRedirectForProvisionalNavigation:(WKNavigation *)navigation {
  // This should not be nil.
  NSLog(@&quot;%@&quot;, navigation.initialRequest);
}


Expected Results:
Expected WKNavigation.initialRequest to be populated with http://browsingtest.appspot.com/redirect?code=301 - the same request passed to -webView:decidePolicyForNavigationAction:decisionHandler: and -webView:didStartProvisionalNavigation:. 

Actual Results:
WKNavigation.initialRequest is nil
The method is not implemented: https://github.com/WebKit/webkit/blob/0190dd5b8c0272beaa705dbc10863a84a3e6af5e/Source/WebKit2/UIProcess/API/Cocoa/WKNavigation.mm</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1059619</commentid>
    <comment_count>1</comment_count>
    <who name="Eugene But">eugenebut</who>
    <bug_when>2015-01-07 16:09:36 -0800</bug_when>
    <thetext>Radar ID: 17935319</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>