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

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

Issue 667743002: DevTools: remove "type" getters in Resource and NetworkRequest. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 2 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 /** @type {?NetworkAgent.Initiator} */ 52 /** @type {?NetworkAgent.Initiator} */
53 this._initiator = initiator; 53 this._initiator = initiator;
54 this._startTime = -1; 54 this._startTime = -1;
55 this._endTime = -1; 55 this._endTime = -1;
56 56
57 this.statusCode = 0; 57 this.statusCode = 0;
58 this.statusText = ""; 58 this.statusText = "";
59 this.requestMethod = ""; 59 this.requestMethod = "";
60 this.requestTime = 0; 60 this.requestTime = 0;
61 61
62 this._type = WebInspector.resourceTypes.Other; 62 /** @type {!WebInspector.ResourceType} */
63 this._resourceType = WebInspector.resourceTypes.Other;
63 this._contentEncoded = false; 64 this._contentEncoded = false;
64 this._pendingContentCallbacks = []; 65 this._pendingContentCallbacks = [];
65 /** @type {!Array.<!WebInspector.NetworkRequest.WebSocketFrame>} */ 66 /** @type {!Array.<!WebInspector.NetworkRequest.WebSocketFrame>} */
66 this._frames = []; 67 this._frames = [];
67 68
68 this._responseHeaderValues = {}; 69 this._responseHeaderValues = {};
69 70
70 this._remoteAddress = ""; 71 this._remoteAddress = "";
71 72
72 /** @type {string} */ 73 /** @type {string} */
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 var indexOfQuery = path.indexOf("?"); 481 var indexOfQuery = path.indexOf("?");
481 if (indexOfQuery !== -1) 482 if (indexOfQuery !== -1)
482 path = path.substring(0, indexOfQuery); 483 path = path.substring(0, indexOfQuery);
483 var lastSlashIndex = path.lastIndexOf("/"); 484 var lastSlashIndex = path.lastIndexOf("/");
484 return lastSlashIndex !== -1 ? path.substring(0, lastSlashIndex) : ""; 485 return lastSlashIndex !== -1 ? path.substring(0, lastSlashIndex) : "";
485 }, 486 },
486 487
487 /** 488 /**
488 * @return {!WebInspector.ResourceType} 489 * @return {!WebInspector.ResourceType}
489 */ 490 */
490 get type() 491 resourceType: function()
491 { 492 {
492 return this._type; 493 return this._resourceType;
493 },
494
495 set type(x)
496 {
497 this._type = x;
498 }, 494 },
499 495
500 /** 496 /**
497 * @param {!WebInspector.ResourceType} resourceType
498 */
499 setResourceType: function(resourceType)
500 {
501 this._resourceType = resourceType;
502 },
503
504 /**
501 * @return {string} 505 * @return {string}
502 */ 506 */
503 get domain() 507 get domain()
504 { 508 {
505 return this._parsedURL.host; 509 return this._parsedURL.host;
506 }, 510 },
507 511
508 /** 512 /**
509 * @return {string} 513 * @return {string}
510 */ 514 */
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 contentURL: function() 819 contentURL: function()
816 { 820 {
817 return this._url; 821 return this._url;
818 }, 822 },
819 823
820 /** 824 /**
821 * @return {!WebInspector.ResourceType} 825 * @return {!WebInspector.ResourceType}
822 */ 826 */
823 contentType: function() 827 contentType: function()
824 { 828 {
825 return this._type; 829 return this._resourceType;
826 }, 830 },
827 831
828 /** 832 /**
829 * @param {function(?string)} callback 833 * @param {function(?string)} callback
830 */ 834 */
831 requestContent: function(callback) 835 requestContent: function(callback)
832 { 836 {
833 // We do not support content retrieval for WebSockets at the moment. 837 // We do not support content retrieval for WebSockets at the moment.
834 // Since WebSockets are potentially long-living, fail requests immediate ly 838 // Since WebSockets are potentially long-living, fail requests immediate ly
835 // to prevent caller blocking until resource is marked as finished. 839 // to prevent caller blocking until resource is marked as finished.
836 if (this.type === WebInspector.resourceTypes.WebSocket) { 840 if (this._resourceType === WebInspector.resourceTypes.WebSocket) {
837 callback(null); 841 callback(null);
838 return; 842 return;
839 } 843 }
840 if (typeof this._content !== "undefined") { 844 if (typeof this._content !== "undefined") {
841 callback(this.content || null); 845 callback(this.content || null);
842 return; 846 return;
843 } 847 }
844 this._pendingContentCallbacks.push(callback); 848 this._pendingContentCallbacks.push(callback);
845 if (this.finished) 849 if (this.finished)
846 this._innerRequestContent(); 850 this._innerRequestContent();
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 * @param {!WebInspector.NetworkRequest.WebSocketFrame} frame 1004 * @param {!WebInspector.NetworkRequest.WebSocketFrame} frame
1001 */ 1005 */
1002 _addFrame: function(frame) 1006 _addFrame: function(frame)
1003 { 1007 {
1004 this._frames.push(frame); 1008 this._frames.push(frame);
1005 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Websock etFrameAdded, frame); 1009 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Websock etFrameAdded, frame);
1006 }, 1010 },
1007 1011
1008 __proto__: WebInspector.SDKObject.prototype 1012 __proto__: WebInspector.SDKObject.prototype
1009 } 1013 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/NetworkManager.js ('k') | Source/devtools/front_end/sdk/Resource.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698