Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/devtools.js

Issue 1983933002: [DevTools] Sanitize remoteFrontendUrl for old frontends. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698