@@ -620,7 +620,9 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
620
620
const httpMethod = request . HTTPMethod ;
621
621
const url = request . URL && request . URL . absoluteString ;
622
622
623
- owner . writeTrace ( `webViewDecidePolicyForNavigationActionDecisionHandler: "${ url } "` ) ;
623
+ if ( Trace . isEnabled ( ) ) {
624
+ Trace . write ( `webViewDecidePolicyForNavigationActionDecisionHandler: "${ url } "` , WebViewTraceCategory , Trace . messageType . info ) ;
625
+ }
624
626
if ( ! url ) {
625
627
return ;
626
628
}
@@ -656,16 +658,18 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
656
658
657
659
const shouldOverrideUrlLoading = owner . _onShouldOverrideUrlLoading ( url , httpMethod , navType ) ;
658
660
if ( shouldOverrideUrlLoading === true ) {
659
- owner . writeTrace (
660
- `WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler(" ${ url } ", " ${ navigationAction . navigationType } ") -> method: ${ httpMethod } " ${ navType } " -> cancel`
661
- ) ;
662
- decisionHandler ( WKNavigationActionPolicy . Cancel ) ;
663
-
661
+ if ( Trace . isEnabled ( ) ) {
662
+ Trace . write (
663
+ `WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler(" ${ url } ", " ${ navigationAction . navigationType } ") -> method: ${ httpMethod } " ${ navType } " -> cancel` , WebViewTraceCategory , Trace . messageType . info ) ;
664
+ decisionHandler ( WKNavigationActionPolicy . Cancel ) ;
665
+ }
664
666
return ;
665
667
}
666
668
decisionHandler ( WKNavigationActionPolicy . Allow ) ;
667
669
668
- owner . writeTrace ( `WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler("${ url } ", "${ navigationAction . navigationType } ") -> method:${ httpMethod } "${ navType } "` ) ;
670
+ if ( Trace . isEnabled ( ) ) {
671
+ Trace . write ( `WKNavigationDelegateClass.webViewDecidePolicyForNavigationActionDecisionHandler("${ url } ", "${ navigationAction . navigationType } ") -> method:${ httpMethod } "${ navType } "` , WebViewTraceCategory , Trace . messageType . info ) ;
672
+ }
669
673
owner . _onLoadStarted ( url , navType ) ;
670
674
}
671
675
@@ -675,7 +679,9 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
675
679
return ;
676
680
}
677
681
678
- owner . writeTrace ( `WKNavigationDelegateClass.webViewDidStartProvisionalNavigation("${ webView . URL } ")` ) ;
682
+ if ( Trace . isEnabled ( ) ) {
683
+ Trace . write ( `WKNavigationDelegateClass.webViewDidStartProvisionalNavigation("${ webView . URL } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
684
+ }
679
685
}
680
686
681
687
public webViewDidFinishNavigation ( webView : WKWebView , navigation : WKNavigation ) : void {
@@ -684,7 +690,9 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
684
690
return ;
685
691
}
686
692
687
- owner . writeTrace ( `WKNavigationDelegateClass.webViewDidFinishNavigation("${ webView . URL } ")` ) ;
693
+ if ( Trace . isEnabled ( ) ) {
694
+ Trace . write ( `WKNavigationDelegateClass.webViewDidFinishNavigation("${ webView . URL } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
695
+ }
688
696
let src = owner . src ;
689
697
if ( webView . URL ) {
690
698
src = webView . URL . absoluteString ;
@@ -702,7 +710,9 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
702
710
if ( webView . URL ) {
703
711
src = webView . URL . absoluteString ;
704
712
}
705
- owner . writeTrace ( `WKNavigationDelegateClass.webViewDidFailNavigationWithError("${ error . localizedDescription } ")` ) ;
713
+ if ( Trace . isEnabled ( ) ) {
714
+ Trace . write ( `WKNavigationDelegateClass.webViewDidFailNavigationWithError("${ error . localizedDescription } ")` , WebViewTraceCategory , Trace . messageType . info ) ;
715
+ }
706
716
owner . _onLoadFinished ( src , error . localizedDescription ) . catch ( ( ) => void 0 ) ;
707
717
}
708
718
@@ -717,7 +727,9 @@ export class WKNavigationDelegateNotaImpl extends NSObject implements WKNavigati
717
727
src = webView . URL . absoluteString ;
718
728
}
719
729
720
- owner . writeTrace ( `WKNavigationDelegateClass.webViewDidFailProvisionalNavigationWithError(${ error . localizedDescription } ` ) ;
730
+ if ( Trace . isEnabled ( ) ) {
731
+ Trace . write ( `WKNavigationDelegateClass.webViewDidFailProvisionalNavigationWithError(${ error . localizedDescription } ` , WebViewTraceCategory , Trace . messageType . info ) ;
732
+ }
721
733
owner . _onLoadFinished ( src , error . localizedDescription ) . catch ( ( ) => void 0 ) ;
722
734
}
723
735
}
@@ -745,7 +757,9 @@ export class WKScriptMessageHandlerNotaImpl extends NSObject implements WKScript
745
757
const message = JSON . parse ( webViewMessage . body as string ) ;
746
758
owner . onWebViewEvent ( message . eventName , JSON . parse ( message . data ) ) ;
747
759
} catch ( err ) {
748
- owner . writeTrace ( `userContentControllerDidReceiveScriptMessage(${ userContentController } , ${ webViewMessage } ) - bad message: ${ webViewMessage . body } ` , Trace . messageType . error ) ;
760
+ if ( Trace . isEnabled ( ) ) {
761
+ Trace . write ( `userContentControllerDidReceiveScriptMessage(${ userContentController } , ${ webViewMessage } ) - bad message: ${ webViewMessage . body } ` , WebViewTraceCategory , Trace . messageType . error ) ;
762
+ }
749
763
}
750
764
}
751
765
}
0 commit comments