Bug 193147 - Web Inspector: Include `globalThis` in default JavaScript completions
Summary: Web Inspector: Include `globalThis` in default JavaScript completions
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-01-04 11:00 PST by Joseph Pecoraro
Modified: 2019-01-04 12:30 PST (History)
7 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (1.67 KB, patch)
2019-01-04 11:00 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2019-01-04 11:00:01 PST
Include `globalThis` in default JavaScript completions
Comment 1 Joseph Pecoraro 2019-01-04 11:00:44 PST
Created attachment 358336 [details]
[PATCH] Proposed Fix
Comment 2 Devin Rousso 2019-01-04 11:49:59 PST
Comment on attachment 358336 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=358336&action=review

r=me

Is `globalThis` something we'd also want to always show in the Scope chain when paused?

> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:661
>              "return", "static", "super", "switch", "this", "throw", "true", "try",

Should we be including `"globalThis"` in `allKeywords` as well?

Ditto (727) (I can't comment on it because it's outside of this diff's range)

> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:664
> +        var valueKeywords = ["false", "Infinity", "NaN", "null", "this", "true", "undefined", "globalThis"];

`"globalThis"` should be placed before `"Infinity"` if we want to keep it alphabetized.

NIT: considering how small this patch is, I wouldn't be against a bit of refactoring (e.g. `.keySet()` to `new Set()`)
Comment 3 Joseph Pecoraro 2019-01-04 12:04:04 PST
Comment on attachment 358336 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=358336&action=review

>> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:661
>>              "return", "static", "super", "switch", "this", "throw", "true", "try",
> 
> Should we be including `"globalThis"` in `allKeywords` as well?
> 
> Ditto (727) (I can't comment on it because it's outside of this diff's range)

`globalThis` is not a keyword.

>> Source/WebInspectorUI/UserInterface/Controllers/CodeMirrorCompletionController.js:664
>> +        var valueKeywords = ["false", "Infinity", "NaN", "null", "this", "true", "undefined", "globalThis"];
> 
> `"globalThis"` should be placed before `"Infinity"` if we want to keep it alphabetized.
> 
> NIT: considering how small this patch is, I wouldn't be against a bit of refactoring (e.g. `.keySet()` to `new Set()`)

Good idea but I'll keep the code as is for now to avoid breaking something inadvertently.
Comment 4 WebKit Commit Bot 2019-01-04 12:29:34 PST
Comment on attachment 358336 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 358336

Committed r239630: <https://trac.webkit.org/changeset/239630>
Comment 5 WebKit Commit Bot 2019-01-04 12:29:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 6 Radar WebKit Bug Importer 2019-01-04 12:30:36 PST
<rdar://problem/47054614>