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 {
898898 redirectedFrom = request . request ;
899899 }
900900 }
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+
902907 // TODO(einbinder) this will fail if we are an XHR document request
903908 const isNavigationRequest = event . type === 'Document' ;
904909 const documentId = isNavigationRequest ? event . loaderId : undefined ;
@@ -919,8 +924,10 @@ export class WKPage implements PageDelegate {
919924
920925 _onRequestIntercepted ( event : Protocol . Network . requestInterceptedPayload ) {
921926 const request = this . _requestIdToRequest . get ( event . requestId ) ;
922- if ( ! request )
927+ if ( ! request ) {
928+ this . _session . sendMayFail ( 'Network.interceptRequestWithError' , { errorType : 'Cancellation' , requestId : event . requestId } ) ;
923929 return ;
930+ }
924931 if ( ! request . _allowInterception ) {
925932 // Intercepted, although we do not intend to allow interception.
926933 // Just continue.
You can’t perform that action at this time.
0 commit comments