NetworkRequest.js 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188
  1. export default class NetworkRequest extends Common.Object{constructor(requestId,url,documentURL,frameId,loaderId,initiator){super();this._requestId=requestId;this._backendRequestId=requestId;this.setUrl(url);this._documentURL=documentURL;this._frameId=frameId;this._loaderId=loaderId;this._initiator=initiator;this._redirectSource=null;this._redirectDestination=null;this._issueTime=-1;this._startTime=-1;this._endTime=-1;this._blockedReason=undefined;this.statusCode=0;this.statusText='';this.requestMethod='';this.requestTime=0;this.protocol='';this.mixedContentType=Protocol.Security.MixedContentType.None;this._initialPriority=null;this._currentPriority=null;this._signedExchangeInfo=null;this._resourceType=Common.resourceTypes.Other;this._contentData=null;this._frames=[];this._eventSourceMessages=[];this._responseHeaderValues={};this._responseHeadersText='';this._requestHeaders=[];this._requestHeaderValues={};this._remoteAddress='';this._referrerPolicy=null;this._securityState=Protocol.Security.SecurityState.Unknown;this._securityDetails=null;this.connectionId='0';this._formParametersPromise=null;this._requestFormDataPromise=(Promise.resolve(null));this._hasExtraRequestInfo=false;this._hasExtraResponseInfo=false;this._blockedRequestCookies=[];this._blockedResponseCookies=[];}
  2. indentityCompare(other){const thisId=this.requestId();const thatId=other.requestId();if(thisId>thatId){return 1;}
  3. if(thisId<thatId){return-1;}
  4. return 0;}
  5. requestId(){return this._requestId;}
  6. backendRequestId(){return this._backendRequestId;}
  7. url(){return this._url;}
  8. isBlobRequest(){return this._url.startsWith('blob:');}
  9. setUrl(x){if(this._url===x){return;}
  10. this._url=x;this._parsedURL=new Common.ParsedURL(x);delete this._queryString;delete this._parsedQueryParameters;delete this._name;delete this._path;}
  11. get documentURL(){return this._documentURL;}
  12. get parsedURL(){return this._parsedURL;}
  13. get frameId(){return this._frameId;}
  14. get loaderId(){return this._loaderId;}
  15. setRemoteAddress(ip,port){this._remoteAddress=ip+':'+port;this.dispatchEventToListeners(Events.RemoteAddressChanged,this);}
  16. remoteAddress(){return this._remoteAddress;}
  17. setReferrerPolicy(referrerPolicy){this._referrerPolicy=referrerPolicy;}
  18. referrerPolicy(){return this._referrerPolicy;}
  19. securityState(){return this._securityState;}
  20. setSecurityState(securityState){this._securityState=securityState;}
  21. securityDetails(){return this._securityDetails;}
  22. setSecurityDetails(securityDetails){this._securityDetails=securityDetails;}
  23. get startTime(){return this._startTime||-1;}
  24. setIssueTime(monotonicTime,wallTime){this._issueTime=monotonicTime;this._wallIssueTime=wallTime;this._startTime=monotonicTime;}
  25. issueTime(){return this._issueTime;}
  26. pseudoWallTime(monotonicTime){return this._wallIssueTime?this._wallIssueTime-this._issueTime+monotonicTime:monotonicTime;}
  27. get responseReceivedTime(){return this._responseReceivedTime||-1;}
  28. set responseReceivedTime(x){this._responseReceivedTime=x;}
  29. get endTime(){return this._endTime||-1;}
  30. set endTime(x){if(this.timing&&this.timing.requestTime){this._endTime=Math.max(x,this.responseReceivedTime);}else{this._endTime=x;if(this._responseReceivedTime>x){this._responseReceivedTime=x;}}
  31. this.dispatchEventToListeners(Events.TimingChanged,this);}
  32. get duration(){if(this._endTime===-1||this._startTime===-1){return-1;}
  33. return this._endTime-this._startTime;}
  34. get latency(){if(this._responseReceivedTime===-1||this._startTime===-1){return-1;}
  35. return this._responseReceivedTime-this._startTime;}
  36. get resourceSize(){return this._resourceSize||0;}
  37. set resourceSize(x){this._resourceSize=x;}
  38. get transferSize(){return this._transferSize||0;}
  39. increaseTransferSize(x){this._transferSize=(this._transferSize||0)+x;}
  40. setTransferSize(x){this._transferSize=x;}
  41. get finished(){return this._finished;}
  42. set finished(x){if(this._finished===x){return;}
  43. this._finished=x;if(x){this.dispatchEventToListeners(Events.FinishedLoading,this);}}
  44. get failed(){return this._failed;}
  45. set failed(x){this._failed=x;}
  46. get canceled(){return this._canceled;}
  47. set canceled(x){this._canceled=x;}
  48. blockedReason(){return this._blockedReason;}
  49. setBlockedReason(reason){this._blockedReason=reason;}
  50. wasBlocked(){return!!this._blockedReason;}
  51. cached(){return(!!this._fromMemoryCache||!!this._fromDiskCache)&&!this._transferSize;}
  52. cachedInMemory(){return!!this._fromMemoryCache&&!this._transferSize;}
  53. fromPrefetchCache(){return!!this._fromPrefetchCache;}
  54. setFromMemoryCache(){this._fromMemoryCache=true;delete this._timing;}
  55. setFromDiskCache(){this._fromDiskCache=true;}
  56. setFromPrefetchCache(){this._fromPrefetchCache=true;}
  57. get fetchedViaServiceWorker(){return!!this._fetchedViaServiceWorker;}
  58. set fetchedViaServiceWorker(x){this._fetchedViaServiceWorker=x;}
  59. initiatedByServiceWorker(){const networkManager=SDK.NetworkManager.forRequest(this);if(!networkManager){return false;}
  60. return networkManager.target().type()===SDK.Target.Type.ServiceWorker;}
  61. get timing(){return this._timing;}
  62. set timing(timingInfo){if(!timingInfo||this._fromMemoryCache){return;}
  63. this._startTime=timingInfo.requestTime;const headersReceivedTime=timingInfo.requestTime+timingInfo.receiveHeadersEnd/1000.0;if((this._responseReceivedTime||-1)<0||this._responseReceivedTime>headersReceivedTime){this._responseReceivedTime=headersReceivedTime;}
  64. if(this._startTime>this._responseReceivedTime){this._responseReceivedTime=this._startTime;}
  65. this._timing=timingInfo;this.dispatchEventToListeners(Events.TimingChanged,this);}
  66. get mimeType(){return this._mimeType;}
  67. set mimeType(x){this._mimeType=x;}
  68. get displayName(){return this._parsedURL.displayName;}
  69. name(){if(this._name){return this._name;}
  70. this._parseNameAndPathFromURL();return this._name;}
  71. path(){if(this._path){return this._path;}
  72. this._parseNameAndPathFromURL();return this._path;}
  73. _parseNameAndPathFromURL(){if(this._parsedURL.isDataURL()){this._name=this._parsedURL.dataURLDisplayName();this._path='';}else if(this._parsedURL.isBlobURL()){this._name=this._parsedURL.url;this._path='';}else if(this._parsedURL.isAboutBlank()){this._name=this._parsedURL.url;this._path='';}else{this._path=this._parsedURL.host+this._parsedURL.folderPathComponents;const networkManager=SDK.NetworkManager.forRequest(this);const inspectedURL=networkManager?networkManager.target().inspectedURL().asParsedURL():null;this._path=this._path.trimURL(inspectedURL?inspectedURL.host:'');if(this._parsedURL.lastPathComponent||this._parsedURL.queryParams){this._name=this._parsedURL.lastPathComponent+(this._parsedURL.queryParams?'?'+this._parsedURL.queryParams:'');}else if(this._parsedURL.folderPathComponents){this._name=this._parsedURL.folderPathComponents.substring(this._parsedURL.folderPathComponents.lastIndexOf('/')+1)+'/';this._path=this._path.substring(0,this._path.lastIndexOf('/'));}else{this._name=this._parsedURL.host;this._path='';}}}
  74. get folder(){let path=this._parsedURL.path;const indexOfQuery=path.indexOf('?');if(indexOfQuery!==-1){path=path.substring(0,indexOfQuery);}
  75. const lastSlashIndex=path.lastIndexOf('/');return lastSlashIndex!==-1?path.substring(0,lastSlashIndex):'';}
  76. get pathname(){return this._parsedURL.path;}
  77. resourceType(){return this._resourceType;}
  78. setResourceType(resourceType){this._resourceType=resourceType;}
  79. get domain(){return this._parsedURL.host;}
  80. get scheme(){return this._parsedURL.scheme;}
  81. redirectSource(){return this._redirectSource;}
  82. setRedirectSource(originatingRequest){this._redirectSource=originatingRequest;}
  83. redirectDestination(){return this._redirectDestination;}
  84. setRedirectDestination(redirectDestination){this._redirectDestination=redirectDestination;}
  85. requestHeaders(){return this._requestHeaders;}
  86. setRequestHeaders(headers){this._requestHeaders=headers;delete this._requestCookies;this.dispatchEventToListeners(Events.RequestHeadersChanged);}
  87. requestHeadersText(){return this._requestHeadersText;}
  88. setRequestHeadersText(text){this._requestHeadersText=text;this.dispatchEventToListeners(Events.RequestHeadersChanged);}
  89. requestHeaderValue(headerName){if(this._requestHeaderValues[headerName]){return this._requestHeaderValues[headerName];}
  90. this._requestHeaderValues[headerName]=this._computeHeaderValue(this.requestHeaders(),headerName);return this._requestHeaderValues[headerName];}
  91. get requestCookies(){if(!this._requestCookies){this._requestCookies=SDK.CookieParser.parseCookie(this.requestHeaderValue('Cookie'));}
  92. return this._requestCookies;}
  93. requestFormData(){if(!this._requestFormDataPromise){this._requestFormDataPromise=SDK.NetworkManager.requestPostData(this);}
  94. return this._requestFormDataPromise;}
  95. setRequestFormData(hasData,data){this._requestFormDataPromise=(hasData&&data===null)?null:Promise.resolve(data);this._formParametersPromise=null;}
  96. _filteredProtocolName(){const protocol=this.protocol.toLowerCase();if(protocol==='h2'){return'http/2.0';}
  97. return protocol.replace(/^http\/2(\.0)?\+/,'http/2.0+');}
  98. requestHttpVersion(){const headersText=this.requestHeadersText();if(!headersText){const version=this.requestHeaderValue('version')||this.requestHeaderValue(':version');if(version){return version;}
  99. return this._filteredProtocolName();}
  100. const firstLine=headersText.split(/\r\n/)[0];const match=firstLine.match(/(HTTP\/\d+\.\d+)$/);return match?match[1]:'HTTP/0.9';}
  101. get responseHeaders(){return this._responseHeaders||[];}
  102. set responseHeaders(x){this._responseHeaders=x;delete this._sortedResponseHeaders;delete this._serverTimings;delete this._responseCookies;this._responseHeaderValues={};this.dispatchEventToListeners(Events.ResponseHeadersChanged);}
  103. get responseHeadersText(){return this._responseHeadersText;}
  104. set responseHeadersText(x){this._responseHeadersText=x;this.dispatchEventToListeners(Events.ResponseHeadersChanged);}
  105. get sortedResponseHeaders(){if(this._sortedResponseHeaders!==undefined){return this._sortedResponseHeaders;}
  106. this._sortedResponseHeaders=this.responseHeaders.slice();this._sortedResponseHeaders.sort(function(a,b){return a.name.toLowerCase().compareTo(b.name.toLowerCase());});return this._sortedResponseHeaders;}
  107. responseHeaderValue(headerName){if(headerName in this._responseHeaderValues){return this._responseHeaderValues[headerName];}
  108. this._responseHeaderValues[headerName]=this._computeHeaderValue(this.responseHeaders,headerName);return this._responseHeaderValues[headerName];}
  109. get responseCookies(){if(!this._responseCookies){this._responseCookies=SDK.CookieParser.parseSetCookie(this.responseHeaderValue('Set-Cookie'));}
  110. return this._responseCookies;}
  111. responseLastModified(){return this.responseHeaderValue('last-modified');}
  112. get serverTimings(){if(typeof this._serverTimings==='undefined'){this._serverTimings=SDK.ServerTiming.parseHeaders(this.responseHeaders);}
  113. return this._serverTimings;}
  114. queryString(){if(this._queryString!==undefined){return this._queryString;}
  115. let queryString=null;const url=this.url();const questionMarkPosition=url.indexOf('?');if(questionMarkPosition!==-1){queryString=url.substring(questionMarkPosition+1);const hashSignPosition=queryString.indexOf('#');if(hashSignPosition!==-1){queryString=queryString.substring(0,hashSignPosition);}}
  116. this._queryString=queryString;return this._queryString;}
  117. get queryParameters(){if(this._parsedQueryParameters){return this._parsedQueryParameters;}
  118. const queryString=this.queryString();if(!queryString){return null;}
  119. this._parsedQueryParameters=this._parseParameters(queryString);return this._parsedQueryParameters;}
  120. async _parseFormParameters(){const requestContentType=this.requestContentType();if(!requestContentType){return null;}
  121. if(requestContentType.match(/^application\/x-www-form-urlencoded\s*(;.*)?$/i)){const formData=await this.requestFormData();if(!formData){return null;}
  122. return this._parseParameters(formData);}
  123. const multipartDetails=requestContentType.match(/^multipart\/form-data\s*;\s*boundary\s*=\s*(\S+)\s*$/);if(!multipartDetails){return null;}
  124. const boundary=multipartDetails[1];if(!boundary){return null;}
  125. const formData=await this.requestFormData();if(!formData){return null;}
  126. return this._parseMultipartFormDataParameters(formData,boundary);}
  127. formParameters(){if(!this._formParametersPromise){this._formParametersPromise=this._parseFormParameters();}
  128. return this._formParametersPromise;}
  129. responseHttpVersion(){const headersText=this._responseHeadersText;if(!headersText){const version=this.responseHeaderValue('version')||this.responseHeaderValue(':version');if(version){return version;}
  130. return this._filteredProtocolName();}
  131. const firstLine=headersText.split(/\r\n/)[0];const match=firstLine.match(/^(HTTP\/\d+\.\d+)/);return match?match[1]:'HTTP/0.9';}
  132. _parseParameters(queryString){function parseNameValue(pair){const position=pair.indexOf('=');if(position===-1){return{name:pair,value:''};}else{return{name:pair.substring(0,position),value:pair.substring(position+1)};}}
  133. return queryString.split('&').map(parseNameValue);}
  134. _parseMultipartFormDataParameters(data,boundary){const sanitizedBoundary=boundary.escapeForRegExp();const keyValuePattern=new RegExp('^\\r\\ncontent-disposition\\s*:\\s*form-data\\s*;\\s*name="([^"]*)"(?:\\s*;\\s*filename="([^"]*)")?'+'(?:\\r\\ncontent-type\\s*:\\s*([^\\r\\n]*))?'+'\\r\\n\\r\\n'+'(.*)'+'\\r\\n$','is');const fields=data.split(new RegExp(`--${sanitizedBoundary}(?:--\s*$)?`,'g'));return fields.reduce(parseMultipartField,[]);function parseMultipartField(result,field){const[match,name,filename,contentType,value]=field.match(keyValuePattern)||[];if(!match){return result;}
  135. const processedValue=(filename||contentType)?ls`(binary)`:value;result.push({name,value:processedValue});return result;}}
  136. _computeHeaderValue(headers,headerName){headerName=headerName.toLowerCase();const values=[];for(let i=0;i<headers.length;++i){if(headers[i].name.toLowerCase()===headerName){values.push(headers[i].value);}}
  137. if(!values.length){return undefined;}
  138. if(headerName==='set-cookie'){return values.join('\n');}
  139. return values.join(', ');}
  140. contentData(){if(this._contentData){return this._contentData;}
  141. if(this._contentDataProvider){this._contentData=this._contentDataProvider();}else{this._contentData=SDK.NetworkManager.requestContentData(this);}
  142. return this._contentData;}
  143. setContentDataProvider(dataProvider){console.assert(!this._contentData,'contentData can only be set once.');this._contentDataProvider=dataProvider;}
  144. contentURL(){return this._url;}
  145. contentType(){return this._resourceType;}
  146. async contentEncoded(){return(await this.contentData()).encoded;}
  147. async requestContent(){const{content,error,encoded}=await this.contentData();return({content,error,isEncoded:encoded,});}
  148. async searchInContent(query,caseSensitive,isRegex){if(!this._contentDataProvider){return SDK.NetworkManager.searchInRequest(this,query,caseSensitive,isRegex);}
  149. const contentData=await this.contentData();let content=contentData.content;if(!content){return[];}
  150. if(contentData.encoded){content=window.atob(content);}
  151. return Common.ContentProvider.performSearchInContent(content,query,caseSensitive,isRegex);}
  152. isHttpFamily(){return!!this.url().match(/^https?:/i);}
  153. requestContentType(){return this.requestHeaderValue('Content-Type');}
  154. hasErrorStatusCode(){return this.statusCode>=400;}
  155. setInitialPriority(priority){this._initialPriority=priority;}
  156. initialPriority(){return this._initialPriority;}
  157. setPriority(priority){this._currentPriority=priority;}
  158. priority(){return this._currentPriority||this._initialPriority||null;}
  159. setSignedExchangeInfo(info){this._signedExchangeInfo=info;}
  160. signedExchangeInfo(){return this._signedExchangeInfo;}
  161. async populateImageSource(image){const{content,encoded}=await this.contentData();let imageSrc=Common.ContentProvider.contentAsDataURL(content,this._mimeType,encoded);if(imageSrc===null&&!this._failed){const cacheControl=this.responseHeaderValue('cache-control')||'';if(!cacheControl.includes('no-cache')){imageSrc=this._url;}}
  162. if(imageSrc!==null){image.src=imageSrc;}}
  163. initiator(){return this._initiator;}
  164. frames(){return this._frames;}
  165. addProtocolFrameError(errorMessage,time){this.addFrame({type:WebSocketFrameType.Error,text:errorMessage,time:this.pseudoWallTime(time),opCode:-1,mask:false});}
  166. addProtocolFrame(response,time,sent){const type=sent?WebSocketFrameType.Send:WebSocketFrameType.Receive;this.addFrame({type:type,text:response.payloadData,time:this.pseudoWallTime(time),opCode:response.opcode,mask:response.mask});}
  167. addFrame(frame){this._frames.push(frame);this.dispatchEventToListeners(Events.WebsocketFrameAdded,frame);}
  168. eventSourceMessages(){return this._eventSourceMessages;}
  169. addEventSourceMessage(time,eventName,eventId,data){const message={time:this.pseudoWallTime(time),eventName:eventName,eventId:eventId,data:data};this._eventSourceMessages.push(message);this.dispatchEventToListeners(Events.EventSourceMessageAdded,message);}
  170. markAsRedirect(redirectCount){this._requestId=`${this._backendRequestId}:redirected.${redirectCount}`;}
  171. setRequestIdForTest(requestId){this._backendRequestId=requestId;this._requestId=requestId;}
  172. charset(){const contentTypeHeader=this.responseHeaderValue('content-type');if(!contentTypeHeader){return null;}
  173. const responseCharsets=contentTypeHeader.replace(/ /g,'').split(';').filter(parameter=>parameter.toLowerCase().startsWith('charset=')).map(parameter=>parameter.slice('charset='.length));if(responseCharsets.length){return responseCharsets[0];}
  174. return null;}
  175. addExtraRequestInfo(extraRequestInfo){this._blockedRequestCookies=extraRequestInfo.blockedRequestCookies;this.setRequestHeaders(extraRequestInfo.requestHeaders);this._hasExtraRequestInfo=true;this.setRequestHeadersText('');}
  176. hasExtraRequestInfo(){return this._hasExtraRequestInfo;}
  177. blockedRequestCookies(){return this._blockedRequestCookies;}
  178. addExtraResponseInfo(extraResponseInfo){this._blockedResponseCookies=extraResponseInfo.blockedResponseCookies;this.responseHeaders=extraResponseInfo.responseHeaders;if(extraResponseInfo.responseHeadersText){this.responseHeadersText=extraResponseInfo.responseHeadersText;if(!this.requestHeadersText()){let requestHeadersText=`${this.requestMethod} ${this.parsedURL.path}`;if(this.parsedURL.queryParams){requestHeadersText+=`?${this.parsedURL.queryParams}`;}
  179. requestHeadersText+=` HTTP/1.1\r\n`;for(const{name,value}of this.requestHeaders()){requestHeadersText+=`${name}: ${value}\r\n`;}
  180. this.setRequestHeadersText(requestHeadersText);}}
  181. this._hasExtraResponseInfo=true;}
  182. hasExtraResponseInfo(){return this._hasExtraResponseInfo;}
  183. blockedResponseCookies(){return this._blockedResponseCookies;}}
  184. export const Events={FinishedLoading:Symbol('FinishedLoading'),TimingChanged:Symbol('TimingChanged'),RemoteAddressChanged:Symbol('RemoteAddressChanged'),RequestHeadersChanged:Symbol('RequestHeadersChanged'),ResponseHeadersChanged:Symbol('ResponseHeadersChanged'),WebsocketFrameAdded:Symbol('WebsocketFrameAdded'),EventSourceMessageAdded:Symbol('EventSourceMessageAdded')};export const InitiatorType={Other:'other',Parser:'parser',Redirect:'redirect',Script:'script',Preload:'preload',SignedExchange:'signedExchange'};export const WebSocketFrameType={Send:'send',Receive:'receive',Error:'error'};export const cookieBlockedReasonToUiString=function(blockedReason){switch(blockedReason){case Protocol.Network.CookieBlockedReason.SecureOnly:return ls`This cookie had the "Secure" attribute and the connection was not secure.`;case Protocol.Network.CookieBlockedReason.NotOnPath:return ls`This cookie's path was not within the request url's path.`;case Protocol.Network.CookieBlockedReason.DomainMismatch:return ls`This cookie's domain is not configured to match the request url's domain, even though they share a common TLD+1 (TLD+1 of foo.bar.example.com is example.com).`;case Protocol.Network.CookieBlockedReason.SameSiteStrict:return ls`This cookie had the "SameSite=Strict" attribute and the request was made on on a different site. This includes navigation requests initiated by other sites.`;case Protocol.Network.CookieBlockedReason.SameSiteLax:return ls`This cookie had the "SameSite=Lax" attribute and the request was made on a different site. This does not include navigation requests initiated by other sites.`;case Protocol.Network.CookieBlockedReason.SameSiteUnspecifiedTreatedAsLax:return ls`This cookie didn't specify a SameSite attribute when it was stored and was defaulted to "SameSite=Lax" and broke the same rules specified in the SameSiteLax value. The cookie had to have been set with "SameSite=None" to enable third-party usage.`;case Protocol.Network.CookieBlockedReason.SameSiteNoneInsecure:return ls`This cookie had the "SameSite=None" attribute but was not marked "Secure". Cookies without SameSite restrictions must be marked "Secure" and sent over a secure connection.`;case Protocol.Network.CookieBlockedReason.UserPreferences:return ls`This cookie was not sent due to user preferences.`;case Protocol.Network.CookieBlockedReason.UnknownError:return ls`An unknown error was encountered when trying to send this cookie.`;}
  185. return'';};export const setCookieBlockedReasonToUiString=function(blockedReason){switch(blockedReason){case Protocol.Network.SetCookieBlockedReason.SecureOnly:return ls`This set-cookie had the "Secure" attribute but was not received over a secure connection.`;case Protocol.Network.SetCookieBlockedReason.SameSiteStrict:return ls`This set-cookie had the "SameSite=Strict" attribute but came from a cross-origin response. This includes navigation requests intitiated by other origins.`;case Protocol.Network.SetCookieBlockedReason.SameSiteLax:return ls`This set-cookie had the "SameSite=Lax" attribute but came from a cross-origin response.`;case Protocol.Network.SetCookieBlockedReason.SameSiteUnspecifiedTreatedAsLax:return ls`This set-cookie didn't specify a "SameSite" attribute and was defaulted to "SameSite=Lax" and broke the same rules specified in the SameSiteLax value.`;case Protocol.Network.SetCookieBlockedReason.SameSiteNoneInsecure:return ls`This set-cookie had the "SameSite=None" attribute but did not have the "Secure" attribute, which is required in order to use "SameSite=None".`;case Protocol.Network.SetCookieBlockedReason.UserPreferences:return ls`This set-cookie was not stored due to user preferences.`;case Protocol.Network.SetCookieBlockedReason.SyntaxError:return ls`This set-cookie had invalid syntax.`;case Protocol.Network.SetCookieBlockedReason.SchemeNotSupported:return ls`The scheme of this connection is not allowed to store cookies.`;case Protocol.Network.SetCookieBlockedReason.OverwriteSecure:return ls`This set-cookie was not sent over a secure connection and would have overwritten a cookie with the Secure attribute.`;case Protocol.Network.SetCookieBlockedReason.InvalidDomain:return ls`This set-cookie's Domain attribute was invalid with regards to the current host url.`;case Protocol.Network.SetCookieBlockedReason.InvalidPrefix:return ls`This set-cookie used the "__Secure-" or "__Host-" prefix in its name and broke the additional rules applied to cookies with these prefixes as defined in https://tools.ietf.org/html/draft-west-cookie-prefixes-05.`;case Protocol.Network.SetCookieBlockedReason.UnknownError:return ls`An unknown error was encountered when trying to store this cookie.`;}
  186. return'';};export const cookieBlockedReasonToAttribute=function(blockedReason){switch(blockedReason){case Protocol.Network.CookieBlockedReason.SecureOnly:return SDK.Cookie.Attributes.Secure;case Protocol.Network.CookieBlockedReason.NotOnPath:return SDK.Cookie.Attributes.Path;case Protocol.Network.CookieBlockedReason.DomainMismatch:return SDK.Cookie.Attributes.Domain;case Protocol.Network.CookieBlockedReason.SameSiteStrict:case Protocol.Network.CookieBlockedReason.SameSiteLax:case Protocol.Network.CookieBlockedReason.SameSiteUnspecifiedTreatedAsLax:case Protocol.Network.CookieBlockedReason.SameSiteNoneInsecure:return SDK.Cookie.Attributes.SameSite;case Protocol.Network.CookieBlockedReason.UserPreferences:case Protocol.Network.CookieBlockedReason.UnknownError:return null;}
  187. return null;};export const setCookieBlockedReasonToAttribute=function(blockedReason){switch(blockedReason){case Protocol.Network.SetCookieBlockedReason.SecureOnly:case Protocol.Network.SetCookieBlockedReason.OverwriteSecure:return SDK.Cookie.Attributes.Secure;case Protocol.Network.SetCookieBlockedReason.SameSiteStrict:case Protocol.Network.SetCookieBlockedReason.SameSiteLax:case Protocol.Network.SetCookieBlockedReason.SameSiteUnspecifiedTreatedAsLax:case Protocol.Network.SetCookieBlockedReason.SameSiteNoneInsecure:return SDK.Cookie.Attributes.SameSite;case Protocol.Network.SetCookieBlockedReason.InvalidDomain:return SDK.Cookie.Attributes.Domain;case Protocol.Network.SetCookieBlockedReason.InvalidPrefix:return SDK.Cookie.Attributes.Name;case Protocol.Network.SetCookieBlockedReason.UserPreferences:case Protocol.Network.SetCookieBlockedReason.SyntaxError:case Protocol.Network.SetCookieBlockedReason.SchemeNotSupported:case Protocol.Network.SetCookieBlockedReason.UnknownError:return null;}
  188. return null;};self.SDK=self.SDK||{};SDK=SDK||{};SDK.NetworkRequest=NetworkRequest;SDK.NetworkRequest.Events=Events;SDK.NetworkRequest.InitiatorType=InitiatorType;SDK.NetworkRequest.WebSocketFrameType=WebSocketFrameType;SDK.NetworkRequest.cookieBlockedReasonToUiString=cookieBlockedReasonToUiString;SDK.NetworkRequest.setCookieBlockedReasonToUiString=setCookieBlockedReasonToUiString;SDK.NetworkRequest.cookieBlockedReasonToAttribute=cookieBlockedReasonToAttribute;SDK.NetworkRequest.setCookieBlockedReasonToAttribute=setCookieBlockedReasonToAttribute;SDK.NetworkRequest.NameValue;SDK.NetworkRequest.WebSocketFrame;SDK.NetworkRequest.EventSourceMessage;SDK.NetworkRequest.ContentData;SDK.NetworkRequest.BlockedCookieWithReason;SDK.NetworkRequest.ExtraRequestInfo;SDK.NetworkRequest.BlockedSetCookieWithReason;SDK.NetworkRequest.ExtraResponseInfo;