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

Side by Side Diff: Source/devtools/front_end/console/ConsoleViewMessage.js

Issue 1191983002: DevTools: [Console] filter out URLs from %c styling properties (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « LayoutTests/inspector/console/console-format-style-whitelist-expected.txt ('k') | 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 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 } 785 }
786 786
787 var currentStyle = null; 787 var currentStyle = null;
788 function styleFormatter(obj) 788 function styleFormatter(obj)
789 { 789 {
790 currentStyle = {}; 790 currentStyle = {};
791 var buffer = createElement("span"); 791 var buffer = createElement("span");
792 buffer.setAttribute("style", obj.description); 792 buffer.setAttribute("style", obj.description);
793 for (var i = 0; i < buffer.style.length; i++) { 793 for (var i = 0; i < buffer.style.length; i++) {
794 var property = buffer.style[i]; 794 var property = buffer.style[i];
795 if (isWhitelistedProperty(property)) 795 var value = buffer.style.getPropertyValue(property);
796 if (!value.startsWith("url(") && isWhitelistedProperty(property) )
pfeldman 2015/06/18 06:49:01 includes( or trim( instead?
lushnikov 2015/06/18 10:27:55 We have CSSOM property values here; no need for tr
796 currentStyle[property] = buffer.style[property]; 797 currentStyle[property] = buffer.style[property];
797 } 798 }
798 } 799 }
799 800
800 function isWhitelistedProperty(property) 801 function isWhitelistedProperty(property)
801 { 802 {
802 var prefixes = ["background", "border", "color", "font", "line", "ma rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font" , "-webkit-margin", "-webkit-padding", "-webkit-text"]; 803 var prefixes = ["background", "border", "color", "font", "line", "ma rgin", "padding", "text", "-webkit-background", "-webkit-border", "-webkit-font" , "-webkit-margin", "-webkit-padding", "-webkit-text"];
803 for (var i = 0; i < prefixes.length; i++) { 804 for (var i = 0; i < prefixes.length; i++) {
804 if (property.startsWith(prefixes[i])) 805 if (property.startsWith(prefixes[i]))
805 return true; 806 return true;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 { 1317 {
1317 if (!this._wrapperElement) { 1318 if (!this._wrapperElement) {
1318 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this ); 1319 WebInspector.ConsoleViewMessage.prototype.toMessageElement.call(this );
1319 this._wrapperElement.classList.toggle("collapsed", this._collapsed); 1320 this._wrapperElement.classList.toggle("collapsed", this._collapsed);
1320 } 1321 }
1321 return this._wrapperElement; 1322 return this._wrapperElement;
1322 }, 1323 },
1323 1324
1324 __proto__: WebInspector.ConsoleViewMessage.prototype 1325 __proto__: WebInspector.ConsoleViewMessage.prototype
1325 } 1326 }
OLDNEW
« no previous file with comments | « LayoutTests/inspector/console/console-format-style-whitelist-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698