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/WebInspectorUI/UserInterface/Test/InspectorProtocol.js

    r190191 r191135  
    9090
    9191    if (ProtocolTest.dumpInspectorProtocolMessages)
    92         console.log(`frontend: ${messageString}`);
     92        InspectorFrontendHost.unbufferedLog(`frontend: ${messageString}`);
    9393
    9494    InspectorFrontendHost.sendMessageToBackend(messageString);
     
    135135    // by InspectorProtocol. Return messages should be dumped by InspectorBackend.
    136136    if (ProtocolTest.dumpInspectorProtocolMessages)
    137         console.log("backend: " + JSON.stringify(messageObject));
     137        InspectorFrontendHost.unbufferedLog("backend: " + JSON.stringify(messageObject));
    138138
    139139    // If the message has an id, then it is a reply to a command.
Note: See TracChangeset for help on using the changeset viewer.