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 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 { | 1035 { |
1036 var queryParams = location.search; | 1036 var queryParams = location.search; |
1037 if (!queryParams) | 1037 if (!queryParams) |
1038 return; | 1038 return; |
1039 var params = queryParams.substring(1).split("&"); | 1039 var params = queryParams.substring(1).split("&"); |
1040 for (var i = 0; i < params.length; ++i) { | 1040 for (var i = 0; i < params.length; ++i) { |
1041 var pair = params[i].split("="); | 1041 var pair = params[i].split("="); |
1042 var name = pair.shift(); | 1042 var name = pair.shift(); |
1043 Runtime._queryParamsObject[name] = pair.join("="); | 1043 Runtime._queryParamsObject[name] = pair.join("="); |
1044 } | 1044 } |
1045 | |
1046 // Patch settings from the URL param (for tests). | |
1047 var settingsParam = Runtime.queryParam("settings"); | |
1048 if (settingsParam) { | |
1049 try { | |
1050 var settings = JSON.parse(window.decodeURI(settingsParam)); | |
1051 for (var key in settings) | |
1052 window.localStorage[key] = settings[key]; | |
1053 } catch(e) { | |
1054 // Ignore malformed settings. | |
1055 } | |
1056 } | |
1057 })();} | 1045 })();} |
1058 | 1046 |
1059 | 1047 |
1060 // This must be constructed after the query parameters have been parsed. | 1048 // This must be constructed after the query parameters have been parsed. |
1061 Runtime.experiments = new Runtime.ExperimentsSupport(); | 1049 Runtime.experiments = new Runtime.ExperimentsSupport(); |
1062 | 1050 |
1063 /** | 1051 /** |
1064 * @type {?string} | 1052 * @type {?string} |
1065 */ | 1053 */ |
1066 Runtime._remoteBase = Runtime.queryParam("remoteBase"); | 1054 Runtime._remoteBase = Runtime.queryParam("remoteBase"); |
1067 | 1055 |
1068 /** @type {!Runtime} */ | 1056 /** @type {!Runtime} */ |
1069 var runtime; | 1057 var runtime; |
OLD | NEW |