Bug 199861

Summary: Web Inspector: application/xml content not shown
Product: WebKit Reporter: Olivier Blin <olivier.blin>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, hi, inspector-bugzilla-changes, joepeck, loic.yhuel, mcatanzaro, webkit-bug-importer, zan
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Olivier Blin 2019-07-17 08:18:29 PDT
application/xml content from XHR requests is not shown in the inspector.
In the network request preview tab, this error message is displayed instead: "An error occurred trying to load the resource."

application/xml content should be treated as text, since application/xml is the standard mimetype for XML content.
Apache serves XML content with the application/xml mimetype by default.
Comment 1 Olivier Blin 2019-07-17 08:26:29 PDT
Created attachment 374294 [details]
Patch
Comment 2 Devin Rousso 2019-07-17 09:04:27 PDT
Comment on attachment 374294 [details]
Patch

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

r=me, nice catch!  If need someone else to cq+ (or r+ again), just let me know.

> Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js:290
> +        "application/xml": "xml",

We already have a mapping above for "text/xml" (>173), so please move just this line to be after that.

> Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js:325
> +    if (extension === "js" || extension === "json" || extension === "xml")

This shouldn't be added to this `if`, as it doesn't apply to the comment.  If anything, I'd restructure a bit of this function:
```js
    let extension = WI.fileExtensionForMIMEType(mimeType);
    if (extension === "xml")
        return true;

    // Various script/JSON mime types.
    if (extension === "js" || extension === "json")
        return true;

    // Various media text mime types.
    if (extension === "m3u8" || extension === "m3u")
        return true;
```
Comment 3 Olivier Blin 2019-07-17 12:31:34 PDT
Created attachment 374316 [details]
Patch
Comment 4 Olivier Blin 2019-07-17 12:34:50 PDT
Comment on attachment 374294 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js:290
>> +        "application/xml": "xml",
> 
> We already have a mapping above for "text/xml" (>173), so please move just this line to be after that.

Ok, even if content with application/xml mimetype does not really belong to the "Document" group.

>> Source/WebInspectorUI/UserInterface/Base/MIMETypeUtilities.js:325
>> +    if (extension === "js" || extension === "json" || extension === "xml")
> 
> This shouldn't be added to this `if`, as it doesn't apply to the comment.  If anything, I'd restructure a bit of this function:
> ```js
>     let extension = WI.fileExtensionForMIMEType(mimeType);
>     if (extension === "xml")
>         return true;
> 
>     // Various script/JSON mime types.
>     if (extension === "js" || extension === "json")
>         return true;
> 
>     // Various media text mime types.
>     if (extension === "m3u8" || extension === "m3u")
>         return true;
> ```

Done

Thanks for the review!
Comment 5 Devin Rousso 2019-07-17 12:50:26 PDT
Comment on attachment 374316 [details]
Patch

r=me, thanks :)
Comment 6 WebKit Commit Bot 2019-07-17 13:39:34 PDT
Comment on attachment 374316 [details]
Patch

Clearing flags on attachment: 374316

Committed r247533: <https://trac.webkit.org/changeset/247533>
Comment 7 WebKit Commit Bot 2019-07-17 13:39:36 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-07-17 13:40:22 PDT
<rdar://problem/53218724>