OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 /** | 271 /** |
272 * @param {string} name | 272 * @param {string} name |
273 * @return {?string} | 273 * @return {?string} |
274 */ | 274 */ |
275 Runtime.queryParam = function(name) | 275 Runtime.queryParam = function(name) |
276 { | 276 { |
277 return Runtime._queryParamsObject[name] || null; | 277 return Runtime._queryParamsObject[name] || null; |
278 } | 278 } |
279 | 279 |
280 /** | 280 /** |
| 281 * @param {!Array.<string>} banned |
| 282 * @return {string} |
| 283 */ |
| 284 Runtime.constructQueryParams = function(banned) |
| 285 { |
| 286 var params = []; |
| 287 for (var key in Runtime._queryParamsObject) { |
| 288 if (!key || banned.indexOf(key) !== -1) |
| 289 continue; |
| 290 params.push(key + "=" + Runtime._queryParamsObject[key]); |
| 291 } |
| 292 return params.length ? "?" + params.join("&") : ""; |
| 293 } |
| 294 |
| 295 /** |
281 * @return {!Object} | 296 * @return {!Object} |
282 */ | 297 */ |
283 Runtime._experimentsSetting = function() | 298 Runtime._experimentsSetting = function() |
284 { | 299 { |
285 try { | 300 try { |
286 return /** @type {!Object} */ (JSON.parse(self.localStorage && self.loca
lStorage["experiments"] ? self.localStorage["experiments"] : "{}")); | 301 return /** @type {!Object} */ (JSON.parse(self.localStorage && self.loca
lStorage["experiments"] ? self.localStorage["experiments"] : "{}")); |
287 } catch (e) { | 302 } catch (e) { |
288 console.error("Failed to parse localStorage['experiments']"); | 303 console.error("Failed to parse localStorage['experiments']"); |
289 return {}; | 304 return {}; |
290 } | 305 } |
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 } | 1006 } |
992 } | 1007 } |
993 })();} | 1008 })();} |
994 | 1009 |
995 | 1010 |
996 // This must be constructed after the query parameters have been parsed. | 1011 // This must be constructed after the query parameters have been parsed. |
997 Runtime.experiments = new Runtime.ExperimentsSupport(); | 1012 Runtime.experiments = new Runtime.ExperimentsSupport(); |
998 | 1013 |
999 /** @type {!Runtime} */ | 1014 /** @type {!Runtime} */ |
1000 var runtime; | 1015 var runtime; |
OLD | NEW |