Changeset 192790 in webkit


Ignore:
Timestamp:
Nov 29, 2015 4:56:22 PM (8 years ago)
Author:
BJ Burg
Message:

Web Inspector: Add context menu item to Reload the Inspector
https://bugs.webkit.org/show_bug.cgi?id=141742

Reviewed by Timothy Hatcher.

Add a global context menu and global shortcut (Cmd-Opt-Shift-R) to
reload the Web Inspector frontend without closing the browser.

This should make it possible to more quickly fix typos, small nits,
etc. without having to relaunch. It might also make state
restoration bugs more visible in engineering builds, since there
is hardly any delay between seeing the old and reloaded frontends.

Note that this functionality reloads scripts from the configuration's
build directory, so you still need to "build" WebInspectorUI to ensure
that any changed files are properly minified and staged.

  • UserInterface/Base/Main.js:

(WebInspector.unlocalizedString):

Added. Make it obvious when strings are intentionally not localized.

(WebInspector._contextMenuRequested):

If the "Show Debug UI" setting is available and true, add
a global "Reload Web Inspector" menu item to every context
menu. Otherwise, don't eagerly create a context menu.

  • UserInterface/Debug/Bootstrap.js: Add Cmd-Opt-Shift-R shortcut.
Location:
trunk/Source/WebInspectorUI
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebInspectorUI/ChangeLog

    r192789 r192790  
     12015-11-29  Brian Burg  <bburg@apple.com>
     2
     3        Web Inspector: Add context menu item to Reload the Inspector
     4        https://bugs.webkit.org/show_bug.cgi?id=141742
     5
     6        Reviewed by Timothy Hatcher.
     7
     8        Add a global context menu and global shortcut (Cmd-Opt-Shift-R) to
     9        reload the Web Inspector frontend without closing the browser.
     10
     11        This should make it possible to more quickly fix typos, small nits,
     12        etc. without having to relaunch. It might also make state
     13        restoration bugs more visible in engineering builds, since there
     14        is hardly any delay between seeing the old and reloaded frontends.
     15
     16        Note that this functionality reloads scripts from the configuration's
     17        build directory, so you still need to "build" WebInspectorUI to ensure
     18        that any changed files are properly minified and staged.
     19
     20        * UserInterface/Base/Main.js:
     21        (WebInspector.unlocalizedString):
     22
     23            Added. Make it obvious when strings are intentionally not localized.
     24
     25        (WebInspector._contextMenuRequested):
     26
     27            If the "Show Debug UI" setting is available and true, add
     28            a global "Reload Web Inspector" menu item to every context
     29            menu. Otherwise, don't eagerly create a context menu.
     30        * UserInterface/Debug/Bootstrap.js: Add Cmd-Opt-Shift-R shortcut.
     31
    1322015-11-29  Brian Burg  <bburg@apple.com>
    233
  • trunk/Source/WebInspectorUI/UserInterface/Base/Main.js

    r192789 r192790  
    884884};
    885885
     886WebInspector.unlocalizedString = function(string)
     887{
     888    // Intentionally do nothing, since this is for engineering builds
     889    // (such as in Debug UI) or in text that is standardized in English.
     890    // For example, CSS property names and values are never localized.
     891    return string;
     892}
     893
    886894WebInspector.UIString = function(string, vararg)
    887895{
     
    13291337WebInspector._contextMenuRequested = function(event)
    13301338{
    1331     const onlyExisting = true;
    1332     let proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event, onlyExisting);
     1339    let proposedContextMenu;
     1340
     1341    // This is setting is only defined in engineering builds.
     1342    let showDebugUI = WebInspector.showDebugUISetting && WebInspector.showDebugUISetting.value;
     1343    if (showDebugUI) {
     1344        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event);
     1345        proposedContextMenu.appendSeparator();
     1346        proposedContextMenu.appendItem(WebInspector.unlocalizedString("Reload Web Inspector"), () => {
     1347            window.location.reload();
     1348        });
     1349    } else {
     1350        const onlyExisting = true;
     1351        proposedContextMenu = WebInspector.ContextMenu.createFromEvent(event, onlyExisting);
     1352    }
     1353
    13331354    if (proposedContextMenu)
    13341355        proposedContextMenu.show();
  • trunk/Source/WebInspectorUI/UserInterface/Debug/Bootstrap.js

    r192351 r192790  
    2727WebInspector.runBootstrapOperations = function() {
    2828    WebInspector.showDebugUISetting = new WebInspector.Setting("show-debug-ui", false);
     29
     30    // Toggle Debug UI setting.
    2931    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "D", () => {
    3032        WebInspector.showDebugUISetting.value = !WebInspector.showDebugUISetting.value;
     33    });
     34
     35    // Reload the Web Inspector.
     36    new WebInspector.KeyboardShortcut(WebInspector.KeyboardShortcut.Modifier.Option | WebInspector.KeyboardShortcut.Modifier.Shift | WebInspector.KeyboardShortcut.Modifier.CommandOrControl, "R", () => {
     37        window.location.reload();
    3138    });
    3239
Note: See TracChangeset for help on using the changeset viewer.