| 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 (function(window) { | 5 (function(window) { |
| 6 | 6 |
| 7 // DevToolsAPI ---------------------------------------------------------------- | 7 // DevToolsAPI ---------------------------------------------------------------- |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * @constructor | 10 * @constructor |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 for (var i = 0; i < properties.length; ++i) | 957 for (var i = 0; i < properties.length; ++i) |
| 958 defineProperty(properties[i]); | 958 defineProperty(properties[i]); |
| 959 } | 959 } |
| 960 | 960 |
| 961 window.Object.observe = objectObserve; | 961 window.Object.observe = objectObserve; |
| 962 } | 962 } |
| 963 | 963 |
| 964 /** | 964 /** |
| 965 * @suppressGlobalPropertiesCheck | 965 * @suppressGlobalPropertiesCheck |
| 966 */ | 966 */ |
| 967 function sanitizeRemoteFrontendUrl() |
| 968 { |
| 969 var queryParams = location.search; |
| 970 if (!queryParams) |
| 971 return; |
| 972 var params = queryParams.substring(1).split("&"); |
| 973 for (var i = 0; i < params.length; ++i) { |
| 974 var pair = params[i].split("="); |
| 975 var name = pair.shift(); |
| 976 var value = pair.join("="); |
| 977 if (name === "remoteFrontendUrl" && !value.startsWith("https://chrome-de
vtools-frontend.appspot.com/")) |
| 978 location.search = ""; |
| 979 } |
| 980 } |
| 981 |
| 982 /** |
| 983 * @suppressGlobalPropertiesCheck |
| 984 */ |
| 967 function installBackwardsCompatibility() | 985 function installBackwardsCompatibility() |
| 968 { | 986 { |
| 987 sanitizeRemoteFrontendUrl(); |
| 988 |
| 969 if (window.location.search.indexOf("remoteFrontend") === -1) | 989 if (window.location.search.indexOf("remoteFrontend") === -1) |
| 970 return; | 990 return; |
| 971 | 991 |
| 972 // Support for legacy (<M50) frontends. | 992 // Support for legacy (<M50) frontends. |
| 973 installObjectObserve(); | 993 installObjectObserve(); |
| 974 | 994 |
| 975 /** | 995 /** |
| 976 * @this {CSSStyleDeclaration} | 996 * @this {CSSStyleDeclaration} |
| 977 */ | 997 */ |
| 978 function getValue(property) | 998 function getValue(property) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1014 // Support for legacy (<M49) frontends. Remove in M52. | 1034 // Support for legacy (<M49) frontends. Remove in M52. |
| 1015 Event.prototype.deepPath = undefined; | 1035 Event.prototype.deepPath = undefined; |
| 1016 } | 1036 } |
| 1017 | 1037 |
| 1018 function windowLoaded() | 1038 function windowLoaded() |
| 1019 { | 1039 { |
| 1020 window.removeEventListener("DOMContentLoaded", windowLoaded, false); | 1040 window.removeEventListener("DOMContentLoaded", windowLoaded, false); |
| 1021 installBackwardsCompatibility(); | 1041 installBackwardsCompatibility(); |
| 1022 } | 1042 } |
| 1023 | 1043 |
| 1044 sanitizeRemoteFrontendUrl(); |
| 1024 if (window.document.head && (window.document.readyState === "complete" || window
.document.readyState === "interactive")) | 1045 if (window.document.head && (window.document.readyState === "complete" || window
.document.readyState === "interactive")) |
| 1025 installBackwardsCompatibility(); | 1046 installBackwardsCompatibility(); |
| 1026 else | 1047 else |
| 1027 window.addEventListener("DOMContentLoaded", windowLoaded, false); | 1048 window.addEventListener("DOMContentLoaded", windowLoaded, false); |
| 1028 | 1049 |
| 1029 })(window); | 1050 })(window); |
| 1030 | 1051 |
| 1031 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1052 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
| 1032 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; | 1053 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype
.toggle; |
| 1033 DOMTokenList.prototype.toggle = function(token, force) | 1054 DOMTokenList.prototype.toggle = function(token, force) |
| 1034 { | 1055 { |
| 1035 if (arguments.length === 1) | 1056 if (arguments.length === 1) |
| 1036 force = !this.contains(token); | 1057 force = !this.contains(token); |
| 1037 return this.__originalDOMTokenListToggle(token, !!force); | 1058 return this.__originalDOMTokenListToggle(token, !!force); |
| 1038 } | 1059 } |
| 1039 } | 1060 } |
| OLD | NEW |