Skip to content

Commit 93df981

Browse files
committed
inject infto non-main frames patch
1 parent 639594b commit 93df981

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

apple/RNCWebViewImpl.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,7 +1713,7 @@ - (void)setInjectedJavaScriptObject:(NSString *)source
17131713
/* 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.
17141714
* I am keeping it as YES for consistency with previous behaviour. */
17151715
// forMainFrameOnly:_messagingEnabledForMainFrameOnly
1716-
forMainFrameOnly:YES
1716+
forMainFrameOnly:NO
17171717
];
17181718
}
17191719

@@ -1764,7 +1764,7 @@ - (void)setMessagingEnabled:(BOOL)messagingEnabled {
17641764
/* 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.
17651765
* I am keeping it as YES for consistency with previous behaviour. */
17661766
// forMainFrameOnly:_messagingEnabledForMainFrameOnly
1767-
forMainFrameOnly:YES
1767+
forMainFrameOnly:NO
17681768
] :
17691769
nil;
17701770

@@ -1837,7 +1837,7 @@ - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
18371837
" })\n"
18381838
"})(window.history)\n", HistoryShimName
18391839
];
1840-
WKUserScript *userScript = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES];
1840+
WKUserScript *userScript = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:NO];
18411841
[wkWebViewConfig.userContentController addUserScript:userScript];
18421842

18431843
if(_sharedCookiesEnabled) {
@@ -1895,7 +1895,7 @@ - (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig {
18951895

18961896
WKUserScript* cookieInScript = [[WKUserScript alloc] initWithSource:script
18971897
injectionTime:WKUserScriptInjectionTimeAtDocumentStart
1898-
forMainFrameOnly:YES];
1898+
forMainFrameOnly:NO];
18991899
[wkWebViewConfig.userContentController addUserScript:cookieInScript];
19001900
}
19011901
}

0 commit comments

Comments
 (0)