Bug 156553 - Setting navigationDelegate breaks WebCrypto API
Summary: Setting navigationDelegate breaks WebCrypto API
Status: RESOLVED DUPLICATE of bug 162554
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit API (show other bugs)
Version: Safari 9
Hardware: iPhone / iPad iOS 9.3
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-04-13 13:38 PDT by Trygve
Modified: 2016-09-30 11:20 PDT (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trygve 2016-04-13 13:38:08 PDT
I'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'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:"\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" length:16];
}

I've provided a sample key above. Obviously I would not like to rely on this private API.
Comment 1 Radar WebKit Bug Importer 2016-04-16 16:58:18 PDT
<rdar://problem/25766400>
Comment 2 Brady Eidson 2016-09-30 11:20:17 PDT

*** This bug has been marked as a duplicate of bug 162554 ***