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

Side by Side Diff: chrome/browser/resources/net_internals/util.js

Issue 7564029: Use javascript strict mode throughout a number of net-internals files. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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 | « chrome/browser/resources/net_internals/test_view.js ('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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 * Inherit the prototype methods from one constructor into another. 6 * Inherit the prototype methods from one constructor into another.
7 */ 7 */
8 function inherits(childCtor, parentCtor) { 8 function inherits(childCtor, parentCtor) {
9 function tempCtor() {}; 9 function tempCtor() {};
10 tempCtor.prototype = parentCtor.prototype; 10 tempCtor.prototype = parentCtor.prototype;
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 if (!(object instanceof Object)) 136 if (!(object instanceof Object))
137 return object; 137 return object;
138 var copy = {}; 138 var copy = {};
139 for (var key in object) { 139 for (var key in object) {
140 copy[key] = object[key]; 140 copy[key] = object[key];
141 } 141 }
142 return copy; 142 return copy;
143 } 143 }
144 144
145 /** 145 /**
146 * Helper to make sure singleton classes are not instantiated more than once.
147 */
148 function assertFirstConstructorCall(ctor) {
eroman 2011/08/03 20:46:54 I added this as an extra bonus, since weird things
mmenke 2011/08/03 20:50:36 Good idea.
149 // This is the variable which is set by cr.addSingletonGetter().
150 if (ctor.hasCreateFirstInstance_) {
151 throw Error('The class ' + ctor.name + ' is a singleton, and should ' +
152 'only be accessed using ' + ctor.name + '.getInstance().');
153 }
154 ctor.hasCreateFirstInstance_ = true;
155 }
156
157 /**
146 * TablePrinter is a helper to format a table as ascii art or an HTML table. 158 * TablePrinter is a helper to format a table as ascii art or an HTML table.
147 * 159 *
148 * Usage: call addRow() and addCell() repeatedly to specify the data. 160 * Usage: call addRow() and addCell() repeatedly to specify the data.
149 * 161 *
150 * addHeaderCell() can optionally be called to specify header cells for a 162 * addHeaderCell() can optionally be called to specify header cells for a
151 * single header row. The header row appears at the top of an HTML formatted 163 * single header row. The header row appears at the top of an HTML formatted
152 * table, and uses thead and th tags. In ascii tables, the header is separated 164 * table, and uses thead and th tags. In ascii tables, the header is separated
153 * from the table body by a partial row of dashes. 165 * from the table body by a partial row of dashes.
154 * 166 *
155 * setTitle() can optionally be used to set a title that is displayed before 167 * setTitle() can optionally be used to set a title that is displayed before
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 linkNode.href = cell.link; 379 linkNode.href = cell.link;
368 } else { 380 } else {
369 addTextNode(tableCell, cell.text); 381 addTextNode(tableCell, cell.text);
370 } 382 }
371 } 383 }
372 } 384 }
373 } 385 }
374 return table; 386 return table;
375 }; 387 };
376 388
OLDNEW
« no previous file with comments | « chrome/browser/resources/net_internals/test_view.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698