File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -898,7 +898,12 @@ export class WKPage implements PageDelegate {
898
898
redirectedFrom = request . request ;
899
899
}
900
900
}
901
- const frame = this . _page . _frameManager . frame ( event . frameId ) ! ;
901
+ const frame = redirectedFrom ? redirectedFrom . frame ( ) : this . _page . _frameManager . frame ( event . frameId ) ;
902
+ // sometimes we get stray network events for detached frames
903
+ // TODO(einbinder) why?
904
+ if ( ! frame )
905
+ return ;
906
+
902
907
// TODO(einbinder) this will fail if we are an XHR document request
903
908
const isNavigationRequest = event . type === 'Document' ;
904
909
const documentId = isNavigationRequest ? event . loaderId : undefined ;
@@ -919,8 +924,10 @@ export class WKPage implements PageDelegate {
919
924
920
925
_onRequestIntercepted ( event : Protocol . Network . requestInterceptedPayload ) {
921
926
const request = this . _requestIdToRequest . get ( event . requestId ) ;
922
- if ( ! request )
927
+ if ( ! request ) {
928
+ this . _session . sendMayFail ( 'Network.interceptRequestWithError' , { errorType : 'Cancellation' , requestId : event . requestId } ) ;
923
929
return ;
930
+ }
924
931
if ( ! request . _allowInterception ) {
925
932
// Intercepted, although we do not intend to allow interception.
926
933
// Just continue.
You can’t perform that action at this time.
0 commit comments