<!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>[200065] 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/200065">200065</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-04-25 17:44:52 -0700 (Mon, 25 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: React.js JSXTransformer produces bogus error locations
https://bugs.webkit.org/show_bug.cgi?id=150010
&lt;rdar://problem/23062233&gt;

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

Show dynamically added &lt;script&gt; elements added to a frame as resources.
For cases where the scripts had source map resources or error messages
we have a root from which to associate them to.

* Localizations/en.lproj/localizedStrings.js:
&quot;Script Element %d&quot; tree element title.

* UserInterface/Models/Frame.js:
(WebInspector.Frame.prototype.commitProvisionalLoad):
(WebInspector.Frame.prototype.get extraScripts):
(WebInspector.Frame.prototype.addExtraScript):
Have a frame keep a list of its extra scripts.

* UserInterface/Models/Script.js:
(WebInspector.Script):
(WebInspector.Script.prototype.get displayName):
(WebInspector.Script.prototype.get dynamicallyAddedScriptElement):
Identify dynamically added script elements and associate them
with the frame, instead of the frame's main resource.

* UserInterface/Views/FrameTreeElement.js:
(WebInspector.FrameTreeElement.prototype.onpopulate):
(WebInspector.FrameTreeElement.prototype._extraScriptAdded):
Show named / source mapped dynamic script elements under a frame.

* UserInterface/Views/ResourceSidebarPanel.js:
(WebInspector.ResourceSidebarPanel.prototype._scriptWasAdded):
Dynamically added script element Scripts will be added by the frame that
owns them.

* UserInterface/Views/ScriptTreeElement.js:
(WebInspector.ScriptTreeElement):
Don't include a subtitle for dynamicallyAddedScriptElement, details match
the frame that owns them.

LayoutTests:

* inspector/model/frame-extra-scripts-expected.txt: Added.
* inspector/model/frame-extra-scripts.html: Added.
Add a test for a WebInspector.Frame's extraScripts list.

* inspector/model/script-resource-relationship-expected.txt
* inspector/model/script-resource-relationship.html
Add a test for a dynamicallyAddedScriptElement.
Remove debug logging.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelscriptresourcerelationshipexpectedtxt">trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelscriptresourcerelationshiphtml">trunk/LayoutTests/inspector/model/script-resource-relationship.html</a></li>
<li><a href="#trunkLayoutTestsinspectormodelstacktraceexpectedtxt">trunk/LayoutTests/inspector/model/stack-trace-expected.txt</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsFramejs">trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptjs">trunk/Source/WebInspectorUI/UserInterface/Models/Script.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsFrameTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs">trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsScriptTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectormodelframeextrascriptsexpectedtxt">trunk/LayoutTests/inspector/model/frame-extra-scripts-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelframeextrascriptshtml">trunk/LayoutTests/inspector/model/frame-extra-scripts.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/LayoutTests/ChangeLog        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2016-04-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: React.js JSXTransformer produces bogus error locations
+        https://bugs.webkit.org/show_bug.cgi?id=150010
+        &lt;rdar://problem/23062233&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/model/frame-extra-scripts-expected.txt: Added.
+        * inspector/model/frame-extra-scripts.html: Added.
+        Add a test for a WebInspector.Frame's extraScripts list.
+
+        * inspector/model/stack-trace-expected.txt:
+        Update output that we correctly get the sourceURL of the inner script.
+
+        * inspector/model/script-resource-relationship-expected.txt
+        * inspector/model/script-resource-relationship.html
+        Add a test for a dynamicallyAddedScriptElement.
+        Remove debug logging.
+
</ins><span class="cx"> 2016-04-25  Ryan Haddad  &lt;ryanhaddad@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Skip fast/layers/no-clipping-overflow-hidden-added-after-transform.html on mac-wk1 debug
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelframeextrascriptsexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/frame-extra-scripts-expected.txt (0 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/frame-extra-scripts-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/model/frame-extra-scripts-expected.txt        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -0,0 +1,13 @@
</span><ins>+CONSOLE MESSAGE: line 1: dynamically added script element
+WebInspector.Frame.extraScripts.
+
+
+== Running test suite: WebInspector.Frame.extraScripts
+-- Running test case: FrameHasNoExtraScriptsYet
+PASS: Main frame should have no dynamic scripts.
+
+-- Running test case: AddExtraScript
+PASS: ExtraScriptAdded event fired.
+PASS: Script should identify as dynamic.
+PASS: Main frame should have 1 dynamic script.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelframeextrascriptshtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/model/frame-extra-scripts.html (0 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/frame-extra-scripts.html                                (rev 0)
+++ trunk/LayoutTests/inspector/model/frame-extra-scripts.html        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -0,0 +1,50 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/inspector-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function triggerAddScriptElement() {
+    let script = document.createElement(&quot;script&quot;);
+    script.text = &quot;console.log('dynamically added script element');&quot;;
+    document.body.appendChild(script);
+}
+
+function test()
+{
+    let suite = InspectorTest.createAsyncSuite(&quot;WebInspector.Frame.extraScripts&quot;);
+
+    suite.addTestCase({
+        name: &quot;FrameHasNoExtraScriptsYet&quot;,
+        description: &quot;No extra scripts yet.&quot;,
+        test: (resolve, reject) =&gt; {
+            let mainFrame = WebInspector.frameResourceManager.mainFrame;
+            InspectorTest.expectThat(mainFrame.extraScripts.length === 0, &quot;Main frame should have no dynamic scripts.&quot;);
+            resolve();
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;AddExtraScript&quot;,
+        description: &quot;Add extra script.&quot;,
+        test: (resolve, reject) =&gt; {            
+            WebInspector.frameResourceManager.mainFrame.singleFireEventListener(WebInspector.Frame.Event.ExtraScriptAdded, (event) =&gt; {
+                InspectorTest.pass(&quot;ExtraScriptAdded event fired.&quot;);
+                InspectorTest.expectThat(event.data.script.dynamicallyAddedScriptElement, &quot;Script should identify as dynamic.&quot;);
+            });
+
+            InspectorTest.evaluateInPage(&quot;triggerAddScriptElement()&quot;, () =&gt; {
+                let mainFrame = WebInspector.frameResourceManager.mainFrame;
+                InspectorTest.expectThat(mainFrame.extraScripts.length === 1, &quot;Main frame should have 1 dynamic script.&quot;);
+                resolve();
+            });
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;WebInspector.Frame.extraScripts.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectormodelscriptresourcerelationshipexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/LayoutTests/inspector/model/script-resource-relationship-expected.txt        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -25,6 +25,11 @@
</span><span class="cx"> PASS: Script should not be associated with a Resource.
</span><span class="cx"> PASS: Script should have a sourceURL.
</span><span class="cx"> 
</span><ins>+-- Running test case: DynamicallyAddedScriptElementNoResource
+PASS: Script was added.
+PASS: Script should identify as a dynamically added script element.
+PASS: Script should not be associated when a resource.
+
</ins><span class="cx"> -- Running test case: DocumentWithInlineScripts
</span><span class="cx"> PASS: Main Resource should have 4 scripts.
</span><span class="cx"> PASS: Inline script 1 does not have a sourceURL.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelscriptresourcerelationshiphtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/script-resource-relationship.html (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/script-resource-relationship.html        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/LayoutTests/inspector/model/script-resource-relationship.html        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -26,13 +26,16 @@
</span><span class="cx">     eval(&quot;//# sourceURL=script-only.js\n1+1&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+function triggerScriptElement() {
+    let script = document.createElement(&quot;script&quot;);
+    script.text = &quot;//# sourceURL=dynamically-added-script-element.js\n1+1&quot;;
+    document.body.appendChild(script);
+}
+
</ins><span class="cx"> function test()
</span><span class="cx"> {
</span><span class="cx">     let suite = InspectorTest.createAsyncSuite(&quot;WebInspector.Script and WebInspector.Resource relationship&quot;);
</span><span class="cx"> 
</span><del>-    InspectorTest.dumpActivityToSystemConsole = true;
-    InspectorBackend.dumpInspectorProtocolMessages = true;
-
</del><span class="cx">     function validateNormalRelationship(resource, script) {
</span><span class="cx">         InspectorTest.expectThat(resource.url === script.url, &quot;Resource and Script have the same URL.&quot;);
</span><span class="cx">         InspectorTest.expectThat(resource.scripts.length === 1, &quot;Resource should be related to one script.&quot;);
</span><span class="lines">@@ -133,6 +136,29 @@
</span><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     suite.addTestCase({
</span><ins>+        name: &quot;DynamicallyAddedScriptElementNoResource&quot;,
+        description: &quot;A dynamically added script element has no resource.&quot;,
+        test: (resolve, reject) =&gt; {
+            WebInspector.debuggerManager.addEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener);
+
+            function scriptListener(event) {
+                if (event.data.script.sourceURL !== &quot;dynamically-added-script-element.js&quot;)
+                    return;
+                InspectorTest.pass(&quot;Script was added.&quot;);
+                let script = event.data.script;
+
+                InspectorTest.expectThat(script.dynamicallyAddedScriptElement, &quot;Script should identify as a dynamically added script element.&quot;);
+                InspectorTest.expectThat(script.resource === null, &quot;Script should not be associated when a resource.&quot;);
+
+                WebInspector.debuggerManager.removeEventListener(WebInspector.DebuggerManager.Event.ScriptAdded, scriptListener, null);
+                resolve();
+            }
+
+            InspectorTest.evaluateInPage(&quot;triggerScriptElement()&quot;);
+        }
+    });
+
+    suite.addTestCase({
</ins><span class="cx">         name: &quot;DocumentWithInlineScripts&quot;,
</span><span class="cx">         description: &quot;A document resource may be associated with multiple inline scripts.&quot;,
</span><span class="cx">         test: (resolve, reject) =&gt; {
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelstacktraceexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/stack-trace-expected.txt (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/stack-trace-expected.txt        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/LayoutTests/inspector/model/stack-trace-expected.txt        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -12,7 +12,7 @@
</span><span class="cx">   1: foo (Anonymous Script 1 (line 1)) - nativeCode (false) programCode (false)
</span><span class="cx">   2: Eval Code (Anonymous Script 1 (line 1)) - nativeCode (false) programCode (true)
</span><span class="cx">   3: eval - nativeCode (true) programCode (false)
</span><del>-  4: Global Code (stack-trace.html:2) - nativeCode (false) programCode (true)
</del><ins>+  4: Global Code (inline-script.js:2) - nativeCode (false) programCode (true)
</ins><span class="cx">   5: appendChild - nativeCode (true) programCode (false)
</span><span class="cx">   6: triggerConsoleMessage (stack-trace.html:9) - nativeCode (false) programCode (false)
</span><span class="cx">   7: Eval Code (Anonymous Script 2 (line 1)) - nativeCode (false) programCode (true)
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -1,5 +1,48 @@
</span><span class="cx"> 2016-04-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: React.js JSXTransformer produces bogus error locations
+        https://bugs.webkit.org/show_bug.cgi?id=150010
+        &lt;rdar://problem/23062233&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        Show dynamically added &lt;script&gt; elements added to a frame as resources.
+        For cases where the scripts had source map resources or error messages
+        we have a root from which to associate them to.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        &quot;Script Element %d&quot; tree element title.
+
+        * UserInterface/Models/Frame.js:
+        (WebInspector.Frame.prototype.commitProvisionalLoad):
+        (WebInspector.Frame.prototype.get extraScripts):
+        (WebInspector.Frame.prototype.addExtraScript):
+        Have a frame keep a list of its extra scripts.
+
+        * UserInterface/Models/Script.js:
+        (WebInspector.Script):
+        (WebInspector.Script.prototype.get displayName):
+        (WebInspector.Script.prototype.get dynamicallyAddedScriptElement):
+        Identify dynamically added script elements and associate them
+        with the frame, instead of the frame's main resource.
+
+        * UserInterface/Views/FrameTreeElement.js:
+        (WebInspector.FrameTreeElement.prototype.onpopulate):
+        (WebInspector.FrameTreeElement.prototype._extraScriptAdded):
+        Show named / source mapped dynamic script elements under a frame.
+
+        * UserInterface/Views/ResourceSidebarPanel.js:
+        (WebInspector.ResourceSidebarPanel.prototype._scriptWasAdded):
+        Dynamically added script element Scripts will be added by the frame that
+        owns them.
+
+        * UserInterface/Views/ScriptTreeElement.js:
+        (WebInspector.ScriptTreeElement):
+        Don't include a subtitle for dynamicallyAddedScriptElement, details match
+        the frame that owns them.
+
+2016-04-25  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Line error widget showed in the wrong resource
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=150009
</span><span class="cx">         &lt;rdar://problem/23062199&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -607,6 +607,7 @@
</span><span class="cx"> localizedStrings[&quot;Scope&quot;] = &quot;Scope&quot;;
</span><span class="cx"> localizedStrings[&quot;Scope Chain&quot;] = &quot;Scope Chain&quot;;
</span><span class="cx"> localizedStrings[&quot;Script&quot;] = &quot;Script&quot;;
</span><ins>+localizedStrings[&quot;Script Element %d&quot;] = &quot;Script Element %d&quot;;
</ins><span class="cx"> localizedStrings[&quot;Script Evaluated&quot;] = &quot;Script Evaluated&quot;;
</span><span class="cx"> localizedStrings[&quot;Scripts&quot;] = &quot;Scripts&quot;;
</span><span class="cx"> localizedStrings[&quot;Scroll Into View&quot;] = &quot;Scroll Into View&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsFramejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Frame.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> 
</span><span class="cx">         this._resourceCollection = new WebInspector.ResourceCollection;
</span><span class="cx">         this._provisionalResourceCollection = new WebInspector.ResourceCollection;
</span><ins>+        this._extraScripts = [];
</ins><span class="cx"> 
</span><span class="cx">         this._childFrames = [];
</span><span class="cx">         this._childFrameIdentifierMap = {};
</span><span class="lines">@@ -127,6 +128,7 @@
</span><span class="cx"> 
</span><span class="cx">         this._resourceCollection = this._provisionalResourceCollection;
</span><span class="cx">         this._provisionalResourceCollection = new WebInspector.ResourceCollection;
</span><ins>+        this._extraScripts = [];
</ins><span class="cx"> 
</span><span class="cx">         this.clearExecutionContexts(true);
</span><span class="cx">         this.clearProvisionalLoad(true);
</span><span class="lines">@@ -437,6 +439,18 @@
</span><span class="cx">         this.dispatchEventToListeners(WebInspector.Frame.Event.AllResourcesRemoved);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get extraScripts()
+    {
+        return this._extraScripts;
+    }
+
+    addExtraScript(script)
+    {
+        this._extraScripts.push(script);
+
+        this.dispatchEventToListeners(WebInspector.Frame.Event.ExtraScriptAdded, {script});
+    }
+
</ins><span class="cx">     saveIdentityToCookie(cookie)
</span><span class="cx">     {
</span><span class="cx">         cookie[WebInspector.Frame.MainResourceURLCookieKey] = this.mainResource.url.hash;
</span><span class="lines">@@ -495,6 +509,7 @@
</span><span class="cx">     ResourceWasAdded: &quot;frame-resource-was-added&quot;,
</span><span class="cx">     ResourceWasRemoved: &quot;frame-resource-was-removed&quot;,
</span><span class="cx">     AllResourcesRemoved: &quot;frame-all-resources-removed&quot;,
</span><ins>+    ExtraScriptAdded: &quot;frame-extra-script-added&quot;,
</ins><span class="cx">     ChildFrameWasAdded: &quot;frame-child-frame-was-added&quot;,
</span><span class="cx">     ChildFrameWasRemoved: &quot;frame-child-frame-was-removed&quot;,
</span><span class="cx">     AllChildFramesRemoved: &quot;frame-all-child-frames-removed&quot;,
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -36,21 +36,33 @@
</span><span class="cx">         this._range = range || null;
</span><span class="cx">         this._url = url || null;
</span><span class="cx">         this._sourceURL = sourceURL || null;
</span><ins>+        this._sourceMappingURL = sourceMapURL || null;
</ins><span class="cx">         this._injected = injected || false;
</span><ins>+        this._dynamicallyAddedScriptElement = false;
+        this._scriptSyntaxTree = null;
</ins><span class="cx"> 
</span><span class="cx">         this._resource = this._resolveResource();
</span><del>-        if (this._resource)
</del><ins>+
+        // If this Script was a dynamically added &lt;script&gt; to a Document,
+        // do not associate with the Document resource, instead associate
+        // with the frame as a dynamic script.
+        if (this._resource &amp;&amp; this._resource.type === WebInspector.Resource.Type.Document &amp;&amp; !this._range.startLine &amp;&amp; !this._range.startColumn) {
+            console.assert(this._resource.isMainResource());
+            let documentResource = this._resource;
+            this._resource = null;
+            this._dynamicallyAddedScriptElement = true;
+            documentResource.parentFrame.addExtraScript(this);
+            this._dynamicallyAddedScriptElementNumber = documentResource.parentFrame.extraScripts.length;
+        } else if (this._resource)
</ins><span class="cx">             this._resource.associateWithScript(this);
</span><span class="cx"> 
</span><del>-        if (sourceMapURL)
-            WebInspector.sourceMapManager.downloadSourceMap(sourceMapURL, this._url, this);
-
</del><span class="cx">         if (isWebInspectorConsoleEvaluationScript(this._sourceURL)) {
</span><span class="cx">             // Assign a unique number to the script object so it will stay the same.
</span><span class="cx">             this._uniqueDisplayNameNumber = this.constructor._nextUniqueConsoleDisplayNameNumber++;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        this._scriptSyntaxTree = null;
</del><ins>+        if (this._sourceMappingURL)
+            WebInspector.sourceMapManager.downloadSourceMap(this._sourceMappingURL, this._url, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Static
</span><span class="lines">@@ -83,6 +95,11 @@
</span><span class="cx">         return this._sourceURL;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get sourceMappingURL()
+    {
+        return this._sourceMappingURL;
+    }
+
</ins><span class="cx">     get urlComponents()
</span><span class="cx">     {
</span><span class="cx">         if (!this._urlComponents)
</span><span class="lines">@@ -97,7 +114,7 @@
</span><span class="cx"> 
</span><span class="cx">     get displayName()
</span><span class="cx">     {
</span><del>-        if (this._url)
</del><ins>+        if (this._url &amp;&amp; !this._dynamicallyAddedScriptElement)
</ins><span class="cx">             return WebInspector.displayNameForURL(this._url, this.urlComponents);
</span><span class="cx"> 
</span><span class="cx">         if (isWebInspectorConsoleEvaluationScript(this._sourceURL)) {
</span><span class="lines">@@ -111,6 +128,9 @@
</span><span class="cx">             return WebInspector.displayNameForURL(this._sourceURL, this._sourceURLComponents);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (this._dynamicallyAddedScriptElement)
+            return WebInspector.UIString(&quot;Script Element %d&quot;).format(this._dynamicallyAddedScriptElementNumber);
+
</ins><span class="cx">         // Assign a unique number to the script object so it will stay the same.
</span><span class="cx">         if (!this._uniqueDisplayNameNumber)
</span><span class="cx">             this._uniqueDisplayNameNumber = this.constructor._nextUniqueDisplayNameNumber++;
</span><span class="lines">@@ -135,6 +155,11 @@
</span><span class="cx">         return this._injected;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get dynamicallyAddedScriptElement()
+    {
+        return this._dynamicallyAddedScriptElement;
+    }
+
</ins><span class="cx">     get anonymous()
</span><span class="cx">     {
</span><span class="cx">         return !this._resource &amp;&amp; !this._url &amp;&amp; !this._sourceURL;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsFrameTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx">         frame.addEventListener(WebInspector.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
</span><span class="cx">         frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
</span><span class="cx">         frame.addEventListener(WebInspector.Frame.Event.ResourceWasRemoved, this._resourceWasRemoved, this);
</span><ins>+        frame.addEventListener(WebInspector.Frame.Event.ExtraScriptAdded, this._extraScriptAdded, this);
</ins><span class="cx">         frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasAdded, this._childFrameWasAdded, this);
</span><span class="cx">         frame.addEventListener(WebInspector.Frame.Event.ChildFrameWasRemoved, this._childFrameWasRemoved, this);
</span><span class="cx"> 
</span><span class="lines">@@ -52,17 +53,23 @@
</span><span class="cx">         this.folderSettingsKey = this._frame.url.hash;
</span><span class="cx"> 
</span><span class="cx">         this.registerFolderizeSettings(&quot;frames&quot;, WebInspector.UIString(&quot;Frames&quot;),
</span><del>-            function(representedObject) { return representedObject instanceof WebInspector.Frame; },
-            function() { return this.frame.childFrames.length; }.bind(this),
</del><ins>+            (representedObject) =&gt; representedObject instanceof WebInspector.Frame,
+            () =&gt; this.frame.childFrames.length,
</ins><span class="cx">             WebInspector.FrameTreeElement
</span><span class="cx">         );
</span><span class="cx"> 
</span><span class="cx">         this.registerFolderizeSettings(&quot;flows&quot;, WebInspector.UIString(&quot;Flows&quot;),
</span><del>-            function(representedObject) { return representedObject instanceof WebInspector.ContentFlow; },
-            function() { return this.frame.domTree.flowsCount; }.bind(this),
</del><ins>+            (representedObject) =&gt; representedObject instanceof WebInspector.ContentFlow,
+            () =&gt; this.frame.domTree.flowsCount,
</ins><span class="cx">             WebInspector.ContentFlowTreeElement
</span><span class="cx">         );
</span><span class="cx"> 
</span><ins>+        this.registerFolderizeSettings(&quot;extra-scripts&quot;, WebInspector.UIString(&quot;Extra Scripts&quot;),
+            (representedObject) =&gt; representedObject instanceof WebInspector.Script &amp;&amp; representedObject.dynamicallyAddedScriptElement,
+            () =&gt; this.frame.extraScripts.length,
+            WebInspector.ScriptTreeElement
+        );
+
</ins><span class="cx">         function makeValidateCallback(resourceType) {
</span><span class="cx">             return function(representedObject) {
</span><span class="cx">                 return representedObject instanceof WebInspector.Resource &amp;&amp; representedObject.type === resourceType;
</span><span class="lines">@@ -189,6 +196,10 @@
</span><span class="cx">         for (var flowKey in flowMap)
</span><span class="cx">             this.addChildForRepresentedObject(flowMap[flowKey]);
</span><span class="cx"> 
</span><ins>+        for (let extraScript of this._frame.extraScripts) {
+            if (extraScript.sourceURL || extraScript.sourceMappingURL)
+                this.addChildForRepresentedObject(extraScript);
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     onexpand()
</span><span class="lines">@@ -240,6 +251,13 @@
</span><span class="cx">         this.removeChildForRepresentedObject(event.data.resource);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _extraScriptAdded(event)
+    {
+        let extraScript = event.data.script;
+        if (extraScript.sourceURL || extraScript.sourceMappingURL)
+            this.addRepresentedObjectToNewChildQueue(extraScript);
+    }
+
</ins><span class="cx">     _childFrameWasAdded(event)
</span><span class="cx">     {
</span><span class="cx">         this.addRepresentedObjectToNewChildQueue(event.data.childFrame);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsResourceSidebarPaneljs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSidebarPanel.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -279,7 +279,7 @@
</span><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         // If the script URL matches a resource we can assume it is part of that resource and does not need added.
</span><del>-        if (script.resource)
</del><ins>+        if (script.resource || script.dynamicallyAddedScriptElement)
</ins><span class="cx">             return;
</span><span class="cx"> 
</span><span class="cx">         var insertIntoTopLevel = false;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsScriptTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js (200064 => 200065)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js        2016-04-26 00:44:45 UTC (rev 200064)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScriptTreeElement.js        2016-04-26 00:44:52 UTC (rev 200065)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> 
</span><span class="cx">         this.mainTitle = script.displayName;
</span><span class="cx"> 
</span><del>-        if (script.url) {
</del><ins>+        if (script.url &amp;&amp; !script.dynamicallyAddedScriptElement) {
</ins><span class="cx">             // Show the host as the subtitle if it is different from the main title.
</span><span class="cx">             var subtitle = WebInspector.displayNameForHost(script.urlComponents.host);
</span><span class="cx">             this.subtitle = this.mainTitle !== subtitle ? subtitle : null;
</span></span></pre>
</div>
</div>

</body>
</html>