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

Hide "Trust Token" item from devtools #17118

Merged
merged 5 commits into from
Mar 30, 2023
Merged

Hide "Trust Token" item from devtools #17118

merged 5 commits into from
Mar 30, 2023

Conversation

sangwoo108
Copy link
Contributor

@sangwoo108 sangwoo108 commented Feb 9, 2023

We disabled the "Trust token" feature, so we shouldn't reveal this item.

Without this patch

Screenshot 2023-02-09 at 11 18 08 AM

With patch

image

Resolves brave/brave-browser#28394

Submitter Checklist:

  • I confirm that no security/privacy review is needed, or that I have requested one
  • There is a ticket for my issue
  • Used Github auto-closing keywords in the PR description above
  • Wrote a good PR/commit description
  • Squashed any review feedback or "fixup" commits before merge, so that history is a record of what happened in the repo, not your PR
  • Added appropriate labels (QA/Yes or QA/No; release-notes/include or release-notes/exclude; OS/...) to the associated issue
  • Checked the PR locally:
    • npm run test -- brave_browser_tests, npm run test -- brave_unit_tests wiki
    • npm run lint, npm run presubmit wiki, npm run gn_check, npm run tslint
  • Ran git rebase master (if needed)

Reviewer Checklist:

  • A security review is not needed, or a link to one is included in the PR description
  • New files have MPL-2.0 license header
  • Adequate test coverage exists to prevent regressions
  • Major classes, functions and non-trivial code blocks are well-commented
  • Changes in component dependencies are properly reflected in gn
  • Code follows the style guide
  • Test plan is specified in PR before merging

After-merge Checklist:

Test Plan:

Manual

  • Open dev tools > "Application" tab
  • "Trust token" item shouldn't be in sidebar

@sangwoo108 sangwoo108 requested a review from petemill February 9, 2023 02:13
@sangwoo108 sangwoo108 requested review from a team and bridiver as code owners February 9, 2023 02:13
@sangwoo108 sangwoo108 requested a review from pes10k February 9, 2023 02:19

this.trustTokensTreeElement = new TrustTokensTreeElement(panel);
- storageTreeElement.appendChild(this.trustTokensTreeElement);
+ //storageTreeElement.appendChild(this.trustTokensTreeElement);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@petemill Do you think calling storageTreeElement.removeChild(this.trustTokensTreeElement); would be better than this?

Copy link
Member

Choose a reason for hiding this comment

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

I can't think why adding and removing is better than just not adding it in the first place. Let me know if you have thought of a reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, NVM then. I thought I've seen something like that in settings page. That's why I asked 😄

Copy link
Collaborator

Choose a reason for hiding this comment

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

@petemill can we avoid patching here by overriding TrustTokensTreeElement and just making it an empty div or something?

Copy link
Member

Choose a reason for hiding this comment

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

There is no mechanism to override TrustTokensTreeElement or any piece of TS/JS here without a patch. A more complex one I imagine.

Copy link
Collaborator

Choose a reason for hiding this comment

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

@sangwoo108 please change this comment to be a single line added above this.trustTokensTreeElement = new TrustTokensTreeElement(panel); with /* and a single line added below storageTreeElement.appendChild(this.trustTokensTreeElement);
We don't want to create TrustTokensTreeElement if we're not going to use it and adding lines is better than modifying them for patches

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! done.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

[2023-03-29T00:54:07.410Z] ../../third_party/devtools-frontend/src/front_end/panels/application/ApplicationPanelSidebar.ts(253,3): error TS2564: Property 'trustTokensTreeElement' has no initializer and is not definitely assigned in the constructor.

Because of this error, added one more line to the patch file.

Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

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

Thanks. As discussed, not only does devtools' frontend not use Polymer (or any UI framework?), but it doesn't have the same GN build system, so our existing override methodology is just not going to work. Patching is far far easier, especially since this is only 1 line.

const allPatchStatus =
chromiumPatchStatus.concat(v8PatchStatus).concat(catapultPatchStatus)
chromiumPatchStatus.concat(v8PatchStatus).concat(catapultPatchStatus).concat(devtoolsFrontendPatchStatus)
Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's time to change this to

const allPatchStatus = [
  ...v8PatchStatus,
  ...catapultPatchStatus,
  ...devtoolsFrontendPatchStatus
]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool! Done and added ChromiumPatcheStatus too.

As we're not going to use it, we should add this type.
databasesListTreeElement: ExpandableApplicationPanelTreeElement;
cookieListTreeElement: ExpandableApplicationPanelTreeElement;
- trustTokensTreeElement: TrustTokensTreeElement;
+ trustTokensTreeElement: TrustTokensTreeElement|undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

oh, was this required because we commented out https://github.com/brave/brave-core/pull/17118/files#diff-23046df64bccd12252ff893d49474e6af4b2831de5d33efd50f3a8c4fc8c11c1R19 ? If so then go back to the original patch because we still end up with a modified line this way

Copy link
Contributor Author

@sangwoo108 sangwoo108 Mar 30, 2023

Choose a reason for hiding this comment

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

Sorry, the link seems to be broken(Github are bad at these 😭) . This line was required because we commented out the initialization of this property, which seems to be what you linked. Reverted back to the very original patch - commenting out appendChild()

@sangwoo108 sangwoo108 merged commit 2dadf10 into master Mar 30, 2023
@sangwoo108 sangwoo108 deleted the sko/dev-tools branch March 30, 2023 22:54
@github-actions github-actions bot added this to the 1.52.x - Nightly milestone Mar 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hide "trust token" from devtools
3 participants