<!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>[236783] trunk/Source/WebInspectorUI</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/236783">236783</a></dd>
<dt>Author</dt> <dd>drousso@apple.com</dd>
<dt>Date</dt> <dd>2018-10-02 18:49:05 -0700 (Tue, 02 Oct 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: merge SourceMapManager into NetworkManager
https://bugs.webkit.org/show_bug.cgi?id=190224

Reviewed by Joseph Pecoraro.

* UserInterface/Main.html:
* UserInterface/Base/Main.js:
(WI.loaded):
* UserInterface/Test.html:
* UserInterface/Test/Test.js:
(WI.loaded):

* UserInterface/Controllers/NetworkManager.js:
(WI.NetworkManager):
(WI.NetworkManager.prototype.downloadSourceMap): Added.
(WI.NetworkManager.prototype.resourceRequestWasServedFromMemoryCache):
(WI.NetworkManager.prototype.resourceRequestDidFinishLoading):
(WI.NetworkManager.prototype._createResource):
(WI.NetworkManager.prototype._loadAndParseSourceMap): Added.
(WI.NetworkManager.prototype._sourceMapLoadAndParseFailed): Added.
(WI.NetworkManager.prototype._sourceMapLoadAndParseSucceeded): Added.
(WI.NetworkManager.prototype._handleFrameMainResourceDidChange): Added.
* UserInterface/Controllers/SourceMapManager.js: Removed.

* UserInterface/Models/Script.js:
(WI.Script):

* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj:
* WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersNetworkManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptjs">trunk/Source/WebInspectorUI/UserInterface/Models/Script.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestTestjs">trunk/Source/WebInspectorUI/UserInterface/Test/Test.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
<li><a href="#trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxproj">trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj</a></li>
<li><a href="#trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxprojfilters">trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersSourceMapManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog    2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/ChangeLog       2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -1,3 +1,35 @@
</span><ins>+2018-10-02  Devin Rousso  <drousso@apple.com>
+
+        Web Inspector: merge SourceMapManager into NetworkManager
+        https://bugs.webkit.org/show_bug.cgi?id=190224
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Main.html:
+        * UserInterface/Base/Main.js:
+        (WI.loaded):
+        * UserInterface/Test.html:
+        * UserInterface/Test/Test.js:
+        (WI.loaded):
+
+        * UserInterface/Controllers/NetworkManager.js:
+        (WI.NetworkManager):
+        (WI.NetworkManager.prototype.downloadSourceMap): Added.
+        (WI.NetworkManager.prototype.resourceRequestWasServedFromMemoryCache):
+        (WI.NetworkManager.prototype.resourceRequestDidFinishLoading):
+        (WI.NetworkManager.prototype._createResource):
+        (WI.NetworkManager.prototype._loadAndParseSourceMap): Added.
+        (WI.NetworkManager.prototype._sourceMapLoadAndParseFailed): Added.
+        (WI.NetworkManager.prototype._sourceMapLoadAndParseSucceeded): Added.
+        (WI.NetworkManager.prototype._handleFrameMainResourceDidChange): Added.
+        * UserInterface/Controllers/SourceMapManager.js: Removed.
+
+        * UserInterface/Models/Script.js:
+        (WI.Script):
+
+        * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj:
+        * WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters:
+
</ins><span class="cx"> 2018-10-02  Nikita Vasilyev  <nvasilyev@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Styles: start editing property name/value on mouseup instead of mousedown
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js   2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js      2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -123,7 +123,6 @@
</span><span class="cx">     this.applicationCacheManager = new WI.ApplicationCacheManager;
</span><span class="cx">     this.timelineManager = new WI.TimelineManager;
</span><span class="cx">     this.debuggerManager = new WI.DebuggerManager;
</span><del>-    this.sourceMapManager = new WI.SourceMapManager;
</del><span class="cx">     this.layerTreeManager = new WI.LayerTreeManager;
</span><span class="cx">     this.probeManager = new WI.ProbeManager;
</span><span class="cx">     this.workerManager = new WI.WorkerManager;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersNetworkManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js  2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/NetworkManager.js     2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -37,6 +37,9 @@
</span><span class="cx"> 
</span><span class="cx">         this._waitingForMainFrameResourceTreePayload = true;
</span><span class="cx"> 
</span><ins>+        this._sourceMapURLMap = new Map;
+        this._downloadingSourceMaps = new Set;
+
</ins><span class="cx">         if (window.PageAgent) {
</span><span class="cx">             PageAgent.enable();
</span><span class="cx">             PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
</span><span class="lines">@@ -49,6 +52,7 @@
</span><span class="cx">             NetworkAgent.enable();
</span><span class="cx"> 
</span><span class="cx">         WI.notifications.addEventListener(WI.Notification.ExtraDomainsActivated, this._extraDomainsActivated, this);
</span><ins>+        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._handleFrameMainResourceDidChange, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="lines">@@ -73,6 +77,45 @@
</span><span class="cx">         return this._resourceRequestIdentifierMap.get(requestIdentifier) || null;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    downloadSourceMap(sourceMapURL, baseURL, originalSourceCode)
+    {
+        // The baseURL could have come from a "//# sourceURL". Attempt to get a
+        // reasonable absolute URL for the base by using the main resource's URL.
+        if (WI.networkManager.mainFrame)
+            baseURL = absoluteURL(baseURL, WI.networkManager.mainFrame.url);
+
+        if (sourceMapURL.startsWith("data:")) {
+            this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
+            return;
+        }
+
+        sourceMapURL = absoluteURL(sourceMapURL, baseURL);
+        if (!sourceMapURL)
+            return;
+
+        console.assert(originalSourceCode.url);
+        if (!originalSourceCode.url)
+            return;
+
+        // FIXME: <rdar://problem/13265694> Source Maps: Better handle when multiple resources reference the same SourceMap
+
+        if (this._sourceMapURLMap.has(sourceMapURL) || this._downloadingSourceMaps.has(sourceMapURL))
+            return;
+
+        let loadAndParseSourceMap = () => {
+            this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
+        };
+
+        if (!WI.networkManager.mainFrame) {
+            // If we don't have a main frame, then we are likely in the middle of building the resource tree.
+            // Delaying until the next runloop is enough in this case to then start loading the source map.
+            setTimeout(loadAndParseSourceMap, 0);
+            return;
+        }
+
+        loadAndParseSourceMap();
+    }
+
</ins><span class="cx">     frameDidNavigate(framePayload)
</span><span class="cx">     {
</span><span class="cx">         // Called from WI.PageObserver.
</span><span class="lines">@@ -340,7 +383,7 @@
</span><span class="cx">         console.assert(resource.cached, "This resource should be classified as cached since it was served from the MemoryCache", resource);
</span><span class="cx"> 
</span><span class="cx">         if (cachedResourcePayload.sourceMapURL)
</span><del>-            WI.sourceMapManager.downloadSourceMap(cachedResourcePayload.sourceMapURL, resource.url, resource);
</del><ins>+            this.downloadSourceMap(cachedResourcePayload.sourceMapURL, resource.url, resource);
</ins><span class="cx"> 
</span><span class="cx">         // No need to associate the resource with the requestIdentifier, since this is the only event
</span><span class="cx">         // sent for memory cache resource loads.
</span><span class="lines">@@ -435,7 +478,7 @@
</span><span class="cx">         resource.markAsFinished(elapsedTime);
</span><span class="cx"> 
</span><span class="cx">         if (sourceMapURL)
</span><del>-            WI.sourceMapManager.downloadSourceMap(sourceMapURL, resource.url, resource);
</del><ins>+            this.downloadSourceMap(sourceMapURL, resource.url, resource);
</ins><span class="cx"> 
</span><span class="cx">         this._resourceRequestIdentifierMap.delete(requestIdentifier);
</span><span class="cx">     }
</span><span class="lines">@@ -701,7 +744,7 @@
</span><span class="cx">         var resource = new WI.Resource(payload.url, payload.mimeType, payload.type, framePayload.loaderId, payload.targetId);
</span><span class="cx"> 
</span><span class="cx">         if (payload.sourceMapURL)
</span><del>-            WI.sourceMapManager.downloadSourceMap(payload.sourceMapURL, resource.url, resource);
</del><ins>+            this.downloadSourceMap(payload.sourceMapURL, resource.url, resource);
</ins><span class="cx"> 
</span><span class="cx">         return resource;
</span><span class="cx">     }
</span><span class="lines">@@ -769,11 +812,102 @@
</span><span class="cx">         this.dispatchEventToListeners(WI.NetworkManager.Event.MainFrameDidChange, {oldMainFrame});
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode)
+    {
+        this._downloadingSourceMaps.add(sourceMapURL);
+
+        let sourceMapLoaded = (error, content, mimeType, statusCode) => {
+            if (error || statusCode >= 400) {
+                this._sourceMapLoadAndParseFailed(sourceMapURL);
+                return;
+            }
+
+            if (content.slice(0, 3) === ")]}") {
+                let firstNewlineIndex = content.indexOf("\n");
+                if (firstNewlineIndex === -1) {
+                    this._sourceMapLoadAndParseFailed(sourceMapURL);
+                    return;
+                }
+
+                content = content.substring(firstNewlineIndex);
+            }
+
+            try {
+                let payload = JSON.parse(content);
+                let baseURL = sourceMapURL.startsWith("data:") ? originalSourceCode.url : sourceMapURL;
+                let sourceMap = new WI.SourceMap(baseURL, payload, originalSourceCode);
+                this._sourceMapLoadAndParseSucceeded(sourceMapURL, sourceMap);
+            } catch {
+                this._sourceMapLoadAndParseFailed(sourceMapURL);
+            }
+        };
+
+        if (sourceMapURL.startsWith("data:")) {
+            let {mimeType, base64, data} = parseDataURL(sourceMapURL);
+            let content = base64 ? atob(data) : data;
+            sourceMapLoaded(null, content, mimeType, 0);
+            return;
+        }
+
+        if (!window.NetworkAgent) {
+            this._sourceMapLoadAndParseFailed(sourceMapURL);
+            return;
+        }
+
+        let frameIdentifier = null;
+        if (originalSourceCode instanceof WI.Resource && originalSourceCode.parentFrame)
+            frameIdentifier = originalSourceCode.parentFrame.id;
+
+        if (!frameIdentifier)
+            frameIdentifier = WI.networkManager.mainFrame ? WI.networkManager.mainFrame.id : "";
+
+        NetworkAgent.loadResource(frameIdentifier, sourceMapURL, sourceMapLoaded);
+    }
+
+    _sourceMapLoadAndParseFailed(ssourceMapLurceMapURL)
+    {
+        this._downloadingSourceMaps.delete(sourceMapURL);
+    }
+
+    _sourceMapLoadAndParseSucceeded(sourceMapURL, sourceMap)
+    {
+        if (!this._downloadingSourceMaps.has(sourceMapURL))
+            return;
+
+        this._downloadingSourceMaps.delete(sourceMapURL);
+
+        this._sourceMapURLMap.set(sourceMapURL, sourceMap);
+
+        for (let source of sourceMap.sources())
+            sourceMap.addResource(new WI.SourceMapResource(source, sourceMap));
+
+        // Associate the SourceMap with the originalSourceCode.
+        sourceMap.originalSourceCode.addSourceMap(sourceMap);
+
+        // If the originalSourceCode was not a Resource, be sure to also associate with the Resource if one exists.
+        // FIXME: We should try to use the right frame instead of a global lookup by URL.
+        if (!(sourceMap.originalSourceCode instanceof WI.Resource)) {
+            console.assert(sourceMap.originalSourceCode instanceof WI.Script);
+            let resource = sourceMap.originalSourceCode.resource;
+            if (resource)
+                resource.addSourceMap(sourceMap);
+        }
+    }
+
</ins><span class="cx">     _extraDomainsActivated(event)
</span><span class="cx">     {
</span><span class="cx">         if (event.data.domains.includes("Page") && window.PageAgent)
</span><span class="cx">             PageAgent.getResourceTree(this._processMainFrameResourceTreePayload.bind(this));
</span><span class="cx">     }
</span><ins>+
+    _handleFrameMainResourceDidChange(event)
+    {
+        if (!event.target.isMainFrame())
+            return;
+
+        this._sourceMapURLMap.clear();
+        this._downloadingSourceMaps.clear();
+    }
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WI.NetworkManager.Event = {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersSourceMapManagerjs"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js        2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/SourceMapManager.js   2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -1,184 +0,0 @@
</span><del>-/*
- * Copyright (C) 2013 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-WI.SourceMapManager = class SourceMapManager extends WI.Object
-{
-    constructor()
-    {
-        super();
-
-        this._sourceMapURLMap = {};
-        this._downloadingSourceMaps = {};
-
-        WI.Frame.addEventListener(WI.Frame.Event.MainResourceDidChange, this._mainResourceDidChange, this);
-    }
-
-    // Public
-
-    sourceMapForURL(sourceMapURL)
-    {
-        return this._sourceMapURLMap[sourceMapURL];
-    }
-
-    downloadSourceMap(sourceMapURL, baseURL, originalSourceCode)
-    {
-        // The baseURL could have come from a "//# sourceURL". Attempt to get a
-        // reasonable absolute URL for the base by using the main resource's URL.
-        if (WI.networkManager.mainFrame)
-            baseURL = absoluteURL(baseURL, WI.networkManager.mainFrame.url);
-
-        if (sourceMapURL.startsWith("data:")) {
-            this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
-            return;
-        }
-
-        sourceMapURL = absoluteURL(sourceMapURL, baseURL);
-        if (!sourceMapURL)
-            return;
-
-        console.assert(originalSourceCode.url);
-        if (!originalSourceCode.url)
-            return;
-
-        // FIXME: <rdar://problem/13265694> Source Maps: Better handle when multiple resources reference the same SourceMap
-
-        if (sourceMapURL in this._sourceMapURLMap)
-            return;
-
-        if (sourceMapURL in this._downloadingSourceMaps)
-            return;
-
-        function loadAndParseSourceMap()
-        {
-            this._loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode);
-        }
-
-        if (!WI.networkManager.mainFrame) {
-            // If we don't have a main frame, then we are likely in the middle of building the resource tree.
-            // Delaying until the next runloop is enough in this case to then start loading the source map.
-            setTimeout(loadAndParseSourceMap.bind(this), 0);
-            return;
-        }
-
-        loadAndParseSourceMap.call(this);
-    }
-
-    // Private
-
-    _loadAndParseSourceMap(sourceMapURL, baseURL, originalSourceCode)
-    {
-        this._downloadingSourceMaps[sourceMapURL] = true;
-
-        function sourceMapLoaded(error, content, mimeType, statusCode)
-        {
-            if (error || statusCode >= 400) {
-                this._loadAndParseFailed(sourceMapURL);
-                return;
-            }
-
-            if (content.slice(0, 3) === ")]}") {
-                var firstNewlineIndex = content.indexOf("\n");
-                if (firstNewlineIndex === -1) {
-                    this._loadAndParseFailed(sourceMapURL);
-                    return;
-                }
-
-                content = content.substring(firstNewlineIndex);
-            }
-
-            try {
-                var payload = JSON.parse(content);
-                var baseURL = sourceMapURL.startsWith("data:") ? originalSourceCode.url : sourceMapURL;
-                var sourceMap = new WI.SourceMap(baseURL, payload, originalSourceCode);
-                this._loadAndParseSucceeded(sourceMapURL, sourceMap);
-            } catch {
-                this._loadAndParseFailed(sourceMapURL);
-            }
-        }
-
-        if (sourceMapURL.startsWith("data:")) {
-            let {mimeType, base64, data} = parseDataURL(sourceMapURL);
-            let content = base64 ? atob(data) : data;
-            sourceMapLoaded.call(this, null, content, mimeType, 0);
-            return;
-        }
-
-        if (!window.NetworkAgent) {
-            this._loadAndParseFailed(sourceMapURL);
-            return;
-        }
-
-        var frameIdentifier = null;
-        if (originalSourceCode instanceof WI.Resource && originalSourceCode.parentFrame)
-            frameIdentifier = originalSourceCode.parentFrame.id;
-
-        if (!frameIdentifier)
-            frameIdentifier = WI.networkManager.mainFrame ? WI.networkManager.mainFrame.id : "";
-
-        NetworkAgent.loadResource(frameIdentifier, sourceMapURL, sourceMapLoaded.bind(this));
-    }
-
-    _loadAndParseFailed(sourceMapURL)
-    {
-        delete this._downloadingSourceMaps[sourceMapURL];
-    }
-
-    _loadAndParseSucceeded(sourceMapURL, sourceMap)
-    {
-        if (!(sourceMapURL in this._downloadingSourceMaps))
-            return;
-
-        delete this._downloadingSourceMaps[sourceMapURL];
-
-        this._sourceMapURLMap[sourceMapURL] = sourceMap;
-
-        var sources = sourceMap.sources();
-        for (var i = 0; i < sources.length; ++i) {
-            var sourceMapResource = new WI.SourceMapResource(sources[i], sourceMap);
-            sourceMap.addResource(sourceMapResource);
-        }
-
-        // Associate the SourceMap with the originalSourceCode.
-        sourceMap.originalSourceCode.addSourceMap(sourceMap);
-
-        // If the originalSourceCode was not a Resource, be sure to also associate with the Resource if one exists.
-        // FIXME: We should try to use the right frame instead of a global lookup by URL.
-        if (!(sourceMap.originalSourceCode instanceof WI.Resource)) {
-            console.assert(sourceMap.originalSourceCode instanceof WI.Script);
-            var resource = sourceMap.originalSourceCode.resource;
-            if (resource)
-                resource.addSourceMap(sourceMap);
-        }
-    }
-
-    _mainResourceDidChange(event)
-    {
-        if (!event.target.isMainFrame())
-            return;
-
-        this._sourceMapURLMap = {};
-        this._downloadingSourceMaps = {};
-    }
-};
</del></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html      2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html 2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -810,7 +810,6 @@
</span><span class="cx">     <script src="Controllers/ProbeManager.js"></script>
</span><span class="cx">     <script src="Controllers/ResourceQueryController.js"></script>
</span><span class="cx">     <script src="Controllers/RuntimeManager.js"></script>
</span><del>-    <script src="Controllers/SourceMapManager.js"></script>
</del><span class="cx">     <script src="Controllers/TargetManager.js"></script>
</span><span class="cx">     <script src="Controllers/TimelineManager.js"></script>
</span><span class="cx">     <script src="Controllers/TypeTokenAnnotator.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js       2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js  2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         if (this._sourceMappingURL)
</span><del>-            WI.sourceMapManager.downloadSourceMap(this._sourceMappingURL, this._url, this);
</del><ins>+            WI.networkManager.downloadSourceMap(this._sourceMappingURL, this._url, this);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Static
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestTestjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js   2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js      2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx">     this.memoryManager = new WI.MemoryManager;
</span><span class="cx">     this.timelineManager = new WI.TimelineManager;
</span><span class="cx">     this.debuggerManager = new WI.DebuggerManager;
</span><del>-    this.sourceMapManager = new WI.SourceMapManager;
</del><span class="cx">     this.layerTreeManager = new WI.LayerTreeManager;
</span><span class="cx">     this.probeManager = new WI.ProbeManager;
</span><span class="cx">     this.workerManager = new WI.WorkerManager;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html      2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html 2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -224,7 +224,6 @@
</span><span class="cx">     <script src="Controllers/NetworkManager.js"></script>
</span><span class="cx">     <script src="Controllers/ProbeManager.js"></script>
</span><span class="cx">     <script src="Controllers/RuntimeManager.js"></script>
</span><del>-    <script src="Controllers/SourceMapManager.js"></script>
</del><span class="cx">     <script src="Controllers/TargetManager.js"></script>
</span><span class="cx">     <script src="Controllers/TimelineManager.js"></script>
</span><span class="cx">     <script src="Controllers/WorkerManager.js"></script>
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj        2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj   2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -775,7 +775,6 @@
</span><span class="cx">     <None Include="..\UserInterface\SourceCodeTextRange.js" />
</span><span class="cx">     <None Include="..\UserInterface\SourceCodeTreeElement.js" />
</span><span class="cx">     <None Include="..\UserInterface\SourceMap.js" />
</span><del>-    <None Include="..\UserInterface\SourceMapManager.js" />
</del><span class="cx">     <None Include="..\UserInterface\SourceMapResource.js" />
</span><span class="cx">     <None Include="..\UserInterface\SourceMapResourceTreeElement.js" />
</span><span class="cx">     <None Include="..\UserInterface\StorageTreeElement.js" />
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIWebInspectorUIvcxprojWebInspectorUIvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters (236782 => 236783)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters        2018-10-03 00:48:59 UTC (rev 236782)
+++ trunk/Source/WebInspectorUI/WebInspectorUI.vcxproj/WebInspectorUI.vcxproj.filters   2018-10-03 01:49:05 UTC (rev 236783)
</span><span class="lines">@@ -921,9 +921,6 @@
</span><span class="cx">     <None Include="..\UserInterface\SourceMap.js">
</span><span class="cx">       <Filter>UserInterface</Filter>
</span><span class="cx">     </None>
</span><del>-    <None Include="..\UserInterface\SourceMapManager.js">
-      <Filter>UserInterface</Filter>
-    </None>
</del><span class="cx">     <None Include="..\UserInterface\SourceMapResource.js">
</span><span class="cx">       <Filter>UserInterface</Filter>
</span><span class="cx">     </None>
</span></span></pre>
</div>
</div>

</body>
</html>