Web Inspector: Add ability to distinguish if a Script was parsed as a module
https://bugs.webkit.org/show_bug.cgi?id=164900
<rdar://problem/29323817>

Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/agents/InspectorDebuggerAgent.cpp:
(Inspector::InspectorDebuggerAgent::didParseSource):
* inspector/protocol/Debugger.json:
Add an optional event parameter to distinguish if a script was a module or not.

Source/WebInspectorUI:

* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.get sourceType):
New property of Scripts. SourceType is either Program or Module.

* UserInterface/Controllers/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.scriptDidParse):
* UserInterface/Protocol/DebuggerObserver.js:
(WebInspector.DebuggerObserver.prototype.scriptParsed):
Convert incoming module boolean into SourceType when creating new Scripts.

* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree):
(WebInspector.ScriptSyntaxTree.prototype._recurse):
(WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):
Update the generic AST for new module specific Esprima types.

* UserInterface/Views/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.textEditorScriptSourceType):
* UserInterface/Views/TextEditor.js:
(WebInspector.TextEditor.prototype._startWorkerPrettyPrint):
For pretty printing correctly state if this is a module or not for Esprima.

LayoutTests:

* inspector/model/parse-script-syntax-tree-expected.txt:
* inspector/model/parse-script-syntax-tree.html:
* inspector/model/resources/module.js: Added.
(import.string_appeared_here.myModule):
* inspector/model/resources/other-module.js: Added.
(myOtherModule):
* inspector/model/resources/program.js: Added.
(myProgram):
* inspector/model/script-sourceType-expected.txt: Added.
* inspector/model/script-sourceType.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209492 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed