From e7109befe2831d20179ca9420e53de7cc62d6c42 Mon Sep 17 00:00:00 2001 From: Heather Arthur Date: Tue, 10 Jun 2014 13:46:00 -0400 Subject: [PATCH] Bug 984051 - Make reload action more prominent when first opening the network panel. r=vporof --- .../netmonitor/netmonitor-controller.js | 7 ++-- .../devtools/netmonitor/netmonitor-view.js | 8 +++++ browser/devtools/netmonitor/netmonitor.xul | 10 ++++-- browser/devtools/netmonitor/test/browser.ini | 1 + .../test/browser_net_reload-button.js | 34 +++++++++++++++++++ .../chrome/browser/devtools/netmonitor.dtd | 8 +++-- .../themes/shared/devtools/netmonitor.inc.css | 11 +++++- 7 files changed, 70 insertions(+), 9 deletions(-) create mode 100644 browser/devtools/netmonitor/test/browser_net_reload-button.js diff --git a/browser/devtools/netmonitor/netmonitor-controller.js b/browser/devtools/netmonitor/netmonitor-controller.js index 78e3c7fd3774..8fd3238d2170 100644 --- a/browser/devtools/netmonitor/netmonitor-controller.js +++ b/browser/devtools/netmonitor/netmonitor-controller.js @@ -93,7 +93,8 @@ const ACTIVITY_TYPE = { // Forcing the target to reload with cache enabled or disabled. RELOAD: { WITH_CACHE_ENABLED: 1, - WITH_CACHE_DISABLED: 2 + WITH_CACHE_DISABLED: 2, + WITH_CACHE_DEFAULT: 3 }, // Enabling or disabling the cache without triggering a reload. @@ -355,7 +356,9 @@ let NetMonitorController = { let navigationFinished = waitForNavigation(); return reconfigureTab(aOptions).then(() => navigationFinished); } - + if (aType == ACTIVITY_TYPE.RELOAD.WITH_CACHE_DEFAULT) { + return reconfigureTabAndWaitForNavigation({}).then(standBy); + } if (aType == ACTIVITY_TYPE.RELOAD.WITH_CACHE_ENABLED) { this._currentActivity = ACTIVITY_TYPE.ENABLE_CACHE; this._target.once("will-navigate", () => this._currentActivity = aType); diff --git a/browser/devtools/netmonitor/netmonitor-view.js b/browser/devtools/netmonitor/netmonitor-view.js index 6ec1aeeaf3ce..e60aa31a5121 100644 --- a/browser/devtools/netmonitor/netmonitor-view.js +++ b/browser/devtools/netmonitor/netmonitor-view.js @@ -229,6 +229,10 @@ let NetMonitorView = { }); }, + reloadPage: function() { + NetMonitorController.triggerActivity(ACTIVITY_TYPE.RELOAD.WITH_CACHE_DEFAULT); + }, + /** * Lazily initializes and returns a promise for a Editor instance. * @@ -362,6 +366,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { this._onContextCopyImageAsDataUriCommand = this.copyImageAsDataUri.bind(this); this._onContextResendCommand = this.cloneSelectedRequest.bind(this); this._onContextPerfCommand = () => NetMonitorView.toggleFrontendMode(); + this._onReloadCommand = () => NetMonitorView.reloadPage(); this.sendCustomRequestEvent = this.sendCustomRequest.bind(this); this.closeCustomRequestEvent = this.closeCustomRequest.bind(this); @@ -379,6 +384,8 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { }, _onConnect: function() { + $("#requests-menu-reload-notice-button").addEventListener("command", this._onReloadCommand, false); + if (NetMonitorController.supportsCustomRequest) { $("#request-menu-context-resend").addEventListener("command", this._onContextResendCommand, false); $("#custom-request-send-button").addEventListener("click", this.sendCustomRequestEvent, false); @@ -426,6 +433,7 @@ RequestsMenuView.prototype = Heritage.extend(WidgetMethods, { $("#request-menu-context-resend").removeEventListener("command", this._onContextResendCommand, false); $("#request-menu-context-perf").removeEventListener("command", this._onContextPerfCommand, false); + $("#requests-menu-reload-notice-button").removeEventListener("command", this._onReloadCommand, false); $("#requests-menu-perf-notice-button").removeEventListener("command", this._onContextPerfCommand, false); $("#requests-menu-network-summary-button").removeEventListener("command", this._onContextPerfCommand, false); $("#requests-menu-network-summary-label").removeEventListener("click", this._onContextPerfCommand, false); diff --git a/browser/devtools/netmonitor/netmonitor.xul b/browser/devtools/netmonitor/netmonitor.xul index 4edcd6cbe5cc..f6fd780432a6 100644 --- a/browser/devtools/netmonitor/netmonitor.xul +++ b/browser/devtools/netmonitor/netmonitor.xul @@ -135,15 +135,19 @@ + +