Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(script-treemap-data): create node for each inline script #13802

Merged
merged 7 commits into from
Mar 31, 2022

Conversation

connorjclark
Copy link
Collaborator

This will also group the inline scripts by frame, although at the moment we do not collect scripts for anything other than the main frame.

before
image

after
image

@connorjclark connorjclark requested a review from a team as a code owner March 31, 2022 18:15
@connorjclark connorjclark requested review from adamraine and removed request for a team March 31, 2022 18:15
htmlNode.resourceBytes += node.resourceBytes;
if (node.unusedBytes) htmlNode.unusedBytes = (htmlNode.unusedBytes || 0) + node.unusedBytes;
node.name = script.content ?
'(inline) ' + script.content.trimStart().substring(0, 15) + '…' :
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we are applying the "(inline)" here, could we remove this code in the treemap viewer:

if (url.href === this.documentUrl.href) {
node.name += ' (inline)';
}

It would allow us to remove the document url dependency from the treemap viewer.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines act on different nodes - the line in main.js appends (inline) to the depth-1 node that has a name which matches the document url, but here it's that node's children's names.

It would allow us to remove the document url dependency from the treemap viewer.

What about all the other usages of url? or do you mean changing to finalUrl as opposed to requestedUrl like the PR you closed did?

Copy link
Member

@adamraine adamraine Mar 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines act on different nodes - the line in main.js appends (inline) to the depth-1 node that has a name which matches the document url, but here it's that node's children's names.

But is it still necessary now that all the children have (inline) attached? If we are going to keep it, it would be better to add an isInline flag to the node than do a URL check in the viewer.

What about all the other usages of url? or do you mean changing to finalUrl as opposed to requestedUrl like the PR you closed did?

Yeah sorry, we could change to finalUrl without worrying because all other usages of the url are cosmetic or just looking at the origin. This part doesn't need to be done here, I can tackle it as part of #13706

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing it to use finalUrl should be fine. I think the UI here can be confusing if / is showed instead of / (inline) (we elide the origin to make the names shorter, so the final/requestedUrl changes to just /), so I don't want to remove it. And adding a flag "isInline" is something I'd like to avoid if we can.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, if we did these changes it'd be better in a separate PR, can you review this PR independent of these proposed changes?

"serve-dist": "cd dist && python -m SimpleHTTPServer",
"serve-gh-pages": "cd dist/gh-pages && python -m SimpleHTTPServer",
"serve-dist": "cd dist && python3 -m http.server",
"serve-gh-pages": "cd dist/gh-pages && python3 -m http.server",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3 is king now

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

God save the king

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants