<?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>156553</bug_id>
          
          <creation_ts>2016-04-13 13:38:08 -0700</creation_ts>
          <short_desc>Setting navigationDelegate  breaks WebCrypto API</short_desc>
          <delta_ts>2016-09-30 11:20:17 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebKit API</component>
          <version>Safari 9</version>
          <rep_platform>iPhone / iPad</rep_platform>
          <op_sys>iOS 9.3</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>162554</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Trygve">trygve.hardersen</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>beidson</cc>
    
    <cc>bfulgham</cc>
    
    <cc>sam</cc>
    
    <cc>trygve.hardersen</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1183517</commentid>
    <comment_count>0</comment_count>
    <who name="Trygve">trygve.hardersen</who>
    <bug_when>2016-04-13 13:38:08 -0700</bug_when>
    <thetext>I&apos;m encountering strange behaviour in the WebCrypto API when setting the navigationDelegate of a WKWebView on iOS. After setting the delegate I can no longer store asymmetric keys from JavaScript as I&apos;m getting a DataCloneError (25).

After looking through the source code I believe this is caused by this code in NavigationState.mm

m_navigationDelegateMethods.webCryptoMasterKeyForWebView = [delegate respondsToSelector:@selector(_webCryptoMasterKeyForWebView:)];

I can work around the issue by implementing this method in by navigationDelegate class:

- (NSData *)_webCryptoMasterKeyForWebView:(WKWebView *)sender {
    return [NSData dataWithBytes:&quot;\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f&quot; length:16];
}

I&apos;ve provided a sample key above. Obviously I would not like to rely on this private API.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1184403</commentid>
    <comment_count>1</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2016-04-16 16:58:18 -0700</bug_when>
    <thetext>&lt;rdar://problem/25766400&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1235300</commentid>
    <comment_count>2</comment_count>
    <who name="Brady Eidson">beidson</who>
    <bug_when>2016-09-30 11:20:17 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 162554 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>