Title: [222338] trunk/Source
Revision
222338
Author
[email protected]
Date
2017-09-21 12:04:30 -0700 (Thu, 21 Sep 2017)

Log Message

Web Inspector: keyboard shortcut for "Reload page from origin" doesn't match Safari, and doesn't work
https://bugs.webkit.org/show_bug.cgi?id=177010
<rdar://problem/33134548>

Reviewed by Joseph Pecoraro.

Source/_javascript_Core:

Use "reload from origin" nomenclature instead of "reload ignoring cache".

* inspector/protocol/Page.json: Improve the comment, but don't change the
parameter name since this would be a divergence from legacy protocols.

Source/WebCore:

Use "reload from origin" nomenclature instead of "reload ignoring cache".

* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::reload):
* inspector/InspectorPageAgent.h:

Source/WebInspectorUI:

I seem to have broken reload from origin via Web Inspector in a previous
patch, because the parameter is 'ignoreCache' instead of 'shouldIgnoreCache'.

* Localizations/en.lproj/localizedStrings.js:
Modernize tooltip text.

* UserInterface/Base/Main.js:
(WI.contentLoaded):
Disambiguate two locals with the same name. Modernize the tooltip.
Make the shortcut Cmd-Opt-R to match Safari. Fix wrong parameter usage.

* UserInterface/Test/FrontendTestHarness.js:
(FrontendTestHarness.prototype.reloadPage):
Fix wrong parameter.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (222337 => 222338)


--- trunk/Source/_javascript_Core/ChangeLog	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-09-21 19:04:30 UTC (rev 222338)
@@ -1,3 +1,16 @@
+2017-09-21  Brian Burg  <[email protected]>
+
+        Web Inspector: keyboard shortcut for "Reload page from origin" doesn't match Safari, and doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=177010
+        <rdar://problem/33134548>
+
+        Reviewed by Joseph Pecoraro.
+
+        Use "reload from origin" nomenclature instead of "reload ignoring cache".
+
+        * inspector/protocol/Page.json: Improve the comment, but don't change the
+        parameter name since this would be a divergence from legacy protocols.
+
 2017-09-21  Joseph Pecoraro  <[email protected]>
 
         test262: test262/test/annexB/built-ins/RegExp/prototype/flags/order-after-compile.js ASSERTs

Modified: trunk/Source/_javascript_Core/inspector/protocol/Page.json (222337 => 222338)


--- trunk/Source/_javascript_Core/inspector/protocol/Page.json	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/_javascript_Core/inspector/protocol/Page.json	2017-09-21 19:04:30 UTC (rev 222338)
@@ -98,7 +98,7 @@
             "name": "reload",
             "description": "Reloads the main frame of the inspected page.",
             "parameters": [
-                { "name": "ignoreCache", "type": "boolean", "optional": true, "description": "If true, browser cache is ignored (as if the user pressed Shift+refresh)." },
+                { "name": "ignoreCache", "type": "boolean", "optional": true, "description": "If true, the page is reloaded from its origin without using cached resources." },
                 { "name": "revalidateAllResources", "type": "boolean", "optional": true, "description": "If true, all cached subresources will be revalidated when the main resource loads. Otherwise, only expired cached subresources will be revalidated (the default behavior for most WebKit clients)." },
                 { "name": "scriptToEvaluateOnLoad", "type": "string", "optional": true, "description": "If set, the script will be injected into all frames of the inspected page after reload." }
             ]

Modified: trunk/Source/WebCore/ChangeLog (222337 => 222338)


--- trunk/Source/WebCore/ChangeLog	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebCore/ChangeLog	2017-09-21 19:04:30 UTC (rev 222338)
@@ -1,3 +1,17 @@
+2017-09-21  Brian Burg  <[email protected]>
+
+        Web Inspector: keyboard shortcut for "Reload page from origin" doesn't match Safari, and doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=177010
+        <rdar://problem/33134548>
+
+        Reviewed by Joseph Pecoraro.
+
+        Use "reload from origin" nomenclature instead of "reload ignoring cache".
+
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::reload):
+        * inspector/InspectorPageAgent.h:
+
 2017-09-21  Antti Koivisto  <[email protected]>
 
         Remove RenderNamedFlowFragment

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (222337 => 222338)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2017-09-21 19:04:30 UTC (rev 222338)
@@ -376,11 +376,11 @@
     setEmulatedMedia(unused, emptyString());
 }
 
