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

Side by Side Diff: ui/webui/resources/js/parse_html_subset.js

Issue 405743002: Typecheck some of ui/webui/resources/js/ with Closure compiler. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cr.isMac fix Created 6 years, 4 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 | « ui/webui/resources/js/local_strings.js ('k') | ui/webui/resources/js/template_data_externs.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * Parse a very small subset of HTML. This ensures that insecure HTML / 6 * Parse a very small subset of HTML. This ensures that insecure HTML /
7 * javascript cannot be injected into the new tab page. 7 * javascript cannot be injected into the new tab page.
8 * @param {string} s The string to parse. 8 * @param {string} s The string to parse.
9 * @param {Array.<string>=} opt_extraTags Optional extra allowed tags. 9 * @param {Array.<string>=} opt_extraTags Optional extra allowed tags.
10 * @param {Object.<string, function(Node, string):boolean>=} opt_extraAttrs 10 * @param {Object.<string, function(Node, string):boolean>=} opt_extraAttrs
(...skipping 19 matching lines...) Expand all
30 } 30 }
31 }; 31 };
32 32
33 /** 33 /**
34 * Whitelist of tag names allowed in parseHtmlSubset. 34 * Whitelist of tag names allowed in parseHtmlSubset.
35 * @type {!Array.<string>} 35 * @type {!Array.<string>}
36 * @const 36 * @const
37 */ 37 */
38 var allowedTags = ['A', 'B', 'STRONG']; 38 var allowedTags = ['A', 'B', 'STRONG'];
39 39
40 function merge() { 40 /** @param {...Object} var_args Objects to merge. */
41 function merge(var_args) {
41 var clone = {}; 42 var clone = {};
42 for (var i = 0; i < arguments.length; ++i) { 43 for (var i = 0; i < arguments.length; ++i) {
43 if (typeof arguments[i] == 'object') { 44 if (typeof arguments[i] == 'object') {
44 for (var key in arguments[i]) { 45 for (var key in arguments[i]) {
45 if (arguments[i].hasOwnProperty(key)) 46 if (arguments[i].hasOwnProperty(key))
46 clone[key] = arguments[i][key]; 47 clone[key] = arguments[i][key];
47 } 48 }
48 } 49 }
49 } 50 }
50 return clone; 51 return clone;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 case Node.TEXT_NODE: 96 case Node.TEXT_NODE:
96 break; 97 break;
97 98
98 default: 99 default:
99 throw Error('Node type ' + node.nodeType + ' is not supported'); 100 throw Error('Node type ' + node.nodeType + ' is not supported');
100 } 101 }
101 }); 102 });
102 return df; 103 return df;
103 }; 104 };
104 })(); 105 })();
OLDNEW
« no previous file with comments | « ui/webui/resources/js/local_strings.js ('k') | ui/webui/resources/js/template_data_externs.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698