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

Side by Side Diff: Source/devtools/front_end/main/Main.js

Issue 1088093002: Revert of DevTools: allow storing devtools preferences on the browser side. [blink] (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 } 110 }
111 } 111 }
112 }, 112 },
113 113
114 _loaded: function() 114 _loaded: function()
115 { 115 {
116 console.timeStamp("Main._loaded"); 116 console.timeStamp("Main._loaded");
117 117
118 if (InspectorFrontendHost.isUnderTest()) 118 if (InspectorFrontendHost.isUnderTest())
119 self.runtime.useTestBase(); 119 self.runtime.useTestBase();
120 InspectorFrontendHost.getPreferences(this._createSettings.bind(this)); 120 this._createSettings();
121 },
122
123 /**
124 * @param {!Object<string, string>} prefs
125 */
126 _createSettings: function(prefs)
127 {
128 // Patch settings from the URL param (for tests).
129 var settingsParam = Runtime.queryParam("settings");
130 if (settingsParam) {
131 try {
132 var settings = JSON.parse(window.decodeURI(settingsParam));
133 for (var key in settings)
134 prefs[key] = settings[key];
135 } catch(e) {
136 // Ignore malformed settings.
137 }
138 }
139
140 this._initializeExperiments(prefs);
141
142 /**
143 * @param {!Array<{name: string}>} changes
144 */
145 function trackPrefsObject(changes)
146 {
147 if (!Object.keys(prefs).length) {
148 InspectorFrontendHost.clearPreferences();
149 return;
150 }
151
152 for (var change of changes) {
153 var name = change.name;
154 if (name in prefs)
155 InspectorFrontendHost.setPreference(name, prefs[name]);
156 else
157 InspectorFrontendHost.removePreference(name);
158 }
159 }
160
161 Object.observe(prefs, trackPrefsObject);
162 WebInspector.settings = new WebInspector.Settings(prefs);
163
164 if (!InspectorFrontendHost.isUnderTest()) {
165 // This setting is needed for backwards compatibility with Devtools CodeSchool extension. DO NOT REMOVE
166 WebInspector.settings.pauseOnExceptionStateString = new WebInspector .PauseOnExceptionStateSetting();
167 new WebInspector.VersionController().updateVersion();
168 }
169
170 this._createAppUI(); 121 this._createAppUI();
171 }, 122 },
172 123
173 /** 124 _createSettings: function()
174 * @param {!Object<string, string>} prefs 125 {
175 */ 126 this._initializeExperiments();
176 _initializeExperiments: function(prefs) 127 WebInspector.settings = new WebInspector.Settings();
128
129 // This setting is needed for backwards compatibility with Devtools Code School extension. DO NOT REMOVE
130 WebInspector.settings.pauseOnExceptionStateString = new WebInspector.Pau seOnExceptionStateSetting();
131 new WebInspector.VersionController().updateVersion();
132 },
133
134 _initializeExperiments: function()
177 { 135 {
178 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection", true); 136 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection", true);
179 Runtime.experiments.register("animationInspection", "Animation Inspectio n"); 137 Runtime.experiments.register("animationInspection", "Animation Inspectio n");
180 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes"); 138 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes");
181 Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox Jav aScript frames on Timeline"); 139 Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox Jav aScript frames on Timeline");
182 Runtime.experiments.register("timelineDetailsChart", "Costly functions v iew in Timeline details", true); 140 Runtime.experiments.register("timelineDetailsChart", "Costly functions v iew in Timeline details", true);
183 Runtime.experiments.register("customObjectFormatters", "Custom object fo rmatters", true); 141 Runtime.experiments.register("customObjectFormatters", "Custom object fo rmatters", true);
184 Runtime.experiments.register("externalDeviceList", "External device list ", true); 142 Runtime.experiments.register("externalDeviceList", "External device list ", true);
185 Runtime.experiments.register("fileSystemInspection", "FileSystem inspect ion"); 143 Runtime.experiments.register("fileSystemInspection", "FileSystem inspect ion");
186 Runtime.experiments.register("gpuTimeline", "GPU data on timeline", true ); 144 Runtime.experiments.register("gpuTimeline", "GPU data on timeline", true );
187 Runtime.experiments.register("inputEventsOnTimelineOverview", "Input eve nts on Timeline overview", true) 145 Runtime.experiments.register("inputEventsOnTimelineOverview", "Input eve nts on Timeline overview", true)
188 Runtime.experiments.register("layersPanel", "Layers panel"); 146 Runtime.experiments.register("layersPanel", "Layers panel");
189 Runtime.experiments.register("networkRequestHeadersFilterInDetailsView", "Network request headers filter in details view", true); 147 Runtime.experiments.register("networkRequestHeadersFilterInDetailsView", "Network request headers filter in details view", true);
190 Runtime.experiments.register("networkRequestsOnTimeline", "Network reque sts on Timeline"); 148 Runtime.experiments.register("networkRequestsOnTimeline", "Network reque sts on Timeline");
191 Runtime.experiments.register("privateScriptInspection", "Private script inspection"); 149 Runtime.experiments.register("privateScriptInspection", "Private script inspection");
192 Runtime.experiments.register("promiseTracker", "Promise inspector"); 150 Runtime.experiments.register("promiseTracker", "Promise inspector");
193 Runtime.experiments.register("recordFilmStrimInNetworkPanel", "Record Fi lmstrip in Network Panel", true); 151 Runtime.experiments.register("recordFilmStrimInNetworkPanel", "Record Fi lmstrip in Network Panel", true);
194 Runtime.experiments.register("serviceWorkersInPageFrontend", "Service wo rkers in DevTools for page"); 152 Runtime.experiments.register("serviceWorkersInPageFrontend", "Service wo rkers in DevTools for page");
195 Runtime.experiments.register("serviceWorkersInResources", "Service worke rs in Resources panel", true); 153 Runtime.experiments.register("serviceWorkersInResources", "Service worke rs in Resources panel", true);
196 Runtime.experiments.register("showPrimaryLoadWaterfallInNetworkTimeline" , "Show primary load waterfall in Network timeline", true); 154 Runtime.experiments.register("showPrimaryLoadWaterfallInNetworkTimeline" , "Show primary load waterfall in Network timeline", true);
197 Runtime.experiments.register("stepIntoAsync", "Step into async"); 155 Runtime.experiments.register("stepIntoAsync", "Step into async");
198 Runtime.experiments.register("timelineInvalidationTracking", "Timeline i nvalidation tracking", true); 156 Runtime.experiments.register("timelineInvalidationTracking", "Timeline i nvalidation tracking", true);
199 Runtime.experiments.register("timelineTracingJSProfile", "Timeline traci ng based JS profiler", true); 157 Runtime.experiments.register("timelineTracingJSProfile", "Timeline traci ng based JS profiler", true);
200 Runtime.experiments.register("timelineFlowEvents", "Timeline flow events ", true); 158 Runtime.experiments.register("timelineFlowEvents", "Timeline flow events ", true);
201 Runtime.experiments.register("inlineVariableValues", "Display variable v alues inline while debugging"); 159 Runtime.experiments.register("inlineVariableValues", "Display variable v alues inline while debugging");
202 160
203 Runtime.experiments.cleanUpStaleExperiments(); 161 Runtime.experiments.cleanUpStaleExperiments();
204 162
205 if (InspectorFrontendHost.isUnderTest()) { 163 if (InspectorFrontendHost.isUnderTest()) {
206 var testPath = JSON.parse(prefs["testPath"] || "\"\"");
207 // Enable experiments for testing. 164 // Enable experiments for testing.
165 var testPath = self.localStorage ? self.localStorage["testPath"] || "" : "";
208 if (testPath.indexOf("debugger/promise") !== -1) 166 if (testPath.indexOf("debugger/promise") !== -1)
209 Runtime.experiments.enableForTest("promiseTracker"); 167 Runtime.experiments.enableForTest("promiseTracker");
210 if (testPath.indexOf("elements/") !== -1) 168 if (testPath.indexOf("elements/") !== -1)
211 Runtime.experiments.enableForTest("animationInspection"); 169 Runtime.experiments.enableForTest("animationInspection");
212 if (testPath.indexOf("layers/") !== -1) 170 if (testPath.indexOf("layers/") !== -1)
213 Runtime.experiments.enableForTest("layersPanel"); 171 Runtime.experiments.enableForTest("layersPanel");
214 if (testPath.indexOf("service-workers/") !== -1) 172 if (testPath.indexOf("service-workers/") !== -1)
215 Runtime.experiments.enableForTest("serviceWorkersInResources"); 173 Runtime.experiments.enableForTest("serviceWorkersInResources");
216 if (testPath.indexOf("timeline/") !== -1 || testPath.indexOf("layers /") !== -1) 174 if (testPath.indexOf("timeline/") !== -1 || testPath.indexOf("layers /") !== -1)
217 Runtime.experiments.enableForTest("layersPanel"); 175 Runtime.experiments.enableForTest("layersPanel");
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 _settingChanged: function(event) 897 _settingChanged: function(event)
940 { 898 {
941 var value = this._setting.get(); 899 var value = this._setting.get();
942 var targets = WebInspector.OverridesSupport.targetsSupportingEmulation() ; 900 var targets = WebInspector.OverridesSupport.targetsSupportingEmulation() ;
943 for (var i = 0; i < targets.length; ++i) 901 for (var i = 0; i < targets.length; ++i)
944 targets[i].emulationAgent().setScriptExecutionDisabled(value); 902 targets[i].emulationAgent().setScriptExecutionDisabled(value);
945 } 903 }
946 } 904 }
947 905
948 new WebInspector.Main(); 906 new WebInspector.Main();
OLDNEW
« no previous file with comments | « Source/devtools/front_end/host/InspectorFrontendHost.js ('k') | Source/devtools/front_end/settings/SettingsScreen.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698