Bug 183887 - Web Inspector: Code Coverage and Type Profiler icons should gray out after editing a script
Summary: Web Inspector: Code Coverage and Type Profiler icons should gray out after ed...
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on: 181912
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-21 19:45 PDT by Nikita Vasilyev
Modified: 2018-03-21 20:07 PDT (History)
2 users (show)

See Also:


Attachments
WIP (4.74 KB, text/plain)
2018-03-21 20:07 PDT, Nikita Vasilyev
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2018-03-21 19:45:31 PDT
* STEPS TO REPRODUCE
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.

EXPECTED:
It's fine if [c] gets grayed out after editing a script so it can't be enabled.

NOTES:
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 WI.enableControlFlowProfilerSetting change. The setting can have only 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 1 Radar WebKit Bug Importer 2018-03-21 19:45:47 PDT
<rdar://problem/38734809>
Comment 2 Nikita Vasilyev 2018-03-21 20:07:09 PDT
Created attachment 336258 [details]
WIP

This WIP patch grays out [C] and [T] icons after editing.

This WIP patch doesn't handle Command-Z.

STEPS:
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 Command-Z to undo all your changes.
5. Press on the [c] icon to enable code coverage profiler.

Expected:
Code coverage profiler enables.

Actual:
Code coverage doesn't enable.