Bug 191044

Summary: Web Inspector: Audit: attempt to re-link DOM nodes for imported results
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Devin Rousso <hi>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, hi, inspector-bugzilla-changes, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: All   
OS: All   
Bug Depends on: 190754    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Devin Rousso 2018-10-29 15:10:57 PDT
Instead of showing a verbose CSS selector for nodes in imported results, we should attempt to see if they exist on the page (assuming that the metadata url either matches the current page or was not supplied).
Comment 1 Radar WebKit Bug Importer 2018-10-30 17:55:52 PDT
<rdar://problem/45687364>
Comment 2 Devin Rousso 2018-10-30 18:50:34 PDT
Created attachment 353454 [details]
Patch
Comment 3 BJ Burg 2018-10-31 09:23:36 PDT
Comment on attachment 353454 [details]
Patch

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

r=me. Please rebase and run through EWS before landing.

> Source/WebInspectorUI/UserInterface/Models/AuditTestCaseResult.js:79
> +        if (window.DOMAgent && Array.isArray(data.domNodes)) {

I don't think we should be showing audits tab if DOMAgent is unavailable (i.e. JSContext inspection). So this check seems unnecessary.

> Source/WebInspectorUI/UserInterface/Models/AuditTestCaseResult.js:87
> +            }));

Very nice.

> Source/WebInspectorUI/UserInterface/Models/AuditTestGroup.js:60
> +        tests = await Promise.all(tests.map(async (test) => await WI.AuditTestCase.fromPayload(test) || await WI.AuditTestGroup.fromPayload(test)));

Could you add some newlines here? It's difficult to follow.

> Source/WebInspectorUI/UserInterface/Models/AuditTestGroupResult.js:55
> +        results = await Promise.all(results.map(async (test) => await WI.AuditTestCaseResult.fromPayload(test) || await WI.AuditTestGroupResult.fromPayload(test)));

Could you add some newlines here? It's difficult to follow.
Comment 4 Devin Rousso 2018-10-31 10:31:10 PDT
Comment on attachment 353454 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Models/AuditTestCaseResult.js:79
>> +        if (window.DOMAgent && Array.isArray(data.domNodes)) {
> 
> I don't think we should be showing audits tab if DOMAgent is unavailable (i.e. JSContext inspection). So this check seems unnecessary.

I disagree.  Right now there's no reason why a developer couldn't write a JS-only audit (e.g. a perf test).  I don't want to limit this entire feature to contexts with DOM, since it's not really focusing on that exclusively.
Comment 5 BJ Burg 2018-10-31 10:47:47 PDT
Comment on attachment 353454 [details]
Patch

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

>>> Source/WebInspectorUI/UserInterface/Models/AuditTestCaseResult.js:79
>>> +        if (window.DOMAgent && Array.isArray(data.domNodes)) {
>> 
>> I don't think we should be showing audits tab if DOMAgent is unavailable (i.e. JSContext inspection). So this check seems unnecessary.
> 
> I disagree.  Right now there's no reason why a developer couldn't write a JS-only audit (e.g. a perf test).  I don't want to limit this entire feature to contexts with DOM, since it's not really focusing on that exclusively.

OK
Comment 6 Devin Rousso 2018-10-31 11:10:26 PDT
Created attachment 353509 [details]
Patch
Comment 7 Devin Rousso 2018-10-31 12:01:10 PDT
Created attachment 353516 [details]
Patch

Fix test failures
Comment 8 Devin Rousso 2018-10-31 12:57:52 PDT
Created attachment 353522 [details]
Patch

Rebase
Comment 9 Devin Rousso 2018-10-31 13:47:56 PDT
Created attachment 353525 [details]
Patch
Comment 10 WebKit Commit Bot 2018-10-31 15:00:43 PDT
Comment on attachment 353525 [details]
Patch

Clearing flags on attachment: 353525

Committed r237656: <https://trac.webkit.org/changeset/237656>
Comment 11 WebKit Commit Bot 2018-10-31 15:00:44 PDT
All reviewed patches have been landed.  Closing bug.