Bug 213411

Summary: Web Inspector: do not report data on the rejected intercepted CORS request
Product: WebKit Reporter: Pavel Feldman <pfeldman>
Component: Web InspectorAssignee: Pavel Feldman <pfeldman>
Status: NEW ---    
Severity: Normal CC: ews-watchlist, hi, inspector-bugzilla-changes, joepeck
Priority: P2    
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch hi: review+, pfeldman: commit-queue?

Description Pavel Feldman 2020-06-19 15:37:53 PDT
Resource can become disregarded right after the call to `didReceiveResponse`. Do not report received buffer and loading finished to such request.
Comment 1 Pavel Feldman 2020-06-19 15:40:40 PDT
Created attachment 402339 [details]
Patch
Comment 2 Devin Rousso 2020-06-22 17:46:04 PDT
Comment on attachment 402339 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=402339&action=review

r=me

> Source/WebCore/inspector/agents/InspectorNetworkAgent.cpp:1295
> +            return;

Style: please add a newline after this `return`

> LayoutTests/http/tests/inspector/network/intercept-cors-request.html:12
> +        let response = await fetch("http://localhost:8000/data", { mode: "cors" });

Style: no space after `{` or before `}` when inlined

> LayoutTests/http/tests/inspector/network/intercept-cors-request.html:15
> +        return { error: e.message };

Ditto (:12)

> LayoutTests/http/tests/inspector/network/intercept-cors-request.html:21
> +    InspectorTest.debug();

oops

> LayoutTests/http/tests/inspector/network/intercept-cors-request.html:58
> +        name: "Network.interceptRequestWithResponse.CORS allow origin",

NIT: we usually don't use spaces in test case names, preferring camel casing and periods.
```
    name: "Network.interceptRequestWithResponse.CORS.Origin.Allow",
```

> LayoutTests/http/tests/inspector/network/intercept-cors-request.html:66
> +        name: "Network.interceptRequestWithResponse.CORS disallow origin",

Ditto (:58)
```
    name: "Network.interceptRequestWithResponse.CORS.Origin.Disallow",
```