| OLD | NEW |
| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 * @param {boolean} hard | 44 * @param {boolean} hard |
| 45 */ | 45 */ |
| 46 static _reloadPage(hard) { | 46 static _reloadPage(hard) { |
| 47 var mainTarget = SDK.targetManager.mainTarget(); | 47 var mainTarget = SDK.targetManager.mainTarget(); |
| 48 if (mainTarget && mainTarget.hasBrowserCapability()) | 48 if (mainTarget && mainTarget.hasBrowserCapability()) |
| 49 SDK.targetManager.reloadPage(hard); | 49 SDK.targetManager.reloadPage(hard); |
| 50 } | 50 } |
| 51 | 51 |
| 52 _loaded() { | 52 _loaded() { |
| 53 console.timeStamp('Main._loaded'); | 53 console.timeStamp('Main._loaded'); |
| 54 | |
| 55 if (InspectorFrontendHost.isUnderTest()) | |
| 56 self.runtime.useTestBase(); | |
| 57 Runtime.setPlatform(Host.platform()); | 54 Runtime.setPlatform(Host.platform()); |
| 58 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); | 55 InspectorFrontendHost.getPreferences(this._gotPreferences.bind(this)); |
| 59 } | 56 } |
| 60 | 57 |
| 61 /** | 58 /** |
| 62 * @param {!Object<string, string>} prefs | 59 * @param {!Object<string, string>} prefs |
| 63 */ | 60 */ |
| 64 _gotPreferences(prefs) { | 61 _gotPreferences(prefs) { |
| 65 console.timeStamp('Main._gotPreferences'); | 62 console.timeStamp('Main._gotPreferences'); |
| 63 if (Host.isUnderTest(prefs)) |
| 64 self.runtime.useTestBase(); |
| 66 this._createSettings(prefs); | 65 this._createSettings(prefs); |
| 67 this._createAppUI(); | 66 this._createAppUI(); |
| 68 } | 67 } |
| 69 | 68 |
| 70 /** | 69 /** |
| 71 * @param {!Object<string, string>} prefs | 70 * @param {!Object<string, string>} prefs |
| 72 * Note: this function is called from testSettings in Tests.js. | 71 * Note: this function is called from testSettings in Tests.js. |
| 73 */ | 72 */ |
| 74 _createSettings(prefs) { | 73 _createSettings(prefs) { |
| 75 this._initializeExperiments(prefs); | 74 this._initializeExperiments(prefs); |
| 76 var storagePrefix = ''; | 75 var storagePrefix = ''; |
| 77 if (Host.isCustomDevtoolsFrontend()) | 76 if (Host.isCustomDevtoolsFrontend()) |
| 78 storagePrefix = '__custom__'; | 77 storagePrefix = '__custom__'; |
| 79 else if ( | 78 else if ( |
| 80 !Runtime.queryParam('can_dock') && !!Runtime.queryParam('debugFrontend')
&& | 79 !Runtime.queryParam('can_dock') && !!Runtime.queryParam('debugFrontend')
&& |
| 81 !InspectorFrontendHost.isUnderTest()) | 80 !Host.isUnderTest(prefs)) |
| 82 storagePrefix = '__bundled__'; | 81 storagePrefix = '__bundled__'; |
| 83 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind
(window.localStorage) : undefined; | 82 var clearLocalStorage = window.localStorage ? window.localStorage.clear.bind
(window.localStorage) : undefined; |
| 84 var localStorage = | 83 var localStorage = |
| 85 new Common.SettingsStorage(window.localStorage || {}, undefined, undefin
ed, clearLocalStorage, storagePrefix); | 84 new Common.SettingsStorage(window.localStorage || {}, undefined, undefin
ed, clearLocalStorage, storagePrefix); |
| 86 var globalStorage = new Common.SettingsStorage( | 85 var globalStorage = new Common.SettingsStorage( |
| 87 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove
Preference, | 86 prefs, InspectorFrontendHost.setPreference, InspectorFrontendHost.remove
Preference, |
| 88 InspectorFrontendHost.clearPreferences, storagePrefix); | 87 InspectorFrontendHost.clearPreferences, storagePrefix); |
| 89 Common.settings = new Common.Settings(globalStorage, localStorage); | 88 Common.settings = new Common.Settings(globalStorage, localStorage); |
| 90 | 89 if (!Host.isUnderTest(prefs)) |
| 91 if (!InspectorFrontendHost.isUnderTest()) | |
| 92 new Common.VersionController().updateVersion(); | 90 new Common.VersionController().updateVersion(); |
| 93 } | 91 } |
| 94 | 92 |
| 95 /** | 93 /** |
| 96 * @param {!Object<string, string>} prefs | 94 * @param {!Object<string, string>} prefs |
| 97 */ | 95 */ |
| 98 _initializeExperiments(prefs) { | 96 _initializeExperiments(prefs) { |
| 99 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe
ction'); | 97 Runtime.experiments.register('accessibilityInspection', 'Accessibility Inspe
ction'); |
| 100 Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI theme
s'); | 98 Runtime.experiments.register('applyCustomStylesheet', 'Allow custom UI theme
s'); |
| 101 Runtime.experiments.register('audits2', 'Audits 2.0', true); | 99 Runtime.experiments.register('audits2', 'Audits 2.0', true); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 122 Runtime.experiments.register('timelineFlowEvents', 'Timeline flow events', t
rue); | 120 Runtime.experiments.register('timelineFlowEvents', 'Timeline flow events', t
rue); |
| 123 Runtime.experiments.register('timelineInvalidationTracking', 'Timeline inval
idation tracking', true); | 121 Runtime.experiments.register('timelineInvalidationTracking', 'Timeline inval
idation tracking', true); |
| 124 Runtime.experiments.register('timelineRecordingPerspectives', 'Timeline reco
rding perspectives UI'); | 122 Runtime.experiments.register('timelineRecordingPerspectives', 'Timeline reco
rding perspectives UI'); |
| 125 Runtime.experiments.register('timelineTracingJSProfile', 'Timeline tracing b
ased JS profiler', true); | 123 Runtime.experiments.register('timelineTracingJSProfile', 'Timeline tracing b
ased JS profiler', true); |
| 126 Runtime.experiments.register('timelineV8RuntimeCallStats', 'V8 Runtime Call
Stats on Timeline', true); | 124 Runtime.experiments.register('timelineV8RuntimeCallStats', 'V8 Runtime Call
Stats on Timeline', true); |
| 127 Runtime.experiments.register('timelineRuleUsageRecording', 'Track CSS rules
usage while recording Timeline.'); | 125 Runtime.experiments.register('timelineRuleUsageRecording', 'Track CSS rules
usage while recording Timeline.'); |
| 128 Runtime.experiments.register('timelinePerFrameTrack', 'Show track per frame
on Timeline', true); | 126 Runtime.experiments.register('timelinePerFrameTrack', 'Show track per frame
on Timeline', true); |
| 129 | 127 |
| 130 Runtime.experiments.cleanUpStaleExperiments(); | 128 Runtime.experiments.cleanUpStaleExperiments(); |
| 131 | 129 |
| 132 if (InspectorFrontendHost.isUnderTest()) { | 130 if (Host.isUnderTest(prefs)) { |
| 133 var testPath = JSON.parse(prefs['testPath'] || '""'); | 131 var testPath = JSON.parse(prefs['testPath'] || '""'); |
| 134 // Enable experiments for testing. | 132 // Enable experiments for testing. |
| 135 if (testPath.indexOf('layers/') !== -1) | 133 if (testPath.indexOf('layers/') !== -1) |
| 136 Runtime.experiments.enableForTest('layersPanel'); | 134 Runtime.experiments.enableForTest('layersPanel'); |
| 137 if (testPath.indexOf('timeline/') !== -1 || testPath.indexOf('layers/') !=
= -1) | 135 if (testPath.indexOf('timeline/') !== -1 || testPath.indexOf('layers/') !=
= -1) |
| 138 Runtime.experiments.enableForTest('layersPanel'); | 136 Runtime.experiments.enableForTest('layersPanel'); |
| 139 if (testPath.indexOf('security/') !== -1) | 137 if (testPath.indexOf('security/') !== -1) |
| 140 Runtime.experiments.enableForTest('securityPanel'); | 138 Runtime.experiments.enableForTest('securityPanel'); |
| 141 if (testPath.indexOf('accessibility/') !== -1) | 139 if (testPath.indexOf('accessibility/') !== -1) |
| 142 Runtime.experiments.enableForTest('accessibilityInspection'); | 140 Runtime.experiments.enableForTest('accessibilityInspection'); |
| (...skipping 908 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1051 * @override | 1049 * @override |
| 1052 * @return {?Element} | 1050 * @return {?Element} |
| 1053 */ | 1051 */ |
| 1054 settingElement() { | 1052 settingElement() { |
| 1055 return UI.SettingsUI.createSettingCheckbox( | 1053 return UI.SettingsUI.createSettingCheckbox( |
| 1056 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); | 1054 Common.UIString('Show rulers'), Common.moduleSetting('showMetricsRulers'
)); |
| 1057 } | 1055 } |
| 1058 }; | 1056 }; |
| 1059 | 1057 |
| 1060 new Main.Main(); | 1058 new Main.Main(); |
| OLD | NEW |