Bug 185187 - Web Inspector: simplify the WI.Collection interface
Summary: Web Inspector: simplify the WI.Collection interface
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:
Blocks:
 
Reported: 2018-05-01 22:32 PDT by Devin Rousso
Modified: 2018-05-04 16:57 PDT (History)
6 users (show)

See Also:


Attachments
Patch (51.98 KB, patch)
2018-05-01 22:36 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.21 MB, application/zip)
2018-05-01 23:28 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews102 for mac-sierra (2.25 MB, application/zip)
2018-05-01 23:39 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews114 for mac-sierra (3.13 MB, application/zip)
2018-05-02 01:00 PDT, Build Bot
no flags Details
Patch (54.29 KB, patch)
2018-05-02 01:29 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews104 for mac-sierra-wk2 (2.71 MB, application/zip)
2018-05-02 02:38 PDT, Build Bot
no flags Details
Patch (57.43 KB, patch)
2018-05-04 11:40 PDT, 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-05-01 22:32:55 PDT
Instead of using `toArray`, we should make use of `Symbol.iterator` and other such things for a cleaner API.
Comment 1 Devin Rousso 2018-05-01 22:36:18 PDT
Created attachment 339280 [details]
Patch
Comment 2 Build Bot 2018-05-01 23:28:15 PDT Comment hidden (obsolete)
Comment 3 Build Bot 2018-05-01 23:28:16 PDT Comment hidden (obsolete)
Comment 4 Build Bot 2018-05-01 23:39:52 PDT Comment hidden (obsolete)
Comment 5 Build Bot 2018-05-01 23:39:54 PDT Comment hidden (obsolete)
Comment 6 Build Bot 2018-05-02 01:00:41 PDT Comment hidden (obsolete)
Comment 7 Build Bot 2018-05-02 01:00:42 PDT Comment hidden (obsolete)
Comment 8 Devin Rousso 2018-05-02 01:29:17 PDT
Created attachment 339290 [details]
Patch
Comment 9 Build Bot 2018-05-02 02:38:34 PDT Comment hidden (obsolete)
Comment 10 Build Bot 2018-05-02 02:38:35 PDT Comment hidden (obsolete)
Comment 11 Brian Burg 2018-05-03 09:36:40 PDT
Comment on attachment 339290 [details]
Patch

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

r=me, nice cleanup

> Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js:289
> +            for (let resource of currentFrame.resourceCollection)

Maybe a dumb question, but why isn't the main resource in the resource collection?

> LayoutTests/http/tests/inspector/network/har/har-page.html:77
> +            for (let resource of WI.frameResourceManager.mainFrame.resourceCollection)

You should just push with destructuring, the loop isn't needed here. And somehow this test is failing on EWS?
Comment 12 Devin Rousso 2018-05-03 16:23:20 PDT
Comment on attachment 339290 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js:289
>> +            for (let resource of currentFrame.resourceCollection)
> 
> Maybe a dumb question, but why isn't the main resource in the resource collection?

I'm not sure actually 😅.  I will check to see if the `mainResource` is part of the `resourceCollection.`  If I had to guess as to why not (if that's the case), I think it might be that `resourceCollection` holds all the resources associated with the `mainResource` (e.g. CSS and JS files loaded by the main HTML).

>> LayoutTests/http/tests/inspector/network/har/har-page.html:77
>> +            for (let resource of WI.frameResourceManager.mainFrame.resourceCollection)
> 
> You should just push with destructuring, the loop isn't needed here. And somehow this test is failing on EWS?

Ah I missed this one.  Not really sure why the test is failing 🤔.  The diff suggest that the size of the resulting HAR is different, so maybe my changes affected that?
Comment 13 Brian Burg 2018-05-03 16:51:31 PDT
(In reply to Devin Rousso from comment #12)
> Comment on attachment 339290 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=339290&action=review
> 
> >> Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js:289
> >> +            for (let resource of currentFrame.resourceCollection)
> > 
> > Maybe a dumb question, but why isn't the main resource in the resource collection?
> 
> I'm not sure actually 😅.  I will check to see if the `mainResource` is part
> of the `resourceCollection.`  If I had to guess as to why not (if that's the
> case), I think it might be that `resourceCollection` holds all the resources
> associated with the `mainResource` (e.g. CSS and JS files loaded by the main
> HTML).
> 
> >> LayoutTests/http/tests/inspector/network/har/har-page.html:77
> >> +            for (let resource of WI.frameResourceManager.mainFrame.resourceCollection)
> > 
> > You should just push with destructuring, the loop isn't needed here. And somehow this test is failing on EWS?
> 
> Ah I missed this one.  Not really sure why the test is failing 🤔.  The diff
> suggest that the size of the resulting HAR is different, so maybe my changes
> affected that?

Ah yeah, that is dumb. We should be filtering that out, but feel free to take the easy way out this time.
Comment 14 Devin Rousso 2018-05-04 11:40:39 PDT
Created attachment 339575 [details]
Patch
Comment 15 WebKit Commit Bot 2018-05-04 16:56:16 PDT
Comment on attachment 339575 [details]
Patch

Clearing flags on attachment: 339575

Committed r231391: <https://trac.webkit.org/changeset/231391>
Comment 16 WebKit Commit Bot 2018-05-04 16:56:17 PDT
All reviewed patches have been landed.  Closing bug.
Comment 17 Radar WebKit Bug Importer 2018-05-04 16:57:34 PDT
<rdar://problem/39994475>