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 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1094 { | 1094 { |
1095 var queryParams = location.search; | 1095 var queryParams = location.search; |
1096 if (!queryParams) | 1096 if (!queryParams) |
1097 return; | 1097 return; |
1098 var params = queryParams.substring(1).split("&"); | 1098 var params = queryParams.substring(1).split("&"); |
1099 for (var i = 0; i < params.length; ++i) { | 1099 for (var i = 0; i < params.length; ++i) { |
1100 var pair = params[i].split("="); | 1100 var pair = params[i].split("="); |
1101 var name = pair.shift(); | 1101 var name = pair.shift(); |
1102 Runtime._queryParamsObject[name] = pair.join("="); | 1102 Runtime._queryParamsObject[name] = pair.join("="); |
1103 } | 1103 } |
1104 var flags = Runtime._queryParamsObject["flags"]; | |
1105 delete Runtime._queryParamsObject["flags"]; | |
1106 if (flags) { | |
1107 try { | |
1108 var parsedFlags = JSON.parse(window.decodeURIComponent(flags)); | |
1109 for (var key in parsedFlags) | |
1110 Runtime._queryParamsObject[key] = parsedFlags[key]; | |
1111 } catch(e) { | |
1112 console.error("Invalid startup flag: " + e); | |
1113 } | |
1114 } | |
1115 })();} | 1104 })();} |
1116 | 1105 |
1117 | 1106 |
1118 // This must be constructed after the query parameters have been parsed. | 1107 // This must be constructed after the query parameters have been parsed. |
1119 Runtime.experiments = new Runtime.ExperimentsSupport(); | 1108 Runtime.experiments = new Runtime.ExperimentsSupport(); |
1120 | 1109 |
1121 /** | 1110 /** |
1122 * @type {?string} | 1111 * @type {?string} |
1123 */ | 1112 */ |
1124 Runtime._remoteBase = Runtime.queryParam("remoteBase"); | 1113 Runtime._remoteBase = Runtime.queryParam("remoteBase"); |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 send: function(message) { }, | 1150 send: function(message) { }, |
1162 | 1151 |
1163 /** | 1152 /** |
1164 * @return {!Promise<boolean>} | 1153 * @return {!Promise<boolean>} |
1165 */ | 1154 */ |
1166 close: function() { } | 1155 close: function() { } |
1167 } | 1156 } |
1168 | 1157 |
1169 /** @type {!Runtime} */ | 1158 /** @type {!Runtime} */ |
1170 var runtime; | 1159 var runtime; |
OLD | NEW |