| Index: Source/devtools/front_end/main/Main.js
|
| diff --git a/Source/devtools/front_end/main/Main.js b/Source/devtools/front_end/main/Main.js
|
| index 15a90efe4d70583ce9f6ec2b0d70362009bdcb78..c388bba8ce1e1eff38b7103dbcb1f0bff75f713f 100644
|
| --- a/Source/devtools/front_end/main/Main.js
|
| +++ b/Source/devtools/front_end/main/Main.js
|
| @@ -117,21 +117,63 @@
|
|
|
| if (InspectorFrontendHost.isUnderTest())
|
| self.runtime.useTestBase();
|
| - this._createSettings();
|
| + InspectorFrontendHost.getPreferences(this._createSettings.bind(this));
|
| + },
|
| +
|
| + /**
|
| + * @param {!Object<string, string>} prefs
|
| + */
|
| + _createSettings: function(prefs)
|
| + {
|
| + // Patch settings from the URL param (for tests).
|
| + var settingsParam = Runtime.queryParam("settings");
|
| + if (settingsParam) {
|
| + try {
|
| + var settings = JSON.parse(window.decodeURI(settingsParam));
|
| + for (var key in settings)
|
| + prefs[key] = settings[key];
|
| + } catch(e) {
|
| + // Ignore malformed settings.
|
| + }
|
| + }
|
| +
|
| + this._initializeExperiments(prefs);
|
| +
|
| + /**
|
| + * @param {!Array<{name: string}>} changes
|
| + */
|
| + function trackPrefsObject(changes)
|
| + {
|
| + if (!Object.keys(prefs).length) {
|
| + InspectorFrontendHost.clearPreferences();
|
| + return;
|
| + }
|
| +
|
| + for (var change of changes) {
|
| + var name = change.name;
|
| + if (name in prefs)
|
| + InspectorFrontendHost.setPreference(name, prefs[name]);
|
| + else
|
| + InspectorFrontendHost.removePreference(name);
|
| + }
|
| + }
|
| +
|
| + Object.observe(prefs, trackPrefsObject);
|
| + WebInspector.settings = new WebInspector.Settings(prefs);
|
| +
|
| + if (!InspectorFrontendHost.isUnderTest()) {
|
| + // This setting is needed for backwards compatibility with Devtools CodeSchool extension. DO NOT REMOVE
|
| + WebInspector.settings.pauseOnExceptionStateString = new WebInspector.PauseOnExceptionStateSetting();
|
| + new WebInspector.VersionController().updateVersion();
|
| + }
|
| +
|
| this._createAppUI();
|
| },
|
|
|
| - _createSettings: function()
|
| - {
|
| - this._initializeExperiments();
|
| - WebInspector.settings = new WebInspector.Settings();
|
| -
|
| - // This setting is needed for backwards compatibility with Devtools CodeSchool extension. DO NOT REMOVE
|
| - WebInspector.settings.pauseOnExceptionStateString = new WebInspector.PauseOnExceptionStateSetting();
|
| - new WebInspector.VersionController().updateVersion();
|
| - },
|
| -
|
| - _initializeExperiments: function()
|
| + /**
|
| + * @param {!Object<string, string>} prefs
|
| + */
|
| + _initializeExperiments: function(prefs)
|
| {
|
| Runtime.experiments.register("accessibilityInspection", "Accessibility Inspection", true);
|
| Runtime.experiments.register("animationInspection", "Animation Inspection");
|
| @@ -161,8 +203,8 @@
|
| Runtime.experiments.cleanUpStaleExperiments();
|
|
|
| if (InspectorFrontendHost.isUnderTest()) {
|
| + var testPath = JSON.parse(prefs["testPath"] || "\"\"");
|
| // Enable experiments for testing.
|
| - var testPath = self.localStorage ? self.localStorage["testPath"] || "" : "";
|
| if (testPath.indexOf("debugger/promise") !== -1)
|
| Runtime.experiments.enableForTest("promiseTracker");
|
| if (testPath.indexOf("elements/") !== -1)
|
|
|