Branch: refs/heads/webkitglib/2.44
  Home:   https://github.com/WebKit/WebKit
  Commit: 3723301b852126140c3d1b615714bc23bb434e4a
      
https://github.com/WebKit/WebKit/commit/3723301b852126140c3d1b615714bc23bb434e4a
  Author: Qianlang Chen <[email protected]>
  Date:   2024-04-23 (Tue, 23 Apr 2024)

  Changed paths:
    A LayoutTests/inspector/console/js-completions-expected.txt
    A LayoutTests/inspector/console/js-completions.html
    M Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js
    M 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
    M 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js
    M Source/WebInspectorUI/UserInterface/Test.html

  Log Message:
  -----------
  Cherry-pick 277261@main (5c6736f3f9ad). 
https://bugs.webkit.org/show_bug.cgi?id=271265

    Web Inspector: Console code completion doesn't suggest variables unless 
inspector is re-opened
    rdar://125035133
    https://bugs.webkit.org/show_bug.cgi?id=271265

    Reviewed by Devin Rousso.

    In the current JavaScriptRuntimeCompletionProvider, there's work done
    to cache the list of property names present in the runtime. This
    property name cache is cleared / forced to be re-fetched either when 30
    seconds have passed or when the code typed starts accessing a different
    object's properties (the object to the left of a dot operator). However,
    when variables are created by executing a command, the cache is not
    updated, resulting in those new variables missing from the suggestions.

    This commit simply makes it so that executing a command from the console
    also forces clearing the cache, so that new variables, in case created,
    are immediately collected as suggestions when typing a new command. The
    cache is also cleared when the console clears, so when the page is
    reloaded with the console opened, the variable completion still gets
    properly reset.

    * 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js:
    (WI.JavaScriptRuntimeCompletionProvider):
    
(WI.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded):
       - Update the comment on the need of loading the list of property
         names from cache to reflect now there can be additional
         opportunities that the cache should be cleared.
       - Remove the `// Protected` section comment as this function is
         accessed by others.

    (WI.JavaScriptRuntimeCompletionProvider):
    (WI.JavaScriptRuntimeCompletionProvider.prototype.clearCachedPropertyNames):
    (WI.JavaScriptRuntimeCompletionProvider.prototype._clearLastProperties): 
Deleted
       - Expose the logic of clearing the property name cache so that the
         completion provider's users can also force a reload of property
         names.

    
(WI.JavaScriptRuntimeCompletionProvider.prototype.completionControllerCompletionsNeeded.updateLastPropertyNames):
       - Adapt to the cache-clearing logic being exposed to public.

    * 
Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js:
    (WI.JavaScriptLogViewController.prototype.consolePromptTextCommitted):
       - Clear cached property names whenever a new command is executed in
         the console, since new commands are what can possibly introduce
         changes to existing variables (additions from `x = ...` or `let x`,
         and deletions from `delete x`).

    * Source/WebInspectorUI/UserInterface/Controllers/ConsoleManager.js:
    (WI.ConsoleManager.prototype.messagesCleared):
       - Clear cached property names when the console is cleared because the
         page might've been reloaded and therefore variables were reset
         as a result.

    * Source/WebInspectorUI/UserInterface/Test.html:
    * LayoutTests/inspector/console/js-completions.html: Added.
    * LayoutTests/inspector/console/js-completions-expected.txt: Added.
       - Add a simple test to demonstrate how `clearCachedPropertyNames`
         is used.

    Canonical link: https://commits.webkit.org/277261@main

Canonical link: https://commits.webkit.org/274313.156@webkitglib/2.44



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to