|
@@ -1009,9 +1009,10 @@ static NSDictionary* customCertificatesForHost;
|
1009
|
1009
|
"};", MessageHandlerName, MessageHandlerName
|
1010
|
1010
|
]
|
1011
|
1011
|
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
|
1012
|
|
- /* This was previously YES, but I'm following react-native-wkwebview's approach on this;
|
1013
|
|
- * It's very useful to be able to inject postMessage into iframes. */
|
1014
|
|
- forMainFrameOnly:_injectedJavaScriptBeforeContentLoadedForMainFrameOnly
|
|
1012
|
+ /* TODO: For a separate (minor) PR: use logic like this (as react-native-wkwebview does) so that messaging can be used in all frames if desired.
|
|
1013
|
+ * I am keeping it as YES for consistency with previous behaviour. */
|
|
1014
|
+ // forMainFrameOnly:_messagingEnabledForMainFrameOnly
|
|
1015
|
+ forMainFrameOnly:YES
|
1015
|
1016
|
] :
|
1016
|
1017
|
nil;
|
1017
|
1018
|
|
|
@@ -1115,6 +1116,7 @@ static NSDictionary* customCertificatesForHost;
|
1115
|
1116
|
name:MessageHandlerName];
|
1116
|
1117
|
[_webView.configuration.userContentController addUserScript:self.postMessageScript];
|
1117
|
1118
|
}
|
|
1119
|
+ // FIXME: For a separate (minor) PR: these two shouldn't be gated by messagingEnabled; just keeping consistency with previous behaviour.
|
1118
|
1120
|
if (self.atStartScript) {
|
1119
|
1121
|
[_webView.configuration.userContentController addUserScript:self.atStartScript];
|
1120
|
1122
|
}
|