Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 /* eslint-disable indent */ | 5 /* eslint-disable indent */ |
| 6 (function(window) { | 6 (function(window) { |
| 7 | 7 |
| 8 // DevToolsAPI ---------------------------------------------------------------- | 8 // DevToolsAPI ---------------------------------------------------------------- |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 978 } | 978 } |
| 979 | 979 |
| 980 window.Object.observe = objectObserve; | 980 window.Object.observe = objectObserve; |
| 981 } | 981 } |
| 982 | 982 |
| 983 /** | 983 /** |
| 984 * @suppressGlobalPropertiesCheck | 984 * @suppressGlobalPropertiesCheck |
| 985 */ | 985 */ |
| 986 function sanitizeRemoteFrontendUrl() | 986 function sanitizeRemoteFrontendUrl() |
| 987 { | 987 { |
| 988 var remoteBaseRegexp = /^https:\/\/chrome-devtools-frontend\.appspot\.com\/s erve_file\/@[0-9a-zA-Z]+\/?$/; | |
|
caseq
2016/06/16 12:51:16
nit: consider extracting a constant. also, perhaps
dgozman
2016/06/20 19:05:56
These two files cannot share any code.
| |
| 989 var remoteFrontendUrlRegexp = /^https:\/\/chrome-devtools-frontend\.appspot\ .com\/serve_rev\/@?[0-9a-zA-Z]+\/(devtools|inspector)\.html$/; | |
| 988 var queryParams = location.search; | 990 var queryParams = location.search; |
| 989 if (!queryParams) | 991 if (!queryParams) |
| 990 return; | 992 return; |
| 991 var params = queryParams.substring(1).split("&"); | 993 var params = queryParams.substring(1).split("&"); |
| 992 for (var i = 0; i < params.length; ++i) { | 994 for (var i = 0; i < params.length; ++i) { |
| 993 var pair = params[i].split("="); | 995 var pair = params[i].split("="); |
| 994 var name = pair.shift(); | 996 var name = pair.shift(); |
| 995 var value = pair.join("="); | 997 var value = pair.join("="); |
| 996 if (name === "remoteFrontendUrl" && !value.startsWith("https://chrome-de vtools-frontend.appspot.com/")) | 998 if (name === "remoteFrontendUrl" && !remoteFrontendUrlRegexp.test(value) ) |
| 999 location.search = ""; | |
| 1000 if (name === "remoteBase" && !remoteBaseRegexp.test(value)) | |
| 997 location.search = ""; | 1001 location.search = ""; |
| 998 } | 1002 } |
| 999 } | 1003 } |
| 1000 | 1004 |
| 1001 /** | 1005 /** |
| 1002 * @suppressGlobalPropertiesCheck | 1006 * @suppressGlobalPropertiesCheck |
| 1003 */ | 1007 */ |
| 1004 function installBackwardsCompatibility() | 1008 function installBackwardsCompatibility() |
| 1005 { | 1009 { |
| 1006 sanitizeRemoteFrontendUrl(); | 1010 sanitizeRemoteFrontendUrl(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 | 1075 |
| 1072 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1076 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
| 1073 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; | 1077 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; |
| 1074 DOMTokenList.prototype.toggle = function(token, force) | 1078 DOMTokenList.prototype.toggle = function(token, force) |
| 1075 { | 1079 { |
| 1076 if (arguments.length === 1) | 1080 if (arguments.length === 1) |
| 1077 force = !this.contains(token); | 1081 force = !this.contains(token); |
| 1078 return this.__originalDOMTokenListToggle(token, !!force); | 1082 return this.__originalDOMTokenListToggle(token, !!force); |
| 1079 } | 1083 } |
| 1080 } | 1084 } |
| OLD | NEW |