Changeset 274230 in webkit


Ignore:
Timestamp:
Mar 10, 2021 12:43:35 PM (17 months ago)
Author:
Nikita Vasilyev
Message:

Web Inspector: Syntax highlighting for JSX is incorrect
https://bugs.webkit.org/show_bug.cgi?id=217613
<rdar://problem/70210975>

Reviewed by BJ Burg.

Out of the box, React specifies the "js" extension for JSX files.
Use JSX mode for source map resources with the "js" extension. This
appears to match what the other browsers' developer tools do.

  • UserInterface/Models/SourceMapResource.js:

(WI.SourceMapResource):

Location:
trunk/Source/WebInspectorUI
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r274229 r274230  
     12021-03-10  Nikita Vasilyev  <nvasilyev@apple.com>
     2
     3        Web Inspector: Syntax highlighting for JSX is incorrect
     4        https://bugs.webkit.org/show_bug.cgi?id=217613
     5        <rdar://problem/70210975>
     6
     7        Reviewed by BJ Burg.
     8
     9        Out of the box, React specifies the "js" extension for JSX files.
     10        Use JSX mode for source map resources with the "js" extension. This
     11        appears to match what the other browsers' developer tools do.
     12
     13        * UserInterface/Models/SourceMapResource.js:
     14        (WI.SourceMapResource):
     15
    1162021-03-10  Razvan Caliman  <rcaliman@apple.com>
    217
  • trunk/Source/WebInspectorUI/UserInterface/Models/SourceMapResource.js

    r262302 r274230  
    3737        var inheritedMIMEType = this._sourceMap.originalSourceCode instanceof WI.Resource ? this._sourceMap.originalSourceCode.syntheticMIMEType : null;
    3838
    39         var fileExtension = WI.fileExtensionForURL(url) || "";
    40         var fileExtensionMIMEType = WI.mimeTypeForFileExtension(fileExtension, true);
     39        let fileExtension = WI.fileExtensionForURL(url) || "";
     40
     41        // React serves JSX resources with "js" extension.
     42        let fileExtensionMIMEType = fileExtension === "js" ? "text/jsx" : WI.mimeTypeForFileExtension(fileExtension, true);
    4143
    4244        // FIXME: This is a layering violation. It should use a helper function on the
Note: See TracChangeset for help on using the changeset viewer.