-void InspectorPageAgent::reload(ErrorString&, const bool* const optionalIgnoreCache, const bool* const optionalRevalidateAllResources, const String* optionalScriptToEvaluateOnLoad)
+void InspectorPageAgent::reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources, const String* optionalScriptToEvaluateOnLoad)
 {
     m_pendingScriptToEvaluateOnLoadOnce = optionalScriptToEvaluateOnLoad ? *optionalScriptToEvaluateOnLoad : emptyString();
 
-    bool reloadFromOrigin = optionalIgnoreCache && *optionalIgnoreCache;
+    bool reloadFromOrigin = optionalReloadFromOrigin && *optionalReloadFromOrigin;
     bool revalidateAllResources = optionalRevalidateAllResources && *optionalRevalidateAllResources;
 
     OptionSet<ReloadOption> reloadOptions;

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (222337 => 222338)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2017-09-21 19:04:30 UTC (rev 222338)
@@ -92,7 +92,7 @@
     // Page API for InspectorFrontend
     void enable(ErrorString&) override;
     void disable(ErrorString&) override;
-    void reload(ErrorString&, const bool* const optionalIgnoreCache, const bool* const optionalRevalidateAllResources, const String* const optionalScriptToEvaluateOnLoad) override;
+    void reload(ErrorString&, const bool* const optionalReloadFromOrigin, const bool* const optionalRevalidateAllResources, const String* const optionalScriptToEvaluateOnLoad) override;
     void navigate(ErrorString&, const String& url) override;
     void getCookies(ErrorString&, RefPtr<Inspector::Protocol::Array<Inspector::Protocol::Page::Cookie>>& cookies) override;
     void deleteCookie(ErrorString&, const String& cookieName, const String& url) override;

Modified: trunk/Source/WebInspectorUI/ChangeLog (222337 => 222338)


--- trunk/Source/WebInspectorUI/ChangeLog	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebInspectorUI/ChangeLog	2017-09-21 19:04:30 UTC (rev 222338)
@@ -1,3 +1,26 @@
+2017-09-21  Brian Burg  <[email protected]>
+
+        Web Inspector: keyboard shortcut for "Reload page from origin" doesn't match Safari, and doesn't work
+        https://bugs.webkit.org/show_bug.cgi?id=177010
+        <rdar://problem/33134548>
+
+        Reviewed by Joseph Pecoraro.
+
+        I seem to have broken reload from origin via Web Inspector in a previous
+        patch, because the parameter is 'ignoreCache' instead of 'shouldIgnoreCache'.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        Modernize tooltip text.
+
+        * UserInterface/Base/Main.js:
+        (WI.contentLoaded):
+        Disambiguate two locals with the same name. Modernize the tooltip.
+        Make the shortcut Cmd-Opt-R to match Safari. Fix wrong parameter usage.
+
+        * UserInterface/Test/FrontendTestHarness.js:
+        (FrontendTestHarness.prototype.reloadPage):
+        Fix wrong parameter.
+
 2017-09-19  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: Adopt named groups in complex regexes

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (222337 => 222338)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2017-09-21 19:04:30 UTC (rev 222338)
@@ -692,7 +692,7 @@
 localizedStrings["Region announced in its entirety."] = "Region announced in its entirety.";
 localizedStrings["Regular _expression_"] = "Regular _expression_";
 localizedStrings["Reload Web Inspector"] = "Reload Web Inspector";
-localizedStrings["Reload this page (%s)\nReload ignoring cache (%s)"] = "Reload this page (%s)\nReload ignoring cache (%s)";
+localizedStrings["Reload page (%s)\nReload page ignoring cache (%s)"] = "Reload page (%s)\nReload page ignoring cache (%s)";
 localizedStrings["Removals"] = "Removals";
 localizedStrings["Remove Watch _expression_"] = "Remove Watch _expression_";
 localizedStrings["Remove link"] = "Remove link";

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (222337 => 222338)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2017-09-21 19:04:30 UTC (rev 222338)
@@ -327,8 +327,8 @@
     this.tabBrowser.addEventListener(WI.TabBrowser.Event.SelectedTabContentViewDidChange, this._tabBrowserSelectedTabContentViewDidChange, this);
 
     this._reloadPageKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl, "R", this._reloadPage.bind(this));
-    this._reloadPageIgnoringCacheKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "R", this._reloadPageIgnoringCache.bind(this));
-    this._reloadPageKeyboardShortcut.implicitlyPreventsDefault = this._reloadPageIgnoringCacheKeyboardShortcut.implicitlyPreventsDefault = false;
+    this._reloadPageFromOriginKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Option, "R", this._reloadPageFromOrigin.bind(this));
+    this._reloadPageKeyboardShortcut.implicitlyPreventsDefault = this._reloadPageFromOriginKeyboardShortcut.implicitlyPreventsDefault = false;
 
     this._consoleTabKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Option | WI.KeyboardShortcut.Modifier.CommandOrControl, "C", this._showConsoleTab.bind(this));
     this._quickConsoleKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.Control, WI.KeyboardShortcut.Key.Apostrophe, this._focusConsolePrompt.bind(this));
@@ -370,21 +370,21 @@
 
     this._togglePreviousDockConfigurationKeyboardShortcut = new WI.KeyboardShortcut(WI.KeyboardShortcut.Modifier.CommandOrControl | WI.KeyboardShortcut.Modifier.Shift, "D", this._togglePreviousDockConfiguration.bind(this));
 
-    var toolTip;
-    if (WI.sharedApp.debuggableType === WI.DebuggableType._javascript_)
-        toolTip = WI.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
+    let reloadToolTip;
+    if (WI.debuggableType === WI.DebuggableType._javascript_)
+        reloadToolTip = WI.UIString("Restart (%s)").format(this._reloadPageKeyboardShortcut.displayName);
     else
-        toolTip = WI.UIString("Reload this page (%s)\nReload ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageIgnoringCacheKeyboardShortcut.displayName);
+        reloadToolTip = WI.UIString("Reload page (%s)\nReload page ignoring cache (%s)").format(this._reloadPageKeyboardShortcut.displayName, this._reloadPageFromOriginKeyboardShortcut.displayName);
+  
+    this._reloadToolbarButton = new WI.ButtonToolbarItem("reload", reloadToolTip, "Images/ReloadToolbar.svg");
+    this._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._reloadToolbarButtonClicked, this);
 
-    this._reloadToolbarButton = new WI.ButtonToolbarItem("reload", toolTip, "Images/ReloadToolbar.svg");
-    this._reloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._reloadPageClicked, this);
-
     this._downloadToolbarButton = new WI.ButtonToolbarItem("download", WI.UIString("Download Web Archive"), "Images/DownloadArrow.svg");
     this._downloadToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._downloadWebArchive, this);
 
-    var toolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
-    var activatedToolTip = WI.UIString("Stop element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
-    this._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", toolTip, activatedToolTip, "Images/Crosshair.svg");
+    let elementSelectionToolTip = WI.UIString("Start element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
+    let activatedElementSelectionToolTip = WI.UIString("Stop element selection (%s)").format(WI._inspectModeKeyboardShortcut.displayName);
+    this._inspectModeToolbarButton = new WI.ActivateButtonToolbarItem("inspect", elementSelectionToolTip, activatedElementSelectionToolTip, "Images/Crosshair.svg");
     this._inspectModeToolbarButton.addEventListener(WI.ButtonNavigationItem.Event.Clicked, this._toggleInspectMode, this);
 
     this._updateReloadToolbarButton();
@@ -1816,18 +1816,18 @@
     event.preventDefault();
 };
 
-WI._reloadPageClicked = function(event)
+WI._reloadToolbarButtonClicked = function(event)
 {
-    // Ignore cache when the shift key is pressed.
-    PageAgent.reload.invoke({shouldIgnoreCache: window.event ? window.event.shiftKey : false});
+    // Reload page from origin if the button is clicked while the shift key is pressed down.
+    PageAgent.reload.invoke({ignoreCache: this.modifierKeys.shiftKey});
 };
 
-WI._reloadPageIgnoringCache = function(event)
+WI._reloadPageFromOrigin = function(event)
 {
     if (!window.PageAgent)
         return;
 
-    PageAgent.reload(true);
+    PageAgent.reload.invoke({ignoreCache: true});
     event.preventDefault();
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js (222337 => 222338)


--- trunk/Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js	2017-09-21 18:48:08 UTC (rev 222337)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/FrontendTestHarness.js	2017-09-21 19:04:30 UTC (rev 222338)
@@ -128,10 +128,10 @@
         this._testPageIsReloading = true;
 
         let {ignoreCache, revalidateAllResources} = options;
-        let shouldIgnoreCache = !!ignoreCache;
+        ignoreCache = !!ignoreCache;
         revalidateAllResources = !!revalidateAllResources;
 
-        return PageAgent.reload.invoke({shouldIgnoreCache, revalidateAllResources})
+        return PageAgent.reload.invoke({ignoreCache, revalidateAllResources})
             .then(() => {
                 this._shouldResendResults = true;
                 this._testPageReloadedOnce = true;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to