<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[209492] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/209492">209492</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-12-07 16:04:13 -0800 (Wed, 07 Dec 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>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.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelparsescriptsyntaxtreeexpectedtxt">trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelparsescriptsyntaxtreehtml">trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolDebuggerjson">trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptjs">trunk/Source/WebInspectorUI/UserInterface/Models/Script.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs">trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolDebuggerObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTextEditorjs">trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectormodelresourcesmodulejs">trunk/LayoutTests/inspector/model/resources/module.js</a></li>
<li><a href="#trunkLayoutTestsinspectormodelresourcesothermodulejs">trunk/LayoutTests/inspector/model/resources/other-module.js</a></li>
<li><a href="#trunkLayoutTestsinspectormodelresourcesprogramjs">trunk/LayoutTests/inspector/model/resources/program.js</a></li>
<li><a href="#trunkLayoutTestsinspectormodelscriptsourceTypeexpectedtxt">trunk/LayoutTests/inspector/model/script-sourceType-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelscriptsourceTypehtml">trunk/LayoutTests/inspector/model/script-sourceType.html</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/LayoutTests/ChangeLog        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2016-12-07 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ 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.
+
+ * 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.
+
+2016-12-07 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Update Esprima to support new features / syntax (**, async/await, trailing comma)
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=164830
</span><span class="cx"> <rdar://problem/29293814>
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelparsescriptsyntaxtreeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -45,6 +45,12 @@
</span><span class="cx"> passed ArrowFunctionExpression
</span><span class="cx"> passed Async Functions
</span><span class="cx"> passed AwaitExpression
</span><ins>+passed ImportDeclaration, ImportSpecifier
+passed ImportDefaultSpecifier
+passed ImportNamespaceSpecifier
+passed ExportNamedDeclaration, ExportSpecifier
+passed ExportDefaultDeclaration
+passed ExportAllDeclaration
</ins><span class="cx"> passed computed method on object literal
</span><span class="cx"> passed method on object literal
</span><span class="cx"> passed computed method property on object literal
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelparsescriptsyntaxtreehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -5,11 +5,13 @@
</span><span class="cx"> <script>
</span><span class="cx"> function test()
</span><span class="cx"> {
</span><del>- function makeNode(text, isExpression)
</del><ins>+ function makeNode(text, isExpression, isModule)
</ins><span class="cx"> {
</span><del>- var script = new WebInspector.Script(1, new WebInspector.TextRange(0, text.length));
- var scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(text, script);
- var syntaxTree = scriptSyntaxTree._syntaxTree;
</del><ins>+ const target = null, url = null;
+ let sourceType = isModule ? WebInspector.Script.SourceType.Module : WebInspector.Script.SourceType.Program;
+ let script = new WebInspector.Script(target, 1, new WebInspector.TextRange(0, text.length), url, sourceType);
+ let scriptSyntaxTree = new WebInspector.ScriptSyntaxTree(text, script);
+ let syntaxTree = scriptSyntaxTree._syntaxTree;
</ins><span class="cx">
</span><span class="cx"> InspectorTest.assert(scriptSyntaxTree.parsedSuccessfully, "ScriptSyntaxTree should be able to parse: \"" + text + "\"");
</span><span class="cx"> InspectorTest.assert(syntaxTree.type === WebInspector.ScriptSyntaxTree.NodeType.Program, "Should be program.");
</span><span class="lines">@@ -17,12 +19,22 @@
</span><span class="cx"> if (isExpression) {
</span><span class="cx"> InspectorTest.assert(syntaxTree.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExpressionStatement);
</span><span class="cx"> return syntaxTree.body[0].expression;
</span><del>- } else
</del><ins>+ } else if (isModule) {
+ InspectorTest.assert(syntaxTree.sourceType === "module");
</ins><span class="cx"> return syntaxTree.body[0];
</span><ins>+ } else {
+ InspectorTest.assert(syntaxTree.sourceType === "script");
+ return syntaxTree.body[0];
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- var node = null;
</del><ins>+ function makeNodeForModule(text)
+ {
+ return makeNode(text, false, true);
+ }
</ins><span class="cx">
</span><ins>+ let node = null;
+
</ins><span class="cx"> node = makeNode("x = 20;", true);
</span><span class="cx"> InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression);
</span><span class="cx"> InspectorTest.assert(node.left);
</span><span class="lines">@@ -52,7 +64,7 @@
</span><span class="cx"> InspectorTest.assert(node.elements[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
</span><span class="cx"> InspectorTest.assert(node.elements[1].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
</span><span class="cx"> InspectorTest.log("passed ArrayExpression");
</span><del>-
</del><ins>+
</ins><span class="cx"> node = makeNode("{foo();}", false);
</span><span class="cx"> InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
</span><span class="cx"> InspectorTest.assert(node.body);
</span><span class="lines">@@ -112,7 +124,7 @@
</span><span class="cx"> InspectorTest.assert(node.consequent.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
</span><span class="cx"> InspectorTest.assert(node.alternate.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
</span><span class="cx"> InspectorTest.log("passed ConditionalExpression");
</span><del>-
</del><ins>+
</ins><span class="cx"> node = makeNode("label:while(true) {continue label;}", false);
</span><span class="cx"> InspectorTest.assert(node.body.body.body[0].type === WebInspector.ScriptSyntaxTree.NodeType.ContinueStatement);
</span><span class="cx"> InspectorTest.assert(node.body.body.body[0].label.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
</span><span class="lines">@@ -321,7 +333,7 @@
</span><span class="cx"> InspectorTest.assert(node.right.properties[0].key.type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
</span><span class="cx"> InspectorTest.log("passed Property");
</span><span class="cx">
</span><del>- node = makeNode("function foo(...things) { return things; }", false);
</del><ins>+ node = makeNode("function foo(...things) { return things; }", false);
</ins><span class="cx"> InspectorTest.assert(node.params.length === 1);
</span><span class="cx"> InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.RestElement);
</span><span class="cx"> InspectorTest.assert(node.params[0].argument.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
</span><span class="lines">@@ -550,6 +562,66 @@
</span><span class="cx"> InspectorTest.assert(node.body.body[0].expression.argument.value === 1);
</span><span class="cx"> InspectorTest.log("passed AwaitExpression");
</span><span class="cx">
</span><ins>+
+ // Modules
+
+ node = makeNodeForModule(`import {a,b as x,c} from "module.js"`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+ InspectorTest.assert(node.source.value === "module.js");
+ InspectorTest.assert(node.specifiers.length === 3);
+ InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+ InspectorTest.assert(node.specifiers[0].local.name === "a");
+ InspectorTest.assert(node.specifiers[0].imported.name === "a");
+ InspectorTest.assert(node.specifiers[1].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+ InspectorTest.assert(node.specifiers[1].local.name === "x");
+ InspectorTest.assert(node.specifiers[1].imported.name === "b");
+ InspectorTest.assert(node.specifiers[2].type === WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier);
+ InspectorTest.assert(node.specifiers[2].local.name === "c");
+ InspectorTest.assert(node.specifiers[2].imported.name === "c");
+ InspectorTest.log("passed ImportDeclaration, ImportSpecifier");
+
+ node = makeNodeForModule(`import x from "module.js"`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+ InspectorTest.assert(node.source.value === "module.js");
+ InspectorTest.assert(node.specifiers.length === 1);
+ InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier);
+ InspectorTest.log("passed ImportDefaultSpecifier");
+
+ node = makeNodeForModule(`import * as A from "module.js"`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration);
+ InspectorTest.assert(node.source.value === "module.js");
+ InspectorTest.assert(node.specifiers.length === 1);
+ InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier);
+ InspectorTest.assert(node.specifiers[0].local.name === "A");
+ InspectorTest.log("passed ImportNamespaceSpecifier");
+
+ node = makeNodeForModule(`export {a, b as x, c}`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration);
+ InspectorTest.assert(node.specifiers.length === 3);
+ InspectorTest.assert(node.specifiers[0].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+ InspectorTest.assert(node.specifiers[0].local.name === "a");
+ InspectorTest.assert(node.specifiers[0].exported.name === "a");
+ InspectorTest.assert(node.specifiers[1].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+ InspectorTest.assert(node.specifiers[1].local.name === "b");
+ InspectorTest.assert(node.specifiers[1].exported.name === "x");
+ InspectorTest.assert(node.specifiers[2].type === WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier);
+ InspectorTest.assert(node.specifiers[2].local.name === "c");
+ InspectorTest.assert(node.specifiers[2].exported.name === "c");
+ InspectorTest.log("passed ExportNamedDeclaration, ExportSpecifier");
+
+ node = makeNodeForModule(`export default x`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration);
+ InspectorTest.assert(node.declaration.name === "x");
+ InspectorTest.log("passed ExportDefaultDeclaration");
+
+ node = makeNodeForModule(`export * from "module.js"`);
+ InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration);
+ InspectorTest.assert(node.source.value === "module.js");
+ InspectorTest.log("passed ExportAllDeclaration");
+
+
+ // Divots
+
</ins><span class="cx"> node = makeNode("var o = {['c']() { }};", false);
</span><span class="cx"> // ^
</span><span class="cx"> // type profiling return divot.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelresourcesmodulejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/resources/module.js (0 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/resources/module.js         (rev 0)
+++ trunk/LayoutTests/inspector/model/resources/module.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -0,0 +1,3 @@
</span><ins>+import "./other-module.js"
+
+function myModule() {}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelresourcesothermodulejs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/resources/other-module.js (0 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/resources/other-module.js         (rev 0)
+++ trunk/LayoutTests/inspector/model/resources/other-module.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+function myOtherModule() {}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelresourcesprogramjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/resources/program.js (0 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/resources/program.js         (rev 0)
+++ trunk/LayoutTests/inspector/model/resources/program.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -0,0 +1 @@
</span><ins>+function myProgram() {}
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelscriptsourceTypeexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/script-sourceType-expected.txt (0 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/script-sourceType-expected.txt         (rev 0)
+++ trunk/LayoutTests/inspector/model/script-sourceType-expected.txt        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -0,0 +1,11 @@
</span><ins>+Tests for WebInspector.Script.SourceType.
+
+
+== Running test suite: WebInspector.Script.SourceType
+-- Running test case: WebInspector.Script.SourceType.Program
+PASS: <script> should be SourceType.Program.
+
+-- Running test case: WebInspector.Script.SourceType.Module
+PASS: imported module should be SourceType.Module.
+PASS: <script type="module"> should be SourceType.Module.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelscriptsourceTypehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/script-sourceType.html (0 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/script-sourceType.html         (rev 0)
+++ trunk/LayoutTests/inspector/model/script-sourceType.html        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+<!DOCTYPE html>
+<html>
+<head>
+<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
+<script>
+function triggerProgramScript() {
+ let script = document.createElement("script");
+ script.src = "resources/program.js";
+ document.body.appendChild(script);
+}
+
+function triggerModuleScript() {
+ let script = document.createElement("script");
+ script.type = "module";
+ script.src = "resources/module.js";
+ document.body.appendChild(script);
+}
+
+function test()
+{
+ let suite = InspectorTest.createAsyncSuite("WebInspector.Script.SourceType");
+
+ suite.addTestCase({
+ name: "WebInspector.Script.SourceType.Program",
+ description: "Normal <script src> should be Program.",
+ test(resolve, reject) {
+ InspectorTest.evaluateInPage("triggerProgramScript()");
+ let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+ let script = event.data.script;
+ if (!/program.js$/.test(script.url))
+ return;
+
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
+ InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Program, `<script> should be SourceType.Program.`);
+ resolve();
+ });
+ }
+ });
+
+ suite.addTestCase({
+ name: "WebInspector.Script.SourceType.Module",
+ description: "Module <script type=module> should be Module.",
+ test(resolve, reject) {
+ InspectorTest.evaluateInPage("triggerModuleScript()");
+ let listener = WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, (event) => {
+ let script = event.data.script;
+ if (!/module.js$/.test(script.url))
+ return;
+
+ if (/other-module.js$/.test(script.url)) {
+ InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Module, `imported module should be SourceType.Module.`);
+ return;
+ }
+
+ WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, listener);
+ InspectorTest.expectEqual(script.sourceType, WebInspector.Script.SourceType.Module, `<script type="module"> should be SourceType.Module.`);
+ resolve();
+ });
+ }
+ });
+
+ suite.runTestCasesAndFinish();
+}
+</script>
+</head>
+<body onload="runTest()">
+<p>Tests for WebInspector.Script.SourceType.</p>
+</body>
+</html>
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-12-07 Joseph Pecoraro <pecoraro@apple.com>
+
+ 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.
+
+ * 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.
+
</ins><span class="cx"> 2016-12-07 Simon Fraser <simon.fraser@apple.com>
</span><span class="cx">
</span><span class="cx"> Add system trace points for JavaScript VM entry/exit
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorDebuggerAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorDebuggerAgent.cpp        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -887,11 +887,12 @@
</span><span class="cx"> String sourceURL = script.sourceURL;
</span><span class="cx"> String sourceMappingURL = sourceMapURLForScript(script);
</span><span class="cx">
</span><ins>+ const bool isModule = script.sourceProvider->sourceType() == JSC::SourceProviderSourceType::Module;
</ins><span class="cx"> const bool* isContentScript = script.isContentScript ? &script.isContentScript : nullptr;
</span><span class="cx"> String* sourceURLParam = hasSourceURL ? &sourceURL : nullptr;
</span><span class="cx"> String* sourceMapURLParam = sourceMappingURL.isEmpty() ? nullptr : &sourceMappingURL;
</span><span class="cx">
</span><del>- m_frontendDispatcher->scriptParsed(scriptIDStr, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceURLParam, sourceMapURLParam);
</del><ins>+ m_frontendDispatcher->scriptParsed(scriptIDStr, script.url, script.startLine, script.startColumn, script.endLine, script.endColumn, isContentScript, sourceURLParam, sourceMapURLParam, isModule ? &isModule : nullptr);
</ins><span class="cx">
</span><span class="cx"> m_scripts.set(sourceID, script);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolDebuggerjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Debugger.json        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -304,7 +304,8 @@
</span><span class="cx"> { "name": "endColumn", "type": "integer", "description": "Length of the last line of the script." },
</span><span class="cx"> { "name": "isContentScript", "type": "boolean", "optional": true, "description": "Determines whether this script is a user extension script." },
</span><span class="cx"> { "name": "sourceURL", "type": "string", "optional": true, "description": "sourceURL name of the script (if any)." },
</span><del>- { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." }
</del><ins>+ { "name": "sourceMapURL", "type": "string", "optional": true, "description": "URL of source map associated with script (if any)." },
+ { "name": "module", "type": "boolean", "optional": true, "description": "True if this script was parsed as a module." }
</ins><span class="cx"> ],
</span><span class="cx"> "description": "Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger."
</span><span class="cx"> },
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -1,5 +1,35 @@
</span><span class="cx"> 2016-12-07 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><ins>+ 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.
+
+ * 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.
+
+2016-12-07 Joseph Pecoraro <pecoraro@apple.com>
+
</ins><span class="cx"> Web Inspector: Update Esprima to support new features / syntax (**, async/await, trailing comma)
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=164830
</span><span class="cx"> <rdar://problem/29293814>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersDebuggerManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/DebuggerManager.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -671,7 +671,7 @@
</span><span class="cx"> InspectorFrontendHost.beep();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
</del><ins>+ scriptDidParse(target, scriptIdentifier, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL)
</ins><span class="cx"> {
</span><span class="cx"> // Called from WebInspector.DebuggerObserver.
</span><span class="cx">
</span><span class="lines">@@ -690,7 +690,9 @@
</span><span class="cx"> if (!WebInspector.isDebugUIEnabled() && isWebKitInternalScript(sourceURL))
</span><span class="cx"> return;
</span><span class="cx">
</span><del>- let script = new WebInspector.Script(target, scriptIdentifier, new WebInspector.TextRange(startLine, startColumn, endLine, endColumn), url, isContentScript, sourceURL, sourceMapURL);
</del><ins>+ let range = new WebInspector.TextRange(startLine, startColumn, endLine, endColumn);
+ let sourceType = isModule ? WebInspector.Script.SourceType.Module : WebInspector.Script.SourceType.Program;
+ let script = new WebInspector.Script(target, scriptIdentifier, range, url, sourceType, isContentScript, sourceURL, sourceMapURL);
</ins><span class="cx">
</span><span class="cx"> targetData.addScript(script);
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx">
</span><span class="cx"> WebInspector.Script = class Script extends WebInspector.SourceCode
</span><span class="cx"> {
</span><del>- constructor(target, id, range, url, injected, sourceURL, sourceMapURL)
</del><ins>+ constructor(target, id, range, url, sourceType, injected, sourceURL, sourceMapURL)
</ins><span class="cx"> {
</span><span class="cx"> super();
</span><span class="cx">
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> this._id = id || null;
</span><span class="cx"> this._range = range || null;
</span><span class="cx"> this._url = url || null;
</span><ins>+ this._sourceType = sourceType || WebInspector.Script.SourceType.Program;
</ins><span class="cx"> this._sourceURL = sourceURL || null;
</span><span class="cx"> this._sourceMappingURL = sourceMapURL || null;
</span><span class="cx"> this._injected = injected || false;
</span><span class="lines">@@ -77,26 +78,15 @@
</span><span class="cx">
</span><span class="cx"> // Public
</span><span class="cx">
</span><del>- get target()
- {
- return this._target;
- }
</del><ins>+ get target() { return this._target; }
+ get id() { return this._id; }
+ get range() { return this._range; }
+ get url() { return this._url; }
+ get sourceType() { return this._sourceType; }
+ get sourceURL() { return this._sourceURL; }
+ get sourceMappingURL() { return this._sourceMappingURL; }
+ get injected() { return this._injected; }
</ins><span class="cx">
</span><del>- get id()
- {
- return this._id;
- }
-
- get range()
- {
- return this._range;
- }
-
- get url()
- {
- return this._url;
- }
-
</del><span class="cx"> get contentIdentifier()
</span><span class="cx"> {
</span><span class="cx"> if (this._url)
</span><span class="lines">@@ -119,16 +109,6 @@
</span><span class="cx"> return this._sourceURL;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get sourceURL()
- {
- return this._sourceURL;
- }
-
- get sourceMappingURL()
- {
- return this._sourceMappingURL;
- }
-
</del><span class="cx"> get urlComponents()
</span><span class="cx"> {
</span><span class="cx"> if (!this._urlComponents)
</span><span class="lines">@@ -179,11 +159,6 @@
</span><span class="cx"> return null;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- get injected()
- {
- return this._injected;
- }
-
</del><span class="cx"> get dynamicallyAddedScriptElement()
</span><span class="cx"> {
</span><span class="cx"> return this._dynamicallyAddedScriptElement;
</span><span class="lines">@@ -315,6 +290,11 @@
</span><span class="cx"> }
</span><span class="cx"> };
</span><span class="cx">
</span><ins>+WebInspector.Script.SourceType = {
+ Program: "script-source-type-program",
+ Module: "script-source-type-module",
+};
+
</ins><span class="cx"> WebInspector.Script.TypeIdentifier = "script";
</span><span class="cx"> WebInspector.Script.URLCookieKey = "script-url";
</span><span class="cx"> WebInspector.Script.DisplayNameCookieKey = "script-display-name";
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -34,7 +34,8 @@
</span><span class="cx"> this._script = script;
</span><span class="cx">
</span><span class="cx"> try {
</span><del>- var esprimaSyntaxTree = esprima.parse(sourceText, {range: true});
</del><ins>+ let sourceType = this._script.sourceType === WebInspector.Script.SourceType.Module ? "module" : "script";
+ let esprimaSyntaxTree = esprima.parse(sourceText, {range: true, sourceType});
</ins><span class="cx"> this._syntaxTree = this._createInternalSyntaxTree(esprimaSyntaxTree);
</span><span class="cx"> this._parsedSuccessfully = true;
</span><span class="cx"> } catch (error) {
</span><span class="lines">@@ -487,6 +488,39 @@
</span><span class="cx"> case WebInspector.ScriptSyntaxTree.NodeType.YieldExpression:
</span><span class="cx"> this._recurse(node.argument, callback, state);
</span><span class="cx"> break;
</span><ins>+
+ // Modules.
+
+ case WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration:
+ this._recurse(node.source, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration:
+ this._recurse(node.declaration, callback, state);
+ this._recurseArray(node.specifiers, callback, state);
+ this._recurse(node.source, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration:
+ this._recurse(node.declaration, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier:
+ this._recurse(node.local, callback, state);
+ this._recurse(node.exported, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration:
+ this._recurseArray(node.specifiers, callback, state);
+ this._recurse(node.source, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier:
+ this._recurse(node.local, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier:
+ this._recurse(node.local, callback, state);
+ break;
+ case WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier:
+ this._recurse(node.imported, callback, state);
+ this._recurse(node.local, callback, state);
+ break;
+
</ins><span class="cx"> // All the leaf nodes go here.
</span><span class="cx"> case WebInspector.ScriptSyntaxTree.NodeType.DebuggerStatement:
</span><span class="cx"> case WebInspector.ScriptSyntaxTree.NodeType.EmptyStatement:
</span><span class="lines">@@ -938,6 +972,63 @@
</span><span class="cx"> delegate: node.delegate
</span><span class="cx"> };
</span><span class="cx"> break;
</span><ins>+
+ // Modules.
+
+ case "ExportAllDeclaration":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ExportAllDeclaration,
+ source: this._createInternalSyntaxTree(node.source),
+ };
+ break;
+ case "ExportNamedDeclaration":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ExportNamedDeclaration,
+ declaration: this._createInternalSyntaxTree(node.declaration),
+ specifiers: node.specifiers.map(this._createInternalSyntaxTree, this),
+ source: this._createInternalSyntaxTree(node.source),
+ };
+ break;
+ case "ExportDefaultDeclaration":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ExportDefaultDeclaration,
+ declaration: this._createInternalSyntaxTree(node.declaration),
+ };
+ break;
+ case "ExportSpecifier":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ExportSpecifier,
+ local: this._createInternalSyntaxTree(node.local),
+ exported: this._createInternalSyntaxTree(node.exported),
+ };
+ break;
+ case "ImportDeclaration":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ImportDeclaration,
+ specifiers: node.specifiers.map(this._createInternalSyntaxTree, this),
+ source: this._createInternalSyntaxTree(node.source),
+ };
+ break;
+ case "ImportDefaultSpecifier":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ImportDefaultSpecifier,
+ local: this._createInternalSyntaxTree(node.local),
+ };
+ break;
+ case "ImportNamespaceSpecifier":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ImportNamespaceSpecifier,
+ local: this._createInternalSyntaxTree(node.local),
+ };
+ break;
+ case "ImportSpecifier":
+ result = {
+ type: WebInspector.ScriptSyntaxTree.NodeType.ImportSpecifier,
+ imported: this._createInternalSyntaxTree(node.imported),
+ local: this._createInternalSyntaxTree(node.local),
+ };
+ break;
+
</ins><span class="cx"> default:
</span><span class="cx"> console.error("Unsupported Syntax Tree Node: " + node.type, node);
</span><span class="cx"> return null;
</span><span class="lines">@@ -977,6 +1068,10 @@
</span><span class="cx"> DebuggerStatement: Symbol("debugger-statement"),
</span><span class="cx"> DoWhileStatement: Symbol("do-while-statement"),
</span><span class="cx"> EmptyStatement: Symbol("empty-statement"),
</span><ins>+ ExportAllDeclaration: Symbol("export-all-declaration"),
+ ExportDefaultDeclaration: Symbol("export-default-declaration"),
+ ExportNamedDeclaration: Symbol("export-named-declaration"),
+ ExportSpecifier: Symbol("export-specifier"),
</ins><span class="cx"> ExpressionStatement: Symbol("expression-statement"),
</span><span class="cx"> ForInStatement: Symbol("for-in-statement"),
</span><span class="cx"> ForOfStatement: Symbol("for-of-statement"),
</span><span class="lines">@@ -985,6 +1080,10 @@
</span><span class="cx"> FunctionExpression: Symbol("function-expression"),
</span><span class="cx"> Identifier: Symbol("identifier"),
</span><span class="cx"> IfStatement: Symbol("if-statement"),
</span><ins>+ ImportDeclaration: Symbol("import-declaration"),
+ ImportDefaultSpecifier: Symbol("import-default-specifier"),
+ ImportNamespaceSpecifier: Symbol("import-namespace-specifier"),
+ ImportSpecifier: Symbol("import-specifier"),
</ins><span class="cx"> LabeledStatement: Symbol("labeled-statement"),
</span><span class="cx"> Literal: Symbol("literal"),
</span><span class="cx"> LogicalExpression: Symbol("logical-expression"),
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolDebuggerObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/DebuggerObserver.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -37,7 +37,7 @@
</span><span class="cx"> WebInspector.debuggerManager.reset();
</span><span class="cx"> }
</span><span class="cx">
</span><del>- scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL)
</del><ins>+ scriptParsed(scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL, isModule)
</ins><span class="cx"> {
</span><span class="cx"> if (this._legacyScriptParsed) {
</span><span class="cx"> // COMPATIBILITY (iOS 9): Debugger.scriptParsed had slightly different arguments.
</span><span class="lines">@@ -46,11 +46,11 @@
</span><span class="cx"> let legacySourceMapURL = arguments[7];
</span><span class="cx"> let hasSourceURL = arguments[8];
</span><span class="cx"> let legacySourceURL = hasSourceURL ? url : undefined;
</span><del>- WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, legacySourceURL, legacySourceMapURL);
</del><ins>+ WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, legacySourceURL, legacySourceMapURL);
</ins><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx">
</span><del>- WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isContentScript, sourceURL, sourceMapURL);
</del><ins>+ WebInspector.debuggerManager.scriptDidParse(this.target, scriptId, url, startLine, startColumn, endLine, endColumn, isModule, isContentScript, sourceURL, sourceMapURL);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> scriptFailedToParse(url, scriptSource, startLine, errorLine, errorMessage)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsSourceCodeTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/SourceCodeTextEditor.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -1183,6 +1183,12 @@
</span><span class="cx"> return this._sourceCode.url;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ textEditorScriptSourceType(textEditor)
+ {
+ let script = this._getAssociatedScript();
+ return script ? script.sourceType : WebInspector.Script.SourceType.Program;
+ }
+
</ins><span class="cx"> textEditorShouldHideLineNumber(textEditor, lineNumber)
</span><span class="cx"> {
</span><span class="cx"> return lineNumber in this._invalidLineNumbers;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTextEditorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js (209491 => 209492)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js        2016-12-08 00:04:07 UTC (rev 209491)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TextEditor.js        2016-12-08 00:04:13 UTC (rev 209492)
</span><span class="lines">@@ -839,8 +839,8 @@
</span><span class="cx"> let indentString = WebInspector.indentString();
</span><span class="cx"> const includeSourceMapData = true;
</span><span class="cx">
</span><del>- // FIXME: Properly pass if this is a module or script.
- const isModule = false;
</del><ins>+ let sourceType = this._delegate.textEditorScriptSourceType(this);
+ const isModule = sourceType === WebInspector.Script.SourceType.Module;
</ins><span class="cx">
</span><span class="cx"> let workerProxy = WebInspector.FormatterWorkerProxy.singleton();
</span><span class="cx"> workerProxy.formatJavaScript(sourceText, isModule, indentString, includeSourceMapData, ({formattedText, sourceMapData}) => {
</span></span></pre>
</div>
</div>
</body>
</html>