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

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

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: Created 4 years, 1 month 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 }, 144 },
145 145
146 /** 146 /**
147 * @return {!NetworkAgent.RequestId} 147 * @return {!NetworkAgent.RequestId}
148 */ 148 */
149 get requestId() 149 get requestId()
150 { 150 {
151 return this._requestId; 151 return this._requestId;
152 }, 152 },
153 153
154 /**
155 * @param {!NetworkAgent.RequestId} requestId
156 */
154 set requestId(requestId) 157 set requestId(requestId)
155 { 158 {
156 this._requestId = requestId; 159 this._requestId = requestId;
157 }, 160 },
158 161
159 /** 162 /**
160 * @return {string} 163 * @return {string}
161 */ 164 */
162 get url() 165 get url()
163 { 166 {
164 return this._url; 167 return this._url;
165 }, 168 },
166 169
170 /**
171 * @param {string} x
172 */
167 set url(x) 173 set url(x)
168 { 174 {
169 if (this._url === x) 175 if (this._url === x)
170 return; 176 return;
171 177
172 this._url = x; 178 this._url = x;
173 this._parsedURL = new WebInspector.ParsedURL(x); 179 this._parsedURL = new WebInspector.ParsedURL(x);
174 delete this._queryString; 180 delete this._queryString;
175 delete this._parsedQueryParameters; 181 delete this._parsedQueryParameters;
176 delete this._name; 182 delete this._name;
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 }, 299 },
294 300
295 /** 301 /**
296 * @return {number} 302 * @return {number}
297 */ 303 */
298 get responseReceivedTime() 304 get responseReceivedTime()
299 { 305 {
300 return this._responseReceivedTime || -1; 306 return this._responseReceivedTime || -1;
301 }, 307 },
302 308
309 /**
310 * @param {number} x
311 */
303 set responseReceivedTime(x) 312 set responseReceivedTime(x)
304 { 313 {
305 this._responseReceivedTime = x; 314 this._responseReceivedTime = x;
306 }, 315 },
307 316
308 /** 317 /**
309 * @return {number} 318 * @return {number}
310 */ 319 */
311 get endTime() 320 get endTime()
312 { 321 {
313 return this._endTime || -1; 322 return this._endTime || -1;
314 }, 323 },
315 324
325 /**
326 * @param {number} x
327 */
316 set endTime(x) 328 set endTime(x)
317 { 329 {
318 if (this.timing && this.timing.requestTime) { 330 if (this.timing && this.timing.requestTime) {
319 // Check against accurate responseReceivedTime. 331 // Check against accurate responseReceivedTime.
320 this._endTime = Math.max(x, this.responseReceivedTime); 332 this._endTime = Math.max(x, this.responseReceivedTime);
321 } else { 333 } else {
322 // Prefer endTime since it might be from the network stack. 334 // Prefer endTime since it might be from the network stack.
323 this._endTime = x; 335 this._endTime = x;
324 if (this._responseReceivedTime > x) 336 if (this._responseReceivedTime > x)
325 this._responseReceivedTime = x; 337 this._responseReceivedTime = x;
(...skipping 22 matching lines...) Expand all
348 }, 360 },
349 361
350 /** 362 /**
351 * @return {number} 363 * @return {number}
352 */ 364 */
353 get resourceSize() 365 get resourceSize()
354 { 366 {
355 return this._resourceSize || 0; 367 return this._resourceSize || 0;
356 }, 368 },
357 369
370 /**
371 * @param {number} x
372 */
358 set resourceSize(x) 373 set resourceSize(x)
359 { 374 {
360 this._resourceSize = x; 375 this._resourceSize = x;
361 }, 376 },
362 377
363 /** 378 /**
364 * @return {number} 379 * @return {number}
365 */ 380 */
366 get transferSize() 381 get transferSize()
367 { 382 {
(...skipping 17 matching lines...) Expand all
385 }, 400 },
386 401
387 /** 402 /**
388 * @return {boolean} 403 * @return {boolean}
389 */ 404 */
390 get finished() 405 get finished()
391 { 406 {
392 return this._finished; 407 return this._finished;
393 }, 408 },
394 409
410 /**
411 * @param {boolean} x
412 */
395 set finished(x) 413 set finished(x)
396 { 414 {
397 if (this._finished === x) 415 if (this._finished === x)
398 return; 416 return;
399 417
400 this._finished = x; 418 this._finished = x;
401 419
402 if (x) { 420 if (x) {
403 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Fin ishedLoading, this); 421 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Fin ishedLoading, this);
404 if (this._pendingContentCallbacks.length) 422 if (this._pendingContentCallbacks.length)
405 this._innerRequestContent(); 423 this._innerRequestContent();
406 } 424 }
407 }, 425 },
408 426
409 /** 427 /**
410 * @return {boolean} 428 * @return {boolean}
411 */ 429 */
412 get failed() 430 get failed()
413 { 431 {
414 return this._failed; 432 return this._failed;
415 }, 433 },
416 434
435 /**
436 * @param {boolean} x
437 */
417 set failed(x) 438 set failed(x)
418 { 439 {
419 this._failed = x; 440 this._failed = x;
420 }, 441 },
421 442
422 /** 443 /**
423 * @return {boolean} 444 * @return {boolean}
424 */ 445 */
425 get canceled() 446 get canceled()
426 { 447 {
427 return this._canceled; 448 return this._canceled;
428 }, 449 },
429 450
451 /**
452 * @param {boolean} x
453 */
430 set canceled(x) 454 set canceled(x)
431 { 455 {
432 this._canceled = x; 456 this._canceled = x;
433 }, 457 },
434 458
435 /** 459 /**
436 * @return {!NetworkAgent.BlockedReason|undefined} 460 * @return {!NetworkAgent.BlockedReason|undefined}
437 */ 461 */
438 blockedReason: function() 462 blockedReason: function()
439 { 463 {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 }, 508 },
485 509
486 /** 510 /**
487 * @return {boolean} 511 * @return {boolean}
488 */ 512 */
489 get fetchedViaServiceWorker() 513 get fetchedViaServiceWorker()
490 { 514 {
491 return this._fetchedViaServiceWorker; 515 return this._fetchedViaServiceWorker;
492 }, 516 },
493 517
518 /**
519 * @param {boolean} x
520 */
494 set fetchedViaServiceWorker(x) 521 set fetchedViaServiceWorker(x)
495 { 522 {
496 this._fetchedViaServiceWorker = x; 523 this._fetchedViaServiceWorker = x;
497 }, 524 },
498 525
499 /** 526 /**
500 * @return {!NetworkAgent.ResourceTiming|undefined} 527 * @return {!NetworkAgent.ResourceTiming|undefined}
501 */ 528 */
502 get timing() 529 get timing()
503 { 530 {
504 return this._timing; 531 return this._timing;
505 }, 532 },
506 533
534 /**
535 * @param {!NetworkAgent.ResourceTiming|undefined} x
536 */
507 set timing(x) 537 set timing(x)
508 { 538 {
509 if (x && !this._fromMemoryCache) { 539 if (x && !this._fromMemoryCache) {
510 // Take startTime and responseReceivedTime from timing data for bett er accuracy. 540 // Take startTime and responseReceivedTime from timing data for bett er accuracy.
511 // Timing's requestTime is a baseline in seconds, rest of the number s there are ticks in millis. 541 // Timing's requestTime is a baseline in seconds, rest of the number s there are ticks in millis.
512 this._startTime = x.requestTime; 542 this._startTime = x.requestTime;
513 this._responseReceivedTime = x.requestTime + x.receiveHeadersEnd / 1 000.0; 543 this._responseReceivedTime = x.requestTime + x.receiveHeadersEnd / 1 000.0;
514 544
515 this._timing = x; 545 this._timing = x;
516 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Tim ingChanged, this); 546 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Tim ingChanged, this);
517 } 547 }
518 }, 548 },
519 549
520 /** 550 /**
521 * @return {string} 551 * @return {string}
522 */ 552 */
523 get mimeType() 553 get mimeType()
524 { 554 {
525 return this._mimeType; 555 return this._mimeType;
526 }, 556 },
527 557
558 /**
559 * @param {string} x
560 */
528 set mimeType(x) 561 set mimeType(x)
529 { 562 {
530 this._mimeType = x; 563 this._mimeType = x;
531 }, 564 },
532 565
533 /** 566 /**
534 * @return {string} 567 * @return {string}
535 */ 568 */
536 get displayName() 569 get displayName()
537 { 570 {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 /** 666 /**
634 * @return {?WebInspector.NetworkRequest} 667 * @return {?WebInspector.NetworkRequest}
635 */ 668 */
636 get redirectSource() 669 get redirectSource()
637 { 670 {
638 if (this.redirects && this.redirects.length > 0) 671 if (this.redirects && this.redirects.length > 0)
639 return this.redirects[this.redirects.length - 1]; 672 return this.redirects[this.redirects.length - 1];
640 return this._redirectSource; 673 return this._redirectSource;
641 }, 674 },
642 675
676 /**
677 * @param {?WebInspector.NetworkRequest} x
678 */
643 set redirectSource(x) 679 set redirectSource(x)
644 { 680 {
645 this._redirectSource = x; 681 this._redirectSource = x;
646 delete this._initiatorInfo; 682 delete this._initiatorInfo;
647 }, 683 },
648 684
649 /** 685 /**
650 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>} 686 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>}
651 */ 687 */
652 requestHeaders: function() 688 requestHeaders: function()
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
703 }, 739 },
704 740
705 /** 741 /**
706 * @return {string|undefined} 742 * @return {string|undefined}
707 */ 743 */
708 get requestFormData() 744 get requestFormData()
709 { 745 {
710 return this._requestFormData; 746 return this._requestFormData;
711 }, 747 },
712 748
749 /**
750 * @param {string|undefined} x
751 */
713 set requestFormData(x) 752 set requestFormData(x)
714 { 753 {
715 this._requestFormData = x; 754 this._requestFormData = x;
716 delete this._parsedFormParameters; 755 delete this._parsedFormParameters;
717 }, 756 },
718 757
719 /** 758 /**
720 * @return {string} 759 * @return {string}
721 */ 760 */
722 requestHttpVersion: function() 761 requestHttpVersion: function()
723 { 762 {
724 var headersText = this.requestHeadersText(); 763 var headersText = this.requestHeadersText();
725 if (!headersText) 764 if (!headersText)
726 return this.requestHeaderValue("version") || this.requestHeaderValue (":version") || "unknown"; 765 return this.requestHeaderValue("version") || this.requestHeaderValue (":version") || "unknown";
727 var firstLine = headersText.split(/\r\n/)[0]; 766 var firstLine = headersText.split(/\r\n/)[0];
728 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/); 767 var match = firstLine.match(/(HTTP\/\d+\.\d+)$/);
729 return match ? match[1] : "HTTP/0.9"; 768 return match ? match[1] : "HTTP/0.9";
730 }, 769 },
731 770
732 /** 771 /**
733 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>} 772 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>}
734 */ 773 */
735 get responseHeaders() 774 get responseHeaders()
736 { 775 {
737 return this._responseHeaders || []; 776 return this._responseHeaders || [];
738 }, 777 },
739 778
779 /**
780 * @param {!Array.<!WebInspector.NetworkRequest.NameValue>} x
781 */
740 set responseHeaders(x) 782 set responseHeaders(x)
741 { 783 {
742 this._responseHeaders = x; 784 this._responseHeaders = x;
743 delete this._sortedResponseHeaders; 785 delete this._sortedResponseHeaders;
744 delete this._serverTimings; 786 delete this._serverTimings;
745 delete this._responseCookies; 787 delete this._responseCookies;
746 this._responseHeaderValues = {}; 788 this._responseHeaderValues = {};
747 789
748 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Respons eHeadersChanged); 790 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Respons eHeadersChanged);
749 }, 791 },
750 792
751 /** 793 /**
752 * @return {string} 794 * @return {string}
753 */ 795 */
754 get responseHeadersText() 796 get responseHeadersText()
755 { 797 {
756 return this._responseHeadersText; 798 return this._responseHeadersText;
757 }, 799 },
758 800
801 /**
802 * @param {string} x
803 */
759 set responseHeadersText(x) 804 set responseHeadersText(x)
760 { 805 {
761 this._responseHeadersText = x; 806 this._responseHeadersText = x;
762 807
763 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Respons eHeadersChanged); 808 this.dispatchEventToListeners(WebInspector.NetworkRequest.Events.Respons eHeadersChanged);
764 }, 809 },
765 810
766 /** 811 /**
767 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>} 812 * @return {!Array.<!WebInspector.NetworkRequest.NameValue>}
768 */ 813 */
(...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after
1262 /** 1307 /**
1263 * @return {!WebInspector.NetworkManager} 1308 * @return {!WebInspector.NetworkManager}
1264 */ 1309 */
1265 networkManager: function() 1310 networkManager: function()
1266 { 1311 {
1267 return this._networkManager; 1312 return this._networkManager;
1268 }, 1313 },
1269 1314
1270 __proto__: WebInspector.SDKObject.prototype 1315 __proto__: WebInspector.SDKObject.prototype
1271 }; 1316 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698