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

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

Issue 1085253003: Revert of 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 this._createSettings(); 120 InspectorFrontendHost.getPreferences(this._createSettings.bind(this));
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
121 this._createAppUI(); 170 this._createAppUI();
122 }, 171 },
123 172
124 _createSettings: function() 173 /**
125 { 174 * @param {!Object<string, string>} prefs
126 this._initializeExperiments(); 175 */
127 WebInspector.settings = new WebInspector.Settings(); 176 _initializeExperiments: function(prefs)
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()
135 { 177 {
136 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection", true); 178 Runtime.experiments.register("accessibilityInspection", "Accessibility I nspection", true);
137 Runtime.experiments.register("animationInspection", "Animation Inspectio n"); 179 Runtime.experiments.register("animationInspection", "Animation Inspectio n");
138 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes"); 180 Runtime.experiments.register("applyCustomStylesheet", "Allow custom UI t hemes");
139 Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox Jav aScript frames on Timeline"); 181 Runtime.experiments.register("blackboxJSFramesOnTimeline", "Blackbox Jav aScript frames on Timeline");
140 Runtime.experiments.register("timelineDetailsChart", "Costly functions v iew in Timeline details", true); 182 Runtime.experiments.register("timelineDetailsChart", "Costly functions v iew in Timeline details", true);
141 Runtime.experiments.register("customObjectFormatters", "Custom object fo rmatters", true); 183 Runtime.experiments.register("customObjectFormatters", "Custom object fo rmatters", true);
142 Runtime.experiments.register("externalDeviceList", "External device list ", true); 184 Runtime.experiments.register("externalDeviceList", "External device list ", true);
143 Runtime.experiments.register("fileSystemInspection", "FileSystem inspect ion"); 185 Runtime.experiments.register("fileSystemInspection", "FileSystem inspect ion");
144 Runtime.experiments.register("gpuTimeline", "GPU data on timeline", true ); 186 Runtime.experiments.register("gpuTimeline", "GPU data on timeline", true );
145 Runtime.experiments.register("inputEventsOnTimelineOverview", "Input eve nts on Timeline overview", true) 187 Runtime.experiments.register("inputEventsOnTimelineOverview", "Input eve nts on Timeline overview", true)
146 Runtime.experiments.register("layersPanel", "Layers panel"); 188 Runtime.experiments.register("layersPanel", "Layers panel");
147 Runtime.experiments.register("networkRequestHeadersFilterInDetailsView", "Network request headers filter in details view", true); 189 Runtime.experiments.register("networkRequestHeadersFilterInDetailsView", "Network request headers filter in details view", true);
148 Runtime.experiments.register("networkRequestsOnTimeline", "Network reque sts on Timeline"); 190 Runtime.experiments.register("networkRequestsOnTimeline", "Network reque sts on Timeline");
149 Runtime.experiments.register("privateScriptInspection", "Private script inspection"); 191 Runtime.experiments.register("privateScriptInspection", "Private script inspection");
150 Runtime.experiments.register("promiseTracker", "Promise inspector"); 192 Runtime.experiments.register("promiseTracker", "Promise inspector");
151 Runtime.experiments.register("recordFilmStrimInNetworkPanel", "Record Fi lmstrip in Network Panel", true); 193 Runtime.experiments.register("recordFilmStrimInNetworkPanel", "Record Fi lmstrip in Network Panel", true);
152 Runtime.experiments.register("serviceWorkersInPageFrontend", "Service wo rkers in DevTools for page"); 194 Runtime.experiments.register("serviceWorkersInPageFrontend", "Service wo rkers in DevTools for page");
153 Runtime.experiments.register("serviceWorkersInResources", "Service worke rs in Resources panel", true); 195 Runtime.experiments.register("serviceWorkersInResources", "Service worke rs in Resources panel", true);
154 Runtime.experiments.register("showPrimaryLoadWaterfallInNetworkTimeline" , "Show primary load waterfall in Network timeline", true); 196 Runtime.experiments.register("showPrimaryLoadWaterfallInNetworkTimeline" , "Show primary load waterfall in Network timeline", true);
155 Runtime.experiments.register("stepIntoAsync", "Step into async"); 197 Runtime.experiments.register("stepIntoAsync", "Step into async");
156 Runtime.experiments.register("timelineInvalidationTracking", "Timeline i nvalidation tracking", true); 198 Runtime.experiments.register("timelineInvalidationTracking", "Timeline i nvalidation tracking", true);
157 Runtime.experiments.register("timelineTracingJSProfile", "Timeline traci ng based JS profiler", true); 199 Runtime.experiments.register("timelineTracingJSProfile", "Timeline traci ng based JS profiler", true);
158 Runtime.experiments.register("timelineFlowEvents", "Timeline flow events ", true); 200 Runtime.experiments.register("timelineFlowEvents", "Timeline flow events ", true);
159 Runtime.experiments.register("inlineVariableValues", "Display variable v alues inline while debugging"); 201 Runtime.experiments.register("inlineVariableValues", "Display variable v alues inline while debugging");
160 202
161 Runtime.experiments.cleanUpStaleExperiments(); 203 Runtime.experiments.cleanUpStaleExperiments();
162 204
163 if (InspectorFrontendHost.isUnderTest()) { 205 if (InspectorFrontendHost.isUnderTest()) {
206 var testPath = JSON.parse(prefs["testPath"] || "\"\"");
164 // Enable experiments for testing. 207 // Enable experiments for testing.
165 var testPath = self.localStorage ? self.localStorage["testPath"] || "" : "";
166 if (testPath.indexOf("debugger/promise") !== -1) 208 if (testPath.indexOf("debugger/promise") !== -1)
167 Runtime.experiments.enableForTest("promiseTracker"); 209 Runtime.experiments.enableForTest("promiseTracker");
168 if (testPath.indexOf("elements/") !== -1) 210 if (testPath.indexOf("elements/") !== -1)
169 Runtime.experiments.enableForTest("animationInspection"); 211 Runtime.experiments.enableForTest("animationInspection");
170 if (testPath.indexOf("layers/") !== -1) 212 if (testPath.indexOf("layers/") !== -1)
171 Runtime.experiments.enableForTest("layersPanel"); 213 Runtime.experiments.enableForTest("layersPanel");
172 if (testPath.indexOf("service-workers/") !== -1) 214 if (testPath.indexOf("service-workers/") !== -1)
173 Runtime.experiments.enableForTest("serviceWorkersInResources"); 215 Runtime.experiments.enableForTest("serviceWorkersInResources");
174 if (testPath.indexOf("timeline/") !== -1 || testPath.indexOf("layers /") !== -1) 216 if (testPath.indexOf("timeline/") !== -1 || testPath.indexOf("layers /") !== -1)
175 Runtime.experiments.enableForTest("layersPanel"); 217 Runtime.experiments.enableForTest("layersPanel");
(...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 _settingChanged: function(event) 939 _settingChanged: function(event)
898 { 940 {
899 var value = this._setting.get(); 941 var value = this._setting.get();
900 var targets = WebInspector.OverridesSupport.targetsSupportingEmulation() ; 942 var targets = WebInspector.OverridesSupport.targetsSupportingEmulation() ;
901 for (var i = 0; i < targets.length; ++i) 943 for (var i = 0; i < targets.length; ++i)
902 targets[i].emulationAgent().setScriptExecutionDisabled(value); 944 targets[i].emulationAgent().setScriptExecutionDisabled(value);
903 } 945 }
904 } 946 }
905 947
906 new WebInspector.Main(); 948 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