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

Side by Side Diff: Source/devtools/front_end/sdk/NetworkManager.js

Issue 1282593003: DevTools: rely on response's "Content-Type" header to refine resource type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 eventData.url = response.url; 337 eventData.url = response.url;
338 eventData.frameId = frameId; 338 eventData.frameId = frameId;
339 eventData.loaderId = loaderId; 339 eventData.loaderId = loaderId;
340 eventData.resourceType = resourceType; 340 eventData.resourceType = resourceType;
341 eventData.mimeType = response.mimeType; 341 eventData.mimeType = response.mimeType;
342 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.RequestUpdateDropped, eventData); 342 this._manager.dispatchEventToListeners(WebInspector.NetworkManager.E ventTypes.RequestUpdateDropped, eventData);
343 return; 343 return;
344 } 344 }
345 345
346 networkRequest.responseReceivedTime = time; 346 networkRequest.responseReceivedTime = time;
347 networkRequest.setResourceType(WebInspector.resourceTypes[resourceType]) ;
348 347
349 this._updateNetworkRequestWithResponse(networkRequest, response); 348 this._updateNetworkRequestWithResponse(networkRequest, response);
349 var contentType = networkRequest.responseHeaderValue("Content-Type");
350 if (contentType && contentType.indexOf("javascript") !== -1)
351 networkRequest.setResourceType(WebInspector.resourceTypes.Script);
pfeldman 2015/08/07 23:32:46 How can resource type be wrong though?
pfeldman 2015/08/11 04:05:14 You should only do this in case the resource type
352 else
353 networkRequest.setResourceType(WebInspector.resourceTypes[resourceTy pe]);
350 354
351 this._updateNetworkRequest(networkRequest); 355 this._updateNetworkRequest(networkRequest);
352 }, 356 },
353 357
354 /** 358 /**
355 * @override 359 * @override
356 * @param {!NetworkAgent.RequestId} requestId 360 * @param {!NetworkAgent.RequestId} requestId
357 * @param {!NetworkAgent.Timestamp} time 361 * @param {!NetworkAgent.Timestamp} time
358 * @param {number} dataLength 362 * @param {number} dataLength
359 * @param {number} encodedDataLength 363 * @param {number} encodedDataLength
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 this._userAgent = userAgent; 682 this._userAgent = userAgent;
679 for (var target of WebInspector.targetManager.targets()) 683 for (var target of WebInspector.targetManager.targets())
680 target.networkAgent().setUserAgentOverride(this._userAgent); 684 target.networkAgent().setUserAgentOverride(this._userAgent);
681 } 685 }
682 } 686 }
683 687
684 /** 688 /**
685 * @type {!WebInspector.MultitargetNetworkManager} 689 * @type {!WebInspector.MultitargetNetworkManager}
686 */ 690 */
687 WebInspector.multitargetNetworkManager; 691 WebInspector.multitargetNetworkManager;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698