Bug 181912 - Uncaught Exception: TypeError: this._textEditor.toggleUnexecutedCodeHighlights().then is not a function
Summary: Uncaught Exception: TypeError: this._textEditor.toggleUnexecutedCodeHighlight...
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
Keywords: InRadar
Depends on:
Blocks: 183887
  Show dependency treegraph
Reported: 2018-01-20 17:41 PST by Nikita Vasilyev
Modified: 2018-03-22 18:00 PDT (History)
4 users (show)

See Also:

Patch (2.23 KB, patch)
2018-03-21 19:47 PDT, Nikita Vasilyev
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2018-01-20 17:41:57 PST
Inspected URL:        file:///tmp/slow-console.html
Loading completed:    true
Frontend User Agent:  Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_3) AppleWebKit/605.1.16+ (KHTML, like Gecko)

Uncaught Exceptions:
 - TypeError: this._textEditor.toggleUnexecutedCodeHighlights().then is not a function. (In 'this._textEditor.toggleUnexecutedCodeHighlights().then(() => {
            this._codeCoverageButtonNavigationItem.enabled = true;
        })', 'this._textEditor.toggleUnexecutedCodeHighlights().then' is undefined) (at TextResourceContentView.js:238:63)
    _toggleUnexecutedCodeHighlights @ TextResourceContentView.js:238:63
    dispatch @ Object.js:170:30
    dispatchEventToListeners @ Object.js:177:17
    _mouseClicked @ ButtonNavigationItem.js:138:38
    _mouseClicked @ [native code]

1. Save http://nv.github.io/webkit-inspector-bugs/slow-console/ locally so its JS can be edited in Web Inspector.
2. Open the saved HTML page using the file scheme.
3. Edit index.js (e.g. add a comment)
4. Press on the [c] icon to enable code coverage profiler.

It's fine if [c] gets grayed out after editing a script so it can't be enabled.
Comment 1 Radar WebKit Bug Importer 2018-01-20 17:42:15 PST
Comment 2 Nikita Vasilyev 2018-03-21 18:48:50 PDT
This is poorly architectured (likely by me 3 years ago).

The [c] icon can only have 3 states:
- gray: disabled, can't be activated.
- black: not activated.
- blue: activated.

The icon updates on setting change. The setting can only have two states:
- enabled.
- disabled.

The setting change is used to update the icon state. Which is wrong, it doesn't even have all 3 states.

The setting should only indicate user preference: enabled (when possible) and disabled.

Instead, the setting is user as a communication channel to set the icon to deactivated state. Currently, the setting gets set to disabled when:
- Enabling pretty-print.
- Editing a script.

Pretty-printing and editing shouldn't change the setting, yet these actions should set the icon to disabled state.
Comment 3 Nikita Vasilyev 2018-03-21 18:59:32 PDT
(In reply to Nikita Vasilyev from comment #2)
> The icon updates on setting change. The setting can only have two states:
> - enabled.
> - disabled.

To clarify, by the setting I mean WI.enableControlFlowProfilerSetting object.
It's not related to the settings GUI.
Comment 4 Nikita Vasilyev 2018-03-21 19:47:57 PDT
Created attachment 336257 [details]
Comment 5 Matt Baker 2018-03-22 17:35:28 PDT
Comment on attachment 336257 [details]

Comment 6 WebKit Commit Bot 2018-03-22 18:00:48 PDT
Comment on attachment 336257 [details]

Clearing flags on attachment: 336257

Committed r229874: <https://trac.webkit.org/changeset/229874>
Comment 7 WebKit Commit Bot 2018-03-22 18:00:50 PDT
All reviewed patches have been landed.  Closing bug.