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

feat: introduce the use of reference to the helper libs #2

Merged
merged 3 commits into from
May 28, 2024

Conversation

seia-soto
Copy link
Owner

@seia-soto seia-soto self-assigned this May 27, 2024
tabId: sender.tab?.id,
frameId: sender.frameId,

senderDetails: sender,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Cannot see why I would need that, maybe we can keep it simple for now?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Sure, only tabId and frameId are now left.


reference: {
event,
message: msg,
Copy link
Collaborator

Choose a reason for hiding this comment

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

looks like message.ids, hrefs and classes are already passed as arguments to getCosmeticsFilters - so no need to pass it again

Copy link
Owner Author

Choose a reason for hiding this comment

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

Just added a lifecycle variable from the msg object, and replaced event to frameId and processId.

@@ -186,6 +186,10 @@ export class ElectronBlocker extends FiltersEngine {
getExtendedRules: true,
getRulesFromHostname: true,
getRulesFromDOM: false, // Only done on updates (see `onGetCosmeticFiltersUpdated`)

reference: {
event,
Copy link
Collaborator

Choose a reason for hiding this comment

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

from what I can see the only sensible reference we can pass is the url
Please don't pass the whole event - it looks like a very complicated object, may cause problems.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Replaced the event to frameId and processId.

@@ -179,6 +179,10 @@ export class PlaywrightBlocker extends FiltersEngine {

// Will handle DOM features (see below).
getRulesFromDOM: false,

reference: {
frame,
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would only pass url here

Copy link
Owner Author

Choose a reason for hiding this comment

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

I think the url is already passed (also, it's extracted from the frame). Removed.

tabId: details.tabId,
frameId: details.frameId,

navigationDetails: details,
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sure how to use it, lets remove for now

Copy link
Owner Author

Choose a reason for hiding this comment

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

I also don't see how to use it. Removed navigationDetails.

@@ -226,6 +226,10 @@ export class PuppeteerBlocker extends FiltersEngine {

// Allows to get styles for updated DOM.
getRulesFromDOM: true,

reference: {
frame,
Copy link
Collaborator

Choose a reason for hiding this comment

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

does frame have an .id? would prefer to pass it instead of full object. again, we don't want to retain reference to it as it may cause memory leaks

Copy link
Owner Author

Choose a reason for hiding this comment

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

No, I don't think so. I just dropped this part.

@seia-soto seia-soto changed the title feat: introduce the use of reference to the help libs feat: introduce the use of reference to the helper libs May 28, 2024
@seia-soto seia-soto merged commit 3a45e66 into emit-cosmetic-filter-matches May 28, 2024
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.

2 participants