Bug 190275 - Web Inspector: use iframe's name attribute for FrameTreeElement
Summary: Web Inspector: use iframe's name attribute for FrameTreeElement
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-10-03 22:00 PDT by Devin Rousso
Modified: 2018-10-05 14:12 PDT (History)
4 users (show)

See Also:


Attachments
Patch (3.19 KB, patch)
2018-10-03 22:02 PDT, Devin Rousso
no flags Details | Formatted Diff | Diff
[Image] After Patch is applied (236.11 KB, image/png)
2018-10-04 23:18 PDT, Devin Rousso
no flags Details
Patch (4.31 KB, patch)
2018-10-05 13:34 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-10-03 22:00:26 PDT
Some iframe use the `srcdoc` attribute to set their content instead of a URL.  As a result, the main resource has no "real" URL, meaning we are unable to show anything meaningful.  For those cases (and those that have a `name` regardless), we should show the `name` somewhere in the `FrameTreeElement`s text.
Comment 1 Devin Rousso 2018-10-03 22:02:44 PDT
Created attachment 351582 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2018-10-03 22:03:30 PDT
<rdar://problem/44998609>
Comment 3 Joseph Pecoraro 2018-10-04 11:40:03 PDT
Comment on attachment 351582 [details]
Patch

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

I like the idea of this. Seems we could have a test for this. Do you have a screenshot of a before/after with this as well?

> Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js:203
> +        // We can't assume that `this._frame` exists since this may be called before that is set.
> +        if (this.resource.parentFrame.name)

Is this.resource.parentFrame guaranteed to not be null?
Comment 4 Devin Rousso 2018-10-04 23:15:56 PDT
Comment on attachment 351582 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/FrameTreeElement.js:203
>> +        if (this.resource.parentFrame.name)
> 
> Is this.resource.parentFrame guaranteed to not be null?

It should always be valid.  `WI.Frame.prototype.initialize` sets the `_parentFrame`, and `this.resource` is equal to the `WI.Frame.prototype.mainResource`.  Additionally, every resource that get's added to a frame has it's `_parentFrame` set as well.
Comment 5 Devin Rousso 2018-10-04 23:18:01 PDT
Created attachment 351658 [details]
[Image] After Patch is applied

Any `WI.TreeElement` that follows a "%s (%s)" pattern is affected by this patch, where the first "%s" is the `name` of the `WI.Frame` and the second is the previously shown `url`.
Comment 6 Joseph Pecoraro 2018-10-05 12:14:55 PDT
Comment on attachment 351582 [details]
Patch

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

r=me

> Source/WebInspectorUI/UserInterface/Views/ResourceTreeElement.js:136
> +    get _mainTitleText()

I think the underscore is unnecessary. I think of underscore'd things as properties, not as getters, so this messes with my brain a bit.
Comment 7 Joseph Pecoraro 2018-10-05 12:15:21 PDT
You may want to move the Execution Context Picker in the Quick Console to this kind of formatting so we are consistent.
Comment 8 Devin Rousso 2018-10-05 13:34:55 PDT
Created attachment 351696 [details]
Patch
Comment 9 WebKit Commit Bot 2018-10-05 14:12:56 PDT
Comment on attachment 351696 [details]
Patch

Clearing flags on attachment: 351696

Committed r236885: <https://trac.webkit.org/changeset/236885>
Comment 10 WebKit Commit Bot 2018-10-05 14:12:57 PDT
All reviewed patches have been landed.  Closing bug.