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

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

Issue 1417163003: DevTools: remove errors and warnings counters from the Resources panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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) 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 22 matching lines...) Expand all
33 * @extends {WebInspector.SDKModel} 33 * @extends {WebInspector.SDKModel}
34 * @param {!WebInspector.Target} target 34 * @param {!WebInspector.Target} target
35 */ 35 */
36 WebInspector.ResourceTreeModel = function(target) 36 WebInspector.ResourceTreeModel = function(target)
37 { 37 {
38 WebInspector.SDKModel.call(this, WebInspector.ResourceTreeModel, target); 38 WebInspector.SDKModel.call(this, WebInspector.ResourceTreeModel, target);
39 39
40 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType s.RequestFinished, this._onRequestFinished, this); 40 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType s.RequestFinished, this._onRequestFinished, this);
41 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType s.RequestUpdateDropped, this._onRequestUpdateDropped, this); 41 target.networkManager.addEventListener(WebInspector.NetworkManager.EventType s.RequestUpdateDropped, this._onRequestUpdateDropped, this);
42 42
43 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Messag eAdded, this._consoleMessageAdded, this);
44 target.consoleModel.addEventListener(WebInspector.ConsoleModel.Events.Consol eCleared, this._consoleCleared, this);
45
46 this._agent = target.pageAgent(); 43 this._agent = target.pageAgent();
47 this._agent.enable(); 44 this._agent.enable();
48 45
49 this._fetchResourceTree(); 46 this._fetchResourceTree();
50 47
51 target.registerPageDispatcher(new WebInspector.PageDispatcher(this)); 48 target.registerPageDispatcher(new WebInspector.PageDispatcher(this));
52 49
53 this._pendingConsoleMessages = {};
54 this._securityOriginFrameCount = {}; 50 this._securityOriginFrameCount = {};
55 this._inspectedPageURL = ""; 51 this._inspectedPageURL = "";
56 this._pendingReloadOptions = null; 52 this._pendingReloadOptions = null;
57 this._reloadSuspensionCount = 0; 53 this._reloadSuspensionCount = 0;
58 } 54 }
59 55
60 WebInspector.ResourceTreeModel.EventTypes = { 56 WebInspector.ResourceTreeModel.EventTypes = {
61 FrameAdded: "FrameAdded", 57 FrameAdded: "FrameAdded",
62 FrameNavigated: "FrameNavigated", 58 FrameNavigated: "FrameNavigated",
63 FrameDetached: "FrameDetached", 59 FrameDetached: "FrameDetached",
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 _onRequestFinished: function(event) 321 _onRequestFinished: function(event)
326 { 322 {
327 if (!this._cachedResourcesProcessed) 323 if (!this._cachedResourcesProcessed)
328 return; 324 return;
329 325
330 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data); 326 var request = /** @type {!WebInspector.NetworkRequest} */ (event.data);
331 if (request.failed || request.resourceType() === WebInspector.resourceTy pes.XHR) 327 if (request.failed || request.resourceType() === WebInspector.resourceTy pes.XHR)
332 return; 328 return;
333 329
334 var frame = this._frames[request.frameId]; 330 var frame = this._frames[request.frameId];
335 if (frame) { 331 if (frame)
336 var resource = frame._addRequest(request); 332 frame._addRequest(request);
337 this._addPendingConsoleMessagesToResource(resource);
338 }
339 }, 333 },
340 334
341 /** 335 /**
342 * @param {!WebInspector.Event} event 336 * @param {!WebInspector.Event} event
343 */ 337 */
344 _onRequestUpdateDropped: function(event) 338 _onRequestUpdateDropped: function(event)
345 { 339 {
346 if (!this._cachedResourcesProcessed) 340 if (!this._cachedResourcesProcessed)
347 return; 341 return;
348 342
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 375
382 /** 376 /**
383 * @return {!Array.<!WebInspector.ResourceTreeFrame>} 377 * @return {!Array.<!WebInspector.ResourceTreeFrame>}
384 */ 378 */
385 frames: function() 379 frames: function()
386 { 380 {
387 return Object.values(this._frames); 381 return Object.values(this._frames);
388 }, 382 },
389 383
390 /** 384 /**
391 * @param {!WebInspector.Event} event
392 */
393 _consoleMessageAdded: function(event)
394 {
395 var msg = /** @type {!WebInspector.ConsoleMessage} */ (event.data);
396 var resource = msg.url ? this.resourceForURL(msg.url) : null;
397 if (resource)
398 this._addConsoleMessageToResource(msg, resource);
399 else
400 this._addPendingConsoleMessage(msg);
401 },
402
403 /**
404 * @param {!WebInspector.ConsoleMessage} msg
405 */
406 _addPendingConsoleMessage: function(msg)
407 {
408 if (!msg.url)
409 return;
410 if (!this._pendingConsoleMessages[msg.url])
411 this._pendingConsoleMessages[msg.url] = [];
412 this._pendingConsoleMessages[msg.url].push(msg);
413 },
414
415 /**
416 * @param {!WebInspector.Resource} resource
417 */
418 _addPendingConsoleMessagesToResource: function(resource)
419 {
420 var messages = this._pendingConsoleMessages[resource.url];
421 if (messages) {
422 for (var i = 0; i < messages.length; i++)
423 this._addConsoleMessageToResource(messages[i], resource);
424 delete this._pendingConsoleMessages[resource.url];
425 }
426 },
427
428 /**
429 * @param {!WebInspector.ConsoleMessage} msg
430 * @param {!WebInspector.Resource} resource
431 */
432 _addConsoleMessageToResource: function(msg, resource)
433 {
434 switch (msg.level) {
435 case WebInspector.ConsoleMessage.MessageLevel.Warning:
436 resource.warnings++;
437 break;
438 case WebInspector.ConsoleMessage.MessageLevel.Error:
439 resource.errors++;
440 break;
441 }
442 resource.addMessage(msg);
443 },
444
445 _consoleCleared: function()
446 {
447 function callback(resource)
448 {
449 resource.clearErrorsAndWarnings();
450 }
451
452 this._pendingConsoleMessages = {};
453 this.forAllResources(callback);
454 },
455
456 /**
457 * @param {string} url 385 * @param {string} url
458 * @return {?WebInspector.Resource} 386 * @return {?WebInspector.Resource}
459 */ 387 */
460 resourceForURL: function(url) 388 resourceForURL: function(url)
461 { 389 {
462 // Workers call into this with no frames available. 390 // Workers call into this with no frames available.
463 return this.mainFrame ? this.mainFrame.resourceForURL(url) : null; 391 return this.mainFrame ? this.mainFrame.resourceForURL(url) : null;
464 }, 392 },
465 393
466 /** 394 /**
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 }, 867 },
940 868
941 /** 869 /**
942 * @override 870 * @override
943 */ 871 */
944 interstitialHidden: function() 872 interstitialHidden: function()
945 { 873 {
946 // Frontend is not interested in interstitials. 874 // Frontend is not interested in interstitials.
947 } 875 }
948 } 876 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698