Bug 192210 - Web Inspector: Audit: allow audits to be enabled/disabled
Summary: Web Inspector: Audit: allow audits to be enabled/disabled
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: Devin Rousso
URL:
Keywords: InRadar
Depends on: WebInspectorAuditTab
Blocks: 192211
  Show dependency treegraph
 
Reported: 2018-11-29 19:41 PST by Devin Rousso
Modified: 2019-01-10 21:55 PST (History)
6 users (show)

See Also:


Attachments
Patch (43.61 KB, patch)
2018-11-29 21:12 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] After Patch is applied (788.42 KB, image/png)
2018-11-29 21:15 PST, Devin Rousso
no flags Details
Patch (47.18 KB, patch)
2019-01-10 20:35 PST, Devin Rousso
no flags Details | Formatted Diff | Diff
Patch (47.87 KB, patch)
2019-01-10 20:54 PST, Devin Rousso
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Devin Rousso 2018-11-29 19:41:17 PST
.
Comment 1 Devin Rousso 2018-11-29 21:12:07 PST
Created attachment 356125 [details]
Patch
Comment 2 Devin Rousso 2018-11-29 21:15:09 PST
Created attachment 356126 [details]
[Image] After Patch is applied
Comment 3 Radar WebKit Bug Importer 2018-12-03 10:41:35 PST
<rdar://problem/46423583>
Comment 4 Joseph Pecoraro 2019-01-10 15:34:20 PST
Comment on attachment 356125 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Base/ObjectStore.js:55
> +        if (Array.isArray(WI.ObjectStore._databaseCallbacks)) {

A simple if check be sufficient. Is there a benefit to the extra isArray() check?

Also this should be covered in the ChangeLog somewhere. Does this reduce duplicate IndexedDB open() calls?

> Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js:78
> +            WI.objectStores.audits.clear();
> +            for (let test of this._tests)
> +                WI.objectStores.audits.addObject(test);

This feels like it could be put into a well named method. Something like `_resaveAudits`?
Comment 5 Devin Rousso 2019-01-10 18:55:26 PST
Comment on attachment 356125 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Base/ObjectStore.js:55
>> +        if (Array.isArray(WI.ObjectStore._databaseCallbacks)) {
> 
> A simple if check be sufficient. Is there a benefit to the extra isArray() check?
> 
> Also this should be covered in the ChangeLog somewhere. Does this reduce duplicate IndexedDB open() calls?

Yes, this is meant to be a way of batching operations together, so that if you performed 3 actions in a row, they'd all be called on the same `open()` call.

    WI.objectStores.foo.a(); // initializes `WI.ObjectStore._databaseCallbacks`
    WI.objectStores.foo.b(); // enqueued
    WI.objectStores.foo.c(); // enqueued
    // once the "open" event fires, all three calls will happen, rather than having each have a separate open, which may resolve in different orders.

>> Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js:78
>> +                WI.objectStores.audits.addObject(test);
> 
> This feels like it could be put into a well named method. Something like `_resaveAudits`?

Sure.  I'll have to modify this slightly anyways since we are no longer saving default audits.
Comment 6 Devin Rousso 2019-01-10 20:35:47 PST
Created attachment 358868 [details]
Patch

Merged <https://webkit.org/b/192211> into this change, as there were issues with reloading audit test groups from the IndexedDB due to the fact that the `disabled` value wasn't propagated to the sub-tests, meaning that they would always appear as not disabled (since the children wouldn't be disabled) even though the actual model object would be disabled.
Comment 7 Joseph Pecoraro 2019-01-10 20:47:22 PST
Comment on attachment 358868 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js:81
> +            let saveDisabled = (test) => {

Might be better to have a more searchable name: saveDisabledDefaultTest.

> Source/WebInspectorUI/UserInterface/Controllers/AuditManager.js:303
> +        let checkDisabled = (test) => {

Might be better to have a more searchable name: checkDisabledDefaultTest.
Comment 8 Devin Rousso 2019-01-10 20:54:22 PST
Created attachment 358871 [details]
Patch
Comment 9 WebKit Commit Bot 2019-01-10 21:55:01 PST
Comment on attachment 358871 [details]
Patch

Clearing flags on attachment: 358871

Committed r239858: <https://trac.webkit.org/changeset/239858>
Comment 10 WebKit Commit Bot 2019-01-10 21:55:03 PST
All reviewed patches have been landed.  Closing bug.