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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/audits/AuditsPanel.js

Issue 2440953003: DevTools: use semicolons after each statement. (Closed)
Patch Set: rebaseline 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 this._launcherView = new WebInspector.AuditLauncherView(this._auditControlle r); 57 this._launcherView = new WebInspector.AuditLauncherView(this._auditControlle r);
58 for (var id in this.categoriesById) 58 for (var id in this.categoriesById)
59 this._launcherView.addCategory(this.categoriesById[id]); 59 this._launcherView.addCategory(this.categoriesById[id]);
60 60
61 var extensionCategories = WebInspector.extensionServer.auditCategories(); 61 var extensionCategories = WebInspector.extensionServer.auditCategories();
62 for (var i = 0; i < extensionCategories.length; ++i) { 62 for (var i = 0; i < extensionCategories.length; ++i) {
63 var category = extensionCategories[i]; 63 var category = extensionCategories[i];
64 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount)); 64 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount));
65 } 65 }
66 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.AuditCategoryAdded, this._extensionAuditCategoryAdded, this); 66 WebInspector.extensionServer.addEventListener(WebInspector.ExtensionServer.E vents.AuditCategoryAdded, this._extensionAuditCategoryAdded, this);
67 } 67 };
68 68
69 WebInspector.AuditsPanel.prototype = { 69 WebInspector.AuditsPanel.prototype = {
70 70
71 /** 71 /**
72 * @return {!Object.<string, !WebInspector.AuditCategory>} 72 * @return {!Object.<string, !WebInspector.AuditCategory>}
73 */ 73 */
74 get categoriesById() 74 get categoriesById()
75 { 75 {
76 return this._auditCategoriesById; 76 return this._auditCategoriesById;
77 }, 77 },
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 /** 185 /**
186 * @param {!WebInspector.Event} event 186 * @param {!WebInspector.Event} event
187 */ 187 */
188 _extensionAuditCategoryAdded: function(event) 188 _extensionAuditCategoryAdded: function(event)
189 { 189 {
190 var category = /** @type {!WebInspector.ExtensionAuditCategory} */ (even t.data); 190 var category = /** @type {!WebInspector.ExtensionAuditCategory} */ (even t.data);
191 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount)); 191 this.addCategory(new WebInspector.AuditExtensionCategory(category.extens ionOrigin, category.id, category.displayName, category.ruleCount));
192 }, 192 },
193 193
194 __proto__: WebInspector.PanelWithSidebar.prototype 194 __proto__: WebInspector.PanelWithSidebar.prototype
195 } 195 };
196 196
197 /** 197 /**
198 * @constructor 198 * @constructor
199 * @implements {WebInspector.AuditCategory} 199 * @implements {WebInspector.AuditCategory}
200 * @param {string} displayName 200 * @param {string} displayName
201 */ 201 */
202 WebInspector.AuditCategoryImpl = function(displayName) 202 WebInspector.AuditCategoryImpl = function(displayName)
203 { 203 {
204 this._displayName = displayName; 204 this._displayName = displayName;
205 this._rules = []; 205 this._rules = [];
206 } 206 };
207 207
208 WebInspector.AuditCategoryImpl.prototype = { 208 WebInspector.AuditCategoryImpl.prototype = {
209 /** 209 /**
210 * @override 210 * @override
211 * @return {string} 211 * @return {string}
212 */ 212 */
213 get id() 213 get id()
214 { 214 {
215 // this._id value is injected at construction time. 215 // this._id value is injected at construction time.
216 return this._id; 216 return this._id;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 }, 263 },
264 264
265 _ensureInitialized: function() 265 _ensureInitialized: function()
266 { 266 {
267 if (!this._initialized) { 267 if (!this._initialized) {
268 if ("initialize" in this) 268 if ("initialize" in this)
269 this.initialize(); 269 this.initialize();
270 this._initialized = true; 270 this._initialized = true;
271 } 271 }
272 } 272 }
273 } 273 };
274 274
275 /** 275 /**
276 * @constructor 276 * @constructor
277 * @param {string} id 277 * @param {string} id
278 * @param {string} displayName 278 * @param {string} displayName
279 */ 279 */
280 WebInspector.AuditRule = function(id, displayName) 280 WebInspector.AuditRule = function(id, displayName)
281 { 281 {
282 this._id = id; 282 this._id = id;
283 this._displayName = displayName; 283 this._displayName = displayName;
284 } 284 };
285 285
286 /** 286 /**
287 * @enum {string} 287 * @enum {string}
288 */ 288 */
289 WebInspector.AuditRule.Severity = { 289 WebInspector.AuditRule.Severity = {
290 Info: "info", 290 Info: "info",
291 Warning: "warning", 291 Warning: "warning",
292 Severe: "severe" 292 Severe: "severe"
293 } 293 };
294 294
295 WebInspector.AuditRule.SeverityOrder = { 295 WebInspector.AuditRule.SeverityOrder = {
296 "info": 3, 296 "info": 3,
297 "warning": 2, 297 "warning": 2,
298 "severe": 1 298 "severe": 1
299 } 299 };
300 300
301 WebInspector.AuditRule.prototype = { 301 WebInspector.AuditRule.prototype = {
302 get id() 302 get id()
303 { 303 {
304 return this._id; 304 return this._id;
305 }, 305 },
306 306
307 get displayName() 307 get displayName()
308 { 308 {
309 return this._displayName; 309 return this._displayName;
(...skipping 27 matching lines...) Expand all
337 * @param {!WebInspector.Target} target 337 * @param {!WebInspector.Target} target
338 * @param {!Array.<!WebInspector.NetworkRequest>} requests 338 * @param {!Array.<!WebInspector.NetworkRequest>} requests
339 * @param {!WebInspector.AuditRuleResult} result 339 * @param {!WebInspector.AuditRuleResult} result
340 * @param {function(?WebInspector.AuditRuleResult)} callback 340 * @param {function(?WebInspector.AuditRuleResult)} callback
341 * @param {!WebInspector.Progress} progress 341 * @param {!WebInspector.Progress} progress
342 */ 342 */
343 doRun: function(target, requests, result, callback, progress) 343 doRun: function(target, requests, result, callback, progress)
344 { 344 {
345 throw new Error("doRun() not implemented"); 345 throw new Error("doRun() not implemented");
346 } 346 }
347 } 347 };
348 348
349 /** 349 /**
350 * @constructor 350 * @constructor
351 * @param {!WebInspector.AuditCategory} category 351 * @param {!WebInspector.AuditCategory} category
352 */ 352 */
353 WebInspector.AuditCategoryResult = function(category) 353 WebInspector.AuditCategoryResult = function(category)
354 { 354 {
355 this.title = category.displayName; 355 this.title = category.displayName;
356 this.ruleResults = []; 356 this.ruleResults = [];
357 } 357 };
358 358
359 WebInspector.AuditCategoryResult.prototype = { 359 WebInspector.AuditCategoryResult.prototype = {
360 /** 360 /**
361 * @param {!WebInspector.AuditRuleResult} ruleResult 361 * @param {!WebInspector.AuditRuleResult} ruleResult
362 */ 362 */
363 addRuleResult: function(ruleResult) 363 addRuleResult: function(ruleResult)
364 { 364 {
365 this.ruleResults.push(ruleResult); 365 this.ruleResults.push(ruleResult);
366 } 366 }
367 } 367 };
368 368
369 /** 369 /**
370 * @constructor 370 * @constructor
371 * @param {(string|boolean|number|!Object)} value 371 * @param {(string|boolean|number|!Object)} value
372 * @param {boolean=} expanded 372 * @param {boolean=} expanded
373 * @param {string=} className 373 * @param {string=} className
374 */ 374 */
375 WebInspector.AuditRuleResult = function(value, expanded, className) 375 WebInspector.AuditRuleResult = function(value, expanded, className)
376 { 376 {
377 this.value = value; 377 this.value = value;
378 this.className = className; 378 this.className = className;
379 this.expanded = expanded; 379 this.expanded = expanded;
380 this.violationCount = 0; 380 this.violationCount = 0;
381 this._formatters = { 381 this._formatters = {
382 r: WebInspector.AuditRuleResult.linkifyDisplayName 382 r: WebInspector.AuditRuleResult.linkifyDisplayName
383 }; 383 };
384 var standardFormatters = Object.keys(String.standardFormatters); 384 var standardFormatters = Object.keys(String.standardFormatters);
385 for (var i = 0; i < standardFormatters.length; ++i) 385 for (var i = 0; i < standardFormatters.length; ++i)
386 this._formatters[standardFormatters[i]] = String.standardFormatters[stan dardFormatters[i]]; 386 this._formatters[standardFormatters[i]] = String.standardFormatters[stan dardFormatters[i]];
387 } 387 };
388 388
389 /** 389 /**
390 * @param {string} url 390 * @param {string} url
391 * @return {!Element} 391 * @return {!Element}
392 */ 392 */
393 WebInspector.AuditRuleResult.linkifyDisplayName = function(url) 393 WebInspector.AuditRuleResult.linkifyDisplayName = function(url)
394 { 394 {
395 return WebInspector.linkifyURLAsNode(url, WebInspector.displayNameForURL(url )); 395 return WebInspector.linkifyURLAsNode(url, WebInspector.displayNameForURL(url ));
396 } 396 };
397 397
398 /** 398 /**
399 * @param {string} domain 399 * @param {string} domain
400 * @return {string} 400 * @return {string}
401 */ 401 */
402 WebInspector.AuditRuleResult.resourceDomain = function(domain) 402 WebInspector.AuditRuleResult.resourceDomain = function(domain)
403 { 403 {
404 return domain || WebInspector.UIString("[empty domain]"); 404 return domain || WebInspector.UIString("[empty domain]");
405 } 405 };
406 406
407 WebInspector.AuditRuleResult.prototype = { 407 WebInspector.AuditRuleResult.prototype = {
408 /** 408 /**
409 * @param {(string|boolean|number|!Object)} value 409 * @param {(string|boolean|number|!Object)} value
410 * @param {boolean=} expanded 410 * @param {boolean=} expanded
411 * @param {string=} className 411 * @param {string=} className
412 * @return {!WebInspector.AuditRuleResult} 412 * @return {!WebInspector.AuditRuleResult}
413 */ 413 */
414 addChild: function(value, expanded, className) 414 addChild: function(value, expanded, className)
415 { 415 {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 b = createTextNode(b); 461 b = createTextNode(b);
462 a.appendChild(b); 462 a.appendChild(b);
463 return a; 463 return a;
464 } 464 }
465 465
466 var formattedResult = String.format(format, substitutions, this._formatt ers, fragment, append).formattedResult; 466 var formattedResult = String.format(format, substitutions, this._formatt ers, fragment, append).formattedResult;
467 if (formattedResult instanceof Node) 467 if (formattedResult instanceof Node)
468 formattedResult.normalize(); 468 formattedResult.normalize();
469 return this.addChild(formattedResult); 469 return this.addChild(formattedResult);
470 } 470 }
471 } 471 };
472 472
473 /** 473 /**
474 * @constructor 474 * @constructor
475 * @extends {TreeElement} 475 * @extends {TreeElement}
476 * @param {!WebInspector.AuditsPanel} panel 476 * @param {!WebInspector.AuditsPanel} panel
477 */ 477 */
478 WebInspector.AuditsSidebarTreeElement = function(panel) 478 WebInspector.AuditsSidebarTreeElement = function(panel)
479 { 479 {
480 TreeElement.call(this, WebInspector.UIString("Audits"), false); 480 TreeElement.call(this, WebInspector.UIString("Audits"), false);
481 this.selectable = true; 481 this.selectable = true;
482 this._panel = panel; 482 this._panel = panel;
483 this.listItemElement.classList.add("audits-sidebar-header"); 483 this.listItemElement.classList.add("audits-sidebar-header");
484 this.listItemElement.insertBefore(createElementWithClass("div", "icon"), thi s.listItemElement.firstChild); 484 this.listItemElement.insertBefore(createElementWithClass("div", "icon"), thi s.listItemElement.firstChild);
485 } 485 };
486 486
487 WebInspector.AuditsSidebarTreeElement.prototype = { 487 WebInspector.AuditsSidebarTreeElement.prototype = {
488 /** 488 /**
489 * @override 489 * @override
490 * @return {boolean} 490 * @return {boolean}
491 */ 491 */
492 onselect: function() 492 onselect: function()
493 { 493 {
494 this._panel.showLauncherView(); 494 this._panel.showLauncherView();
495 return true; 495 return true;
496 }, 496 },
497 497
498 __proto__: TreeElement.prototype 498 __proto__: TreeElement.prototype
499 } 499 };
500 500
501 /** 501 /**
502 * @constructor 502 * @constructor
503 * @extends {TreeElement} 503 * @extends {TreeElement}
504 * @param {!WebInspector.AuditsPanel} panel 504 * @param {!WebInspector.AuditsPanel} panel
505 * @param {!Array.<!WebInspector.AuditCategoryResult>} results 505 * @param {!Array.<!WebInspector.AuditCategoryResult>} results
506 * @param {string} mainResourceURL 506 * @param {string} mainResourceURL
507 * @param {number} ordinal 507 * @param {number} ordinal
508 */ 508 */
509 WebInspector.AuditResultSidebarTreeElement = function(panel, results, mainResour ceURL, ordinal) 509 WebInspector.AuditResultSidebarTreeElement = function(panel, results, mainResour ceURL, ordinal)
510 { 510 {
511 TreeElement.call(this, String.sprintf("%s (%d)", mainResourceURL, ordinal), false); 511 TreeElement.call(this, String.sprintf("%s (%d)", mainResourceURL, ordinal), false);
512 this.selectable = true; 512 this.selectable = true;
513 this._panel = panel; 513 this._panel = panel;
514 this.results = results; 514 this.results = results;
515 this.mainResourceURL = mainResourceURL; 515 this.mainResourceURL = mainResourceURL;
516 this.listItemElement.classList.add("audit-result-sidebar-tree-item"); 516 this.listItemElement.classList.add("audit-result-sidebar-tree-item");
517 this.listItemElement.insertBefore(createElementWithClass("div", "icon"), thi s.listItemElement.firstChild); 517 this.listItemElement.insertBefore(createElementWithClass("div", "icon"), thi s.listItemElement.firstChild);
518 } 518 };
519 519
520 WebInspector.AuditResultSidebarTreeElement.prototype = { 520 WebInspector.AuditResultSidebarTreeElement.prototype = {
521 /** 521 /**
522 * @override 522 * @override
523 * @return {boolean} 523 * @return {boolean}
524 */ 524 */
525 onselect: function() 525 onselect: function()
526 { 526 {
527 this._panel.showResults(this.results); 527 this._panel.showResults(this.results);
528 return true; 528 return true;
529 }, 529 },
530 530
531 __proto__: TreeElement.prototype 531 __proto__: TreeElement.prototype
532 } 532 };
533 533
534 /** 534 /**
535 * @return {!WebInspector.AuditsPanel} 535 * @return {!WebInspector.AuditsPanel}
536 */ 536 */
537 WebInspector.AuditsPanel.instance = function() 537 WebInspector.AuditsPanel.instance = function()
538 { 538 {
539 return /** @type {!WebInspector.AuditsPanel} */ (self.runtime.sharedInstance (WebInspector.AuditsPanel)); 539 return /** @type {!WebInspector.AuditsPanel} */ (self.runtime.sharedInstance (WebInspector.AuditsPanel));
540 } 540 };
541 541
542 // Contributed audit rules should go into this namespace. 542 // Contributed audit rules should go into this namespace.
543 WebInspector.AuditRules = {}; 543 WebInspector.AuditRules = {};
544 544
545 /** 545 /**
546 * Contributed audit categories should go into this namespace. 546 * Contributed audit categories should go into this namespace.
547 * @type {!Object.<string, function(new:WebInspector.AuditCategory)>} 547 * @type {!Object.<string, function(new:WebInspector.AuditCategory)>}
548 */ 548 */
549 WebInspector.AuditCategories = {}; 549 WebInspector.AuditCategories = {};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698