Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 860 recordPanelShown: function(panelCode) | 860 recordPanelShown: function(panelCode) |
| 861 { | 861 { |
| 862 this.recordEnumeratedHistogram("DevTools.PanelShown", panelCode, 20); | 862 this.recordEnumeratedHistogram("DevTools.PanelShown", panelCode, 20); |
| 863 } | 863 } |
| 864 } | 864 } |
| 865 | 865 |
| 866 window.InspectorFrontendHost = new InspectorFrontendHostImpl(); | 866 window.InspectorFrontendHost = new InspectorFrontendHostImpl(); |
| 867 | 867 |
| 868 // DevToolsApp --------------------------------------------------------------- | 868 // DevToolsApp --------------------------------------------------------------- |
| 869 | 869 |
| 870 function installObjectObserve() | |
| 871 { | |
| 872 var properties = [ | |
| 873 "advancedSearchConfig", "auditsPanelSplitViewState", "auditsSidebarWidth ", "blockedURLs", "breakpoints", "cacheDisabled", "colorFormat", "consoleHistory ", | |
| 874 "consoleTimestampsEnabled", "cpuProfilerView", "cssSourceMapsEnabled", " currentDockState", "customColorPalette", "customDevicePresets", "customEmulatedD eviceList", | |
| 875 "customFormatters", "customUserAgent", "databaseTableViewVisibleColumns" , "dataGrid-cookiesTable", "dataGrid-DOMStorageItemsView", "debuggerSidebarHidde n", "disableDataSaverInfobar", | |
| 876 "disablePausedStateOverlay", "domBreakpoints", "domWordWrap", "elementsP anelSplitViewState", "elementsSidebarWidth", "emulation.deviceHeight", "emulatio n.deviceModeValue", | |
| 877 "emulation.deviceOrientationOverride", "emulation.deviceScale", "emulati on.deviceScaleFactor", "emulation.deviceUA", "emulation.deviceWidth", "emulation .geolocationOverride", | |
| 878 "emulation.showDeviceMode", "emulation.showRulers", "enableAsyncStackTra ces", "eventListenerBreakpoints", "fileMappingEntries", "fileSystemMapping", "Fi leSystemViewSidebarWidth", | |
| 879 "fileSystemViewSplitViewState", "filterBar-consoleView", "filterBar-netw orkPanel", "filterBar-promisePane", "filterBar-timelinePanel", "frameViewerHideC hromeWindow", | |
| 880 "heapSnapshotRetainersViewSize", "heapSnapshotSplitViewState", "hideColl ectedPromises", "hideNetworkMessages", "highlightNodeOnHoverInOverlay", "highRes olutionCpuProfiling", | |
| 881 "inlineVariableValues", "Inspector.drawerSplitView", "Inspector.drawerSp litViewState", "InspectorView.panelOrder", "InspectorView.screencastSplitView", | |
| 882 "InspectorView.screencastSplitViewState", "InspectorView.splitView", "In spectorView.splitViewState", "javaScriptDisabled", "jsSourceMapsEnabled", "lastA ctivePanel", "lastDockState", | |
| 883 "lastSelectedSourcesSidebarPaneTab", "lastSnippetEvaluationIndex", "laye rDetailsSplitView", "layerDetailsSplitViewState", "layersPanelSplitViewState", " layersShowInternalLayers", | |
| 884 "layersSidebarWidth", "messageLevelFilters", "messageURLFilters", "monit oringXHREnabled", "navigatorGroupByFolder", "navigatorHidden", "networkColorCode ResourceTypes", | |
| 885 "networkConditions", "networkConditionsCustomProfiles", "networkHideData URL", "networkLogColumnsVisibility", "networkLogLargeRows", "networkLogShowOverv iew", | |
| 886 "networkPanelSplitViewState", "networkRecordFilmStripSetting", "networkR esourceTypeFilters", "networkShowPrimaryLoadWaterfall", "networkSidebarWidth", " openLinkHandler", | |
| 887 "pauseOnCaughtException", "pauseOnExceptionEnabled", "preserveConsoleLog ", "prettyPrintInfobarDisabled", "previouslyViewedFiles", "profilesPanelSplitVie wState", | |
| 888 "profilesSidebarWidth", "promiseStatusFilters", "recordAllocationStacks" , "requestHeaderFilterSetting", "request-info-formData-category-expanded", | |
| 889 "request-info-general-category-expanded", "request-info-queryString-cate gory-expanded", "request-info-requestHeaders-category-expanded", | |
| 890 "request-info-requestPayload-category-expanded", "request-info-responseH eaders-category-expanded", "resources", "resourcesLastSelectedItem", "resourcesP anelSplitViewState", | |
| 891 "resourcesSidebarWidth", "resourceViewTab", "savedURLs", "screencastEnab led", "scriptsPanelNavigatorSidebarWidth", "searchInContentScripts", "selectedAu ditCategories", | |
| 892 "selectedColorPalette", "selectedProfileType", "shortcutPanelSwitch", "s howAdvancedHeapSnapshotProperties", "showEventListenersForAncestors", "showFrame owkrListeners", | |
| 893 "showHeaSnapshotObjectsHiddenProperties", "showInheritedComputedStylePro perties", "showMediaQueryInspector", "showNativeFunctionsInJSProfile", "showUASh adowDOM", | |
| 894 "showWhitespacesInEditor", "sidebarPosition", "skipContentScripts", "ski pStackFramesPattern", "sourceMapInfobarDisabled", "sourcesPanelDebuggerSidebarSp litViewState", | |
| 895 "sourcesPanelNavigatorSplitViewState", "sourcesPanelSplitSidebarRatio", "sourcesPanelSplitViewState", "sourcesSidebarWidth", "standardEmulatedDeviceList ", | |
| 896 "StylesPaneSplitRatio", "stylesPaneSplitViewState", "textEditorAutocompl etion", "textEditorAutoDetectIndent", "textEditorBracketMatching", "textEditorIn dent", | |
| 897 "timelineCaptureFilmStrip", "timelineCaptureLayersAndPictures", "timelin eCaptureMemory", "timelineCaptureNetwork", "timeline-details", "timelineEnableJS Sampling", | |
| 898 "timelineOverviewMode", "timelinePanelDetailsSplitViewState", "timelineP anelRecorsSplitViewState", "timelinePanelTimelineStackSplitViewState", "timeline Perspective", | |
| 899 "timeline-split", "timelineTreeGroupBy", "timeline-view", "timelineViewM ode", "uiTheme", "watchExpressions", "WebInspector.Drawer.lastSelectedView", "We bInspector.Drawer.showOnLoad", | |
| 900 "workspaceExcludedFolders", "workspaceFolderExcludePattern", "workspaceI nfobarDisabled", "workspaceMappingInfobarDisabled", "xhrBreakpoints"]; | |
| 901 | |
| 902 /** | |
| 903 * @this {!{_storage: Object, _name: string}} | |
| 904 */ | |
| 905 function settingRemove() | |
| 906 { | |
| 907 this._storage[this._name] = undefined; | |
| 908 } | |
| 909 | |
| 910 function objectObserve(object, observer) | |
| 911 { | |
| 912 if (window["WebInspector"]) { | |
| 913 var settingPrototype = window["WebInspector"]["Setting"]["prototype" ]; | |
| 914 if (typeof settingPrototype["remove"] === "function") | |
| 915 settingPrototype["remove"] = settingRemove; | |
| 916 } | |
| 917 | |
| 918 var changedProperties = new Set(); | |
| 919 var scheduled = false; | |
| 920 | |
| 921 function scheduleObserver() | |
| 922 { | |
| 923 if (!scheduled) { | |
| 924 scheduled = true; | |
| 925 setImmediate(callObserver); | |
| 926 } | |
| 927 } | |
| 928 | |
| 929 function callObserver() | |
| 930 { | |
| 931 scheduled = false; | |
| 932 var changes = []; | |
| 933 changedProperties.forEach(function(name) { changes.push({name: name} ); }); | |
| 934 changedProperties.clear(); | |
| 935 observer.call(null, changes); | |
| 936 } | |
| 937 | |
| 938 var storage = new Map(); | |
| 939 | |
| 940 function defineProperty(property) | |
| 941 { | |
| 942 if (property in object) { | |
| 943 storage.set(property, object[property]); | |
| 944 delete object[property]; | |
| 945 } | |
| 946 | |
| 947 Object.defineProperty(object, property, { | |
| 948 get: function() | |
| 949 { | |
| 950 return storage.get(property); | |
| 951 }, | |
| 952 | |
| 953 set: function(value) | |
| 954 { | |
| 955 storage.set(property, value); | |
| 956 changedProperties.add(property); | |
| 957 scheduleObserver(); | |
| 958 } | |
| 959 }); | |
| 960 } | |
| 961 | |
| 962 for (var i = 0; i < properties.length; ++i) | |
| 963 defineProperty(properties[i]); | |
| 964 } | |
| 965 | |
| 966 window.Object.observe = objectObserve; | |
| 967 } | |
| 968 | |
| 870 /** | 969 /** |
| 871 * @suppressGlobalPropertiesCheck | 970 * @suppressGlobalPropertiesCheck |
| 872 */ | 971 */ |
| 873 function installBackwardsCompatibility() | 972 function installBackwardsCompatibility() |
| 874 { | 973 { |
| 875 if (window.location.search.indexOf("remoteFrontend") === -1) | 974 if (window.location.search.indexOf("remoteFrontend") === -1) |
| 876 return; | 975 return; |
| 877 | 976 |
| 977 // Support for legacy (<M50) frontends. | |
| 978 if (typeof window.Object.observe !== "function") | |
|
pfeldman
2016/02/03 03:11:52
Lets define it right away to have more time for te
dgozman
2016/02/03 23:47:18
Done.
| |
| 979 installObjectObserve(); | |
| 980 | |
| 878 /** | 981 /** |
| 879 * @this {CSSStyleDeclaration} | 982 * @this {CSSStyleDeclaration} |
| 880 */ | 983 */ |
| 881 function getValue(property) | 984 function getValue(property) |
| 882 { | 985 { |
| 883 // Note that |property| comes from another context, so we can't use === here. | 986 // Note that |property| comes from another context, so we can't use === here. |
| 884 if (property == "padding-left") { | 987 if (property == "padding-left") { |
| 885 return { | 988 return { |
| 886 /** | 989 /** |
| 887 * @suppressReceiverCheck | 990 * @suppressReceiverCheck |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 954 | 1057 |
| 955 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { | 1058 if (!DOMTokenList.prototype.__originalDOMTokenListToggle) { |
| 956 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; | 1059 DOMTokenList.prototype.__originalDOMTokenListToggle = DOMTokenList.prototype .toggle; |
| 957 DOMTokenList.prototype.toggle = function(token, force) | 1060 DOMTokenList.prototype.toggle = function(token, force) |
| 958 { | 1061 { |
| 959 if (arguments.length === 1) | 1062 if (arguments.length === 1) |
| 960 force = !this.contains(token); | 1063 force = !this.contains(token); |
| 961 return this.__originalDOMTokenListToggle(token, !!force); | 1064 return this.__originalDOMTokenListToggle(token, !!force); |
| 962 } | 1065 } |
| 963 } | 1066 } |
| OLD | NEW |