Commit 41957a69 authored by Nathan Bruer's avatar Nathan Bruer Committed by Commit Bot

[Devtools] Fixed regression from SDK.TracingModel.reset() being called

Fixes a regression caused by:
https://chromium-review.googlesource.com/c/526855/

SDK.TracingModel.reset() was removed in favor of destroy() and
re-constructing it, but closure did not complain because of
@unrestricted. This patch also will keep this from happening here by
removing @unrestricted from classes in NetworkPanel.js.

R=caseq
BUG=736219

Change-Id: I4284602dbaca4af93e6645dd395ce4ebc51613ed
Reviewed-on: https://chromium-review.googlesource.com/562299
Commit-Queue: Blaise Bruer <allada@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#485068}
parent f791eeec
......@@ -3,7 +3,6 @@
<title> Change mobile throttling setting.</title>
<script src = "../../http/tests/inspector/inspector-test.js"></script>
<script>
function initialize_ThrottlingTest() {
InspectorTest.preloadPanel("network");
InspectorTest.preloadPanel("timeline");
......@@ -14,8 +13,8 @@ function test() {
var deviceModeView = new Emulation.DeviceModeView();
var deviceModeThrottling = deviceModeView._toolbar._throttlingConditionsItem;
var networkPanelThrottling = UI.panels.network._throttlingSelect;
var networkPanelOfflineCheckbox = UI.panels.network._offlineCheckbox.inputElement;
var networkPanelThrottling = UI.panels.network.throttlingSelectForTest();
var networkPanelOfflineCheckbox = UI.panels.network.offlineCheckboxForTest().inputElement;
var networkConditionsDrawerThrottlingSelector =
self.runtime.sharedInstance(Network.NetworkConfigView)._networkThrottlingSelect;
var performancePanelNetworkThrottling = UI.panels.timeline._networkThrottlingSelect;
......
......@@ -30,7 +30,6 @@
/**
* @implements {UI.ContextMenu.Provider}
* @implements {UI.Searchable}
* @unrestricted
*/
Network.NetworkPanel = class extends UI.Panel {
constructor() {
......@@ -42,6 +41,10 @@ Network.NetworkPanel = class extends UI.Panel {
this._networkRecordFilmStripSetting = Common.settings.createSetting('networkRecordFilmStripSetting', false);
this._toggleRecordAction = /** @type {!UI.Action }*/ (UI.actionRegistry.action('network.toggle-recording'));
/** @type {number|undefined} */
this._pendingStopTimer;
/** @type {?Network.NetworkItemView} */
this._networkItemView = null;
/** @type {?PerfUI.FilmStripView} */
this._filmStripView = null;
/** @type {?Network.NetworkPanel.FilmStripRecorder} */
......@@ -93,7 +96,11 @@ Network.NetworkPanel = class extends UI.Panel {
this._networkLogLargeRowsSetting.addChangeListener(this._toggleLargerRequests, this);
this._networkRecordFilmStripSetting.addChangeListener(this._toggleRecordFilmStrip, this);
this._createToolbarButtons();
this._preserveLogSetting = Common.moduleSetting('network_log.preserve-log');
this._offlineCheckbox = MobileThrottling.throttlingManager().createOfflineToolbarCheckbox();
this._throttlingSelect = this._createThrottlingConditionsSelect();
this._setupToolbarButtons();
this._toggleRecord(true);
this._toggleShowOverview();
......@@ -135,6 +142,20 @@ Network.NetworkPanel = class extends UI.Panel {
return /** @type {!Network.NetworkPanel} */ (self.runtime.sharedInstance(Network.NetworkPanel));
}
/**
* @return {!UI.ToolbarCheckbox}
*/
offlineCheckboxForTest() {
return this._offlineCheckbox;
}
/**
* @return {!UI.ToolbarComboBox}
*/
throttlingSelectForTest() {
return this._throttlingSelect;
}
/**
* @param {!Common.Event} event
*/
......@@ -144,12 +165,12 @@ Network.NetworkPanel = class extends UI.Panel {
this._networkLogView.setWindow(startTime, endTime);
}
_createToolbarButtons() {
_setupToolbarButtons() {
this._panelToolbar.appendToolbarItem(UI.Toolbar.createActionButton(this._toggleRecordAction));
this._clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon-clear');
this._clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => NetworkLog.networkLog.reset(), this);
this._panelToolbar.appendToolbarItem(this._clearButton);
var clearButton = new UI.ToolbarButton(Common.UIString('Clear'), 'largeicon-clear');
clearButton.addEventListener(UI.ToolbarButton.Events.Click, () => NetworkLog.networkLog.reset(), this);
this._panelToolbar.appendToolbarItem(clearButton);
this._panelToolbar.appendSeparator();
var recordFilmStripButton = new UI.ToolbarSettingToggle(
this._networkRecordFilmStripSetting, 'largeicon-camera', Common.UIString('Capture screenshots'));
......@@ -176,20 +197,17 @@ Network.NetworkPanel = class extends UI.Panel {
}
this._panelToolbar.appendSeparator();
this._preserveLogSetting = Common.moduleSetting('network_log.preserve-log');
this._panelToolbar.appendToolbarItem(new UI.ToolbarSettingCheckbox(
this._preserveLogSetting, Common.UIString('Do not clear log on page reload / navigation'),
Common.UIString('Preserve log')));
this._disableCacheCheckbox = new UI.ToolbarSettingCheckbox(
var disableCacheCheckbox = new UI.ToolbarSettingCheckbox(
Common.moduleSetting('cacheDisabled'), Common.UIString('Disable cache (while DevTools is open)'),
Common.UIString('Disable cache'));
this._panelToolbar.appendToolbarItem(this._disableCacheCheckbox);
this._panelToolbar.appendToolbarItem(disableCacheCheckbox);
this._panelToolbar.appendSeparator();
this._offlineCheckbox = MobileThrottling.throttlingManager().createOfflineToolbarCheckbox();
this._panelToolbar.appendToolbarItem(this._offlineCheckbox);
this._throttlingSelect = this._createThrottlingConditionsSelect();
this._panelToolbar.appendToolbarItem(this._throttlingSelect);
this._panelToolbar.appendToolbarItem(new UI.ToolbarItem(this._progressBarContainer));
......@@ -609,7 +627,6 @@ Network.NetworkPanel.RequestRevealer = class {
/**
* @implements {SDK.TracingManagerClient}
* @unrestricted
*/
Network.NetworkPanel.FilmStripRecorder = class {
/**
......@@ -623,6 +640,10 @@ Network.NetworkPanel.FilmStripRecorder = class {
this._resourceTreeModel = null;
this._timeCalculator = timeCalculator;
this._filmStripView = filmStripView;
/** @type {?SDK.TracingModel} */
this._tracingModel = null;
/** @type {?function(?SDK.FilmStripModel)} */
this._callback = null;
}
/**
......@@ -643,7 +664,7 @@ Network.NetworkPanel.FilmStripRecorder = class {
this._tracingModel.tracingComplete();
this._tracingManager = null;
this._callback(new SDK.FilmStripModel(this._tracingModel, this._timeCalculator.minimumBoundary() * 1000));
delete this._callback;
this._callback = null;
if (this._resourceTreeModel)
this._resourceTreeModel.resumeReload();
this._resourceTreeModel = null;
......@@ -672,9 +693,8 @@ Network.NetworkPanel.FilmStripRecorder = class {
this._tracingManager = tracingManagers[0];
this._resourceTreeModel = this._tracingManager.target().model(SDK.ResourceTreeModel);
if (this._tracingModel)
this._tracingModel.reset();
else
this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage('tracing'));
this._tracingModel.dispose();
this._tracingModel = new SDK.TracingModel(new Bindings.TempFileBackingStorage('tracing'));
this._tracingManager.start(this, '-*,disabled-by-default-devtools.screenshot', '');
}
......@@ -702,7 +722,6 @@ Network.NetworkPanel.FilmStripRecorder = class {
/**
* @implements {UI.ActionDelegate}
* @unrestricted
*/
Network.NetworkPanel.RecordActionDelegate = class {
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment