Ignore:
Timestamp:
Oct 15, 2015, 1:50:02 PM (10 years ago)
Author:
[email protected]
Message:

Web Inspector: JavaScriptCore should parse sourceURL and sourceMappingURL directives
https://bugs.webkit.org/show_bug.cgi?id=150096

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2015-10-15
Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

  • inspector/ContentSearchUtilities.cpp:

(Inspector::ContentSearchUtilities::scriptCommentPattern): Deleted.
(Inspector::ContentSearchUtilities::findScriptSourceURL): Deleted.
(Inspector::ContentSearchUtilities::findScriptSourceMapURL): Deleted.

  • inspector/ContentSearchUtilities.h:

No longer need to search script content.

  • inspector/ScriptDebugServer.cpp:

(Inspector::ScriptDebugServer::dispatchDidParseSource):
Carry over the sourceURL and sourceMappingURL from the SourceProvider.

  • inspector/agents/InspectorDebuggerAgent.cpp:

(Inspector::InspectorDebuggerAgent::sourceMapURLForScript):
(Inspector::InspectorDebuggerAgent::didParseSource):
No longer do content searching.

  • parser/Lexer.cpp:

(JSC::Lexer<T>::setCode):
(JSC::Lexer<T>::skipWhitespace):
(JSC::Lexer<T>::parseCommentDirective):
(JSC::Lexer<T>::parseCommentDirectiveValue):
(JSC::Lexer<T>::consume):
(JSC::Lexer<T>::lex):

  • parser/Lexer.h:

(JSC::Lexer::sourceURL):
(JSC::Lexer::sourceMappingURL):
(JSC::Lexer::sourceProvider): Deleted.
Give lexer the ability to detect script comment directives.
This just consumes characters in single line comments and
ultimately sets the sourceURL or sourceMappingURL found.

  • parser/Parser.h:

(JSC::Parser<LexerType>::parse):

  • parser/SourceProvider.h:

(JSC::SourceProvider::url):
(JSC::SourceProvider::sourceURL):
(JSC::SourceProvider::sourceMappingURL):
(JSC::SourceProvider::setSourceURL):
(JSC::SourceProvider::setSourceMappingURL):
After parsing a script, update the Source Provider with the
value of directives that may have been found in the script.

Source/WebInspectorUI:

  • UserInterface/Test/InspectorProtocol.js:

(InspectorProtocol._sendMessage):
(InspectorProtocol.dispatchMessageFromBackend):
This is only used for tests, so avoid console.log
and just dump directly to the system console.

LayoutTests:

  • inspector/debugger/sourceURLs-expected.txt: Added.
  • inspector/debugger/sourceURLs.html: Added.

sourceURL and sourceMappingURL detection.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r191134 r191135  
     12015-10-15  Joseph Pecoraro  <[email protected]>
     2
     3        Web Inspector: JavaScriptCore should parse sourceURL and sourceMappingURL directives
     4        https://bugs.webkit.org/show_bug.cgi?id=150096
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * inspector/ContentSearchUtilities.cpp:
     9        (Inspector::ContentSearchUtilities::scriptCommentPattern): Deleted.
     10        (Inspector::ContentSearchUtilities::findScriptSourceURL): Deleted.
     11        (Inspector::ContentSearchUtilities::findScriptSourceMapURL): Deleted.
     12        * inspector/ContentSearchUtilities.h:
     13        No longer need to search script content.
     14
     15        * inspector/ScriptDebugServer.cpp:
     16        (Inspector::ScriptDebugServer::dispatchDidParseSource):
     17        Carry over the sourceURL and sourceMappingURL from the SourceProvider.
     18
     19        * inspector/agents/InspectorDebuggerAgent.cpp:
     20        (Inspector::InspectorDebuggerAgent::sourceMapURLForScript):
     21        (Inspector::InspectorDebuggerAgent::didParseSource):
     22        No longer do content searching.
     23
     24        * parser/Lexer.cpp:
     25        (JSC::Lexer<T>::setCode):
     26        (JSC::Lexer<T>::skipWhitespace):
     27        (JSC::Lexer<T>::parseCommentDirective):
     28        (JSC::Lexer<T>::parseCommentDirectiveValue):
     29        (JSC::Lexer<T>::consume):
     30        (JSC::Lexer<T>::lex):
     31        * parser/Lexer.h:
     32        (JSC::Lexer::sourceURL):
     33        (JSC::Lexer::sourceMappingURL):
     34        (JSC::Lexer::sourceProvider): Deleted.
     35        Give lexer the ability to detect script comment directives.
     36        This just consumes characters in single line comments and
     37        ultimately sets the sourceURL or sourceMappingURL found.
     38
     39        * parser/Parser.h:
     40        (JSC::Parser<LexerType>::parse):
     41        * parser/SourceProvider.h:
     42        (JSC::SourceProvider::url):
     43        (JSC::SourceProvider::sourceURL):
     44        (JSC::SourceProvider::sourceMappingURL):
     45        (JSC::SourceProvider::setSourceURL):
     46        (JSC::SourceProvider::setSourceMappingURL):
     47        After parsing a script, update the Source Provider with the
     48        value of directives that may have been found in the script.
     49
    1502015-10-15  Filip Pizlo  <[email protected]>
    251
Note: See TracChangeset for help on using the changeset viewer.