Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/host/ResourceLoader.js

Issue 2032013003: [DevTools] Fix problem with loading source maps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 WebInspector.ResourceLoader = {} 5 WebInspector.ResourceLoader = {}
6 6
7 WebInspector.ResourceLoader._lastStreamId = 0; 7 WebInspector.ResourceLoader._lastStreamId = 0;
8 /** @type {!Object.<number, !WebInspector.OutputStream>} */ 8 /** @type {!Object.<number, !WebInspector.OutputStream>} */
9 WebInspector.ResourceLoader._boundStreams = {}; 9 WebInspector.ResourceLoader._boundStreams = {};
10 10
(...skipping 12 matching lines...) Expand all
23 */ 23 */
24 WebInspector.ResourceLoader._discardOutputStream = function(id) 24 WebInspector.ResourceLoader._discardOutputStream = function(id)
25 { 25 {
26 WebInspector.ResourceLoader._boundStreams[id].close(); 26 WebInspector.ResourceLoader._boundStreams[id].close();
27 delete WebInspector.ResourceLoader._boundStreams[id]; 27 delete WebInspector.ResourceLoader._boundStreams[id];
28 } 28 }
29 29
30 /** 30 /**
31 * @param {number} id 31 * @param {number} id
32 * @param {string} chunk 32 * @param {string} chunk
33 * @param {boolean=} encoded
33 */ 34 */
34 WebInspector.ResourceLoader.streamWrite = function(id, chunk) 35 WebInspector.ResourceLoader.streamWrite = function(id, chunk, encoded)
35 { 36 {
36 WebInspector.ResourceLoader._boundStreams[id].write(chunk); 37 if (encoded) {
38 var request = new XMLHttpRequest();
39 request.open("GET", "data:text/plain;base64," + chunk, false);
dgozman 2016/06/02 22:32:12 Let's create a helper function in utilities.js.
kozy 2016/06/02 23:00:20 Done.
40 request.send(null);
41 if (request.status === 200)
42 WebInspector.ResourceLoader._boundStreams[id].write(request.response Text);
43 else
44 console.error("Error while decoding chunk in ResourceLoader");
45 } else {
46 WebInspector.ResourceLoader._boundStreams[id].write(chunk);
47 }
37 } 48 }
38 49
39 /** 50 /**
40 * @param {string} url 51 * @param {string} url
41 * @param {?Object.<string, string>} headers 52 * @param {?Object.<string, string>} headers
42 * @param {function(number, !Object.<string, string>, string)} callback 53 * @param {function(number, !Object.<string, string>, string)} callback
43 */ 54 */
44 WebInspector.ResourceLoader.load = function(url, headers, callback) 55 WebInspector.ResourceLoader.load = function(url, headers, callback)
45 { 56 {
46 var stream = new WebInspector.StringOutputStream(); 57 var stream = new WebInspector.StringOutputStream();
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 { 108 {
98 WebInspector.ResourceLoader.streamWrite(streamId, text); 109 WebInspector.ResourceLoader.streamWrite(streamId, text);
99 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 200})); 110 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 200}));
100 } 111 }
101 112
102 function dataURLDecodeFailed() 113 function dataURLDecodeFailed()
103 { 114 {
104 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 404})); 115 finishedCallback(/** @type {!InspectorFrontendHostAPI.LoadNetworkResourc eResult} */ ({statusCode : 404}));
105 } 116 }
106 } 117 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698