Skip to content

Commit 1f06a02

Browse files
authored
Merge pull request #1494 from AzureAD/mipetriu/spinner_fix
Loading spinner fix - check if webview navigation action targeted to main frame
2 parents 45ffc12 + cd3c6ac commit 1f06a02

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

IdentityCore/src/webview/embeddedWebview/MSIDOAuth2EmbeddedWebviewController.m

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ - (void)webView:(WKWebView *)webView decidePolicyForNavigationAction:(WKNavigati
280280

281281
MSID_LOG_WITH_CTX_PII(MSIDLogLevelVerbose, self.context, @"-decidePolicyForNavigationAction host: %@", MSID_PII_LOG_TRACKABLE(requestURL.host));
282282

283-
if ([self shouldSendNavigationNotification:requestURL])
283+
if ([self shouldSendNavigationNotification:requestURL navigationAction:navigationAction])
284284
{
285285
[MSIDNotifications notifyWebAuthDidStartLoad:requestURL userInfo:webView ? @{@"webview" : webView} : nil];
286286
}
@@ -550,14 +550,19 @@ - (void)notifyFinishedNavigation:(NSURL *)url webView:(WKWebView *)webView
550550
[self stopSpinner];
551551
}
552552

553-
- (BOOL)shouldSendNavigationNotification:(NSURL *)requestURL
553+
- (BOOL)shouldSendNavigationNotification:(NSURL *)requestURL navigationAction:(WKNavigationAction *)navigationAction
554554
{
555555
NSString *requestURLString = [requestURL.absoluteString lowercaseString];
556556
if ([requestURLString isEqualToString:@"about:blank"] || [requestURLString isEqualToString:@"about:srcdoc"])
557557
{
558558
return NO;
559559
}
560560

561+
if (!navigationAction.targetFrame.isMainFrame)
562+
{
563+
return NO;
564+
}
565+
561566
return YES;
562567
}
563568

0 commit comments

Comments
 (0)