Skip to content
This repository has been archived by the owner on Dec 3, 2020. It is now read-only.

Fix #237, fix #242: Re-add toolbar icon reset workaround. #247

Merged
merged 1 commit into from
Nov 7, 2018

Conversation

Osmose
Copy link
Contributor

@Osmose Osmose commented Nov 5, 2018

No description provided.

@Osmose Osmose requested a review from biancadanforth November 5, 2018 20:50
Copy link
Collaborator

@biancadanforth biancadanforth left a comment

Choose a reason for hiding this comment

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

R+. Works with the acknowledged flickering on slow connections. It will be nice once the fix is available in the Release channel for Firefox 64. Thanks!

Edit: Question for you:
You mention in #237 :

Based on my testing, this appears to be caused by the same thing as #192/#242. New iframes are clearing the browser action icon once you view the page (notice the flickering badge), and since the pages were opened in new tabs and some time is passing before you switch to them, the 5- and 10-second workarounds for resetting the badge aren't taking effect.

Is the reason why the 5 and 10s resend wasn't working because Firefox doesn't fully finish loading the page until the tab is focused as a performance measure?

@@ -43,6 +43,10 @@ function extractProduct() {
}

async function sendProductToBackground(extractedProduct) {
if (!extractedProduct) {
return null;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are we returning null here? Is this from the eslint consistent-return rule to return a value, since we otherwise return a promise if we have an extracted product?

Copy link
Contributor Author

@Osmose Osmose Nov 7, 2018

Choose a reason for hiding this comment

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

It's an async function so a promise is always returned; if we don't call return, the promise just resolves with undefined. But yes, this is to appease the eslint rule.

}
},
{urls: ['https://*/*', 'http://*/*'], types: ['sub_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 recall you had originally had something like this before implementing the resend stuff -- why did you switch to resend originally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The issue is intermittent, and I suspect QA verified on a version that actually didn't have the fix (because I was slow to release it), then replicated the issue and re-filed. I'm not entirely sure how I was able to replicate it off of master, but at this point the fix is so consistent that I'm trying not to question it.

@Osmose Osmose merged commit 5589d8c into mozilla:master Nov 7, 2018
@Osmose Osmose deleted the toolbar-icon branch November 7, 2018 06:58
biancadanforth added a commit to biancadanforth/price-tracker that referenced this pull request Nov 14, 2018
Tacking this on, though it's an unrelated error.

Previously, we were attempting to send messages via `tabs.sendMessage` to all content scripts both the ones running in content processes and in the background. However, the tabId for a content script in the background is -1, which is not a valid value for sending messages to content scripts in specific tabs.

Since the code that introduced this error was intended to fix an issue related to badging the browserAction toolbar button to add a new product, and since that badging is only triggered by extraction in content processes, we don't need to worry about sending the message to the background.

Now, we now no longer see the error:
`Type error for parameter tabId (Integer -1 is too small (must be at least 0)) for tabs.sendMessage.`
biancadanforth added a commit to biancadanforth/price-tracker that referenced this pull request Nov 14, 2018
Tacking this on, though it's an unrelated error.

Previously, we were attempting to send messages via `tabs.sendMessage` to all content scripts both the ones running in content processes and in the background. However, the tabId for a content script in the background is -1, which is not a valid value for sending messages to content scripts in specific tabs.

Since the code that introduced this error was intended to fix an issue related to badging the browserAction toolbar button to add a new product, and since that badging is only triggered by extraction in content processes, we don't need to worry about sending the message to the background.

Now, we now no longer see the error:
`Type error for parameter tabId (Integer -1 is too small (must be at least 0)) for tabs.sendMessage.`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants