Closed Bug 1392322 Opened 7 years ago Closed 7 years ago

Fix browserAction.setTitle for currently active tab on Android

Categories

(WebExtensions :: Android, defect, P1)

defect

Tracking

(firefox56 verified, firefox57 verified)

VERIFIED FIXED
mozilla57
Tracking Status
firefox56 --- verified
firefox57 --- verified

People

(Reporter: rpl, Assigned: rpl)

References

Details

Attachments

(3 files)

While completing to verify the browserAction.setTitle/getTitle, the QA noticed that the browserAction custom title for a single tab (when browserAction.setTitle has been called with a tabId option) is not updated when it is the currently active tab, until the user switch between tab.

I digged into it and the reason for the issue is that the Android browserAction implementation is checking if the tab is active using the wrong property here:

- https://dxr.mozilla.org/mozilla-central/rev/7dddbd85047c6dc73ddbe1e423cd643a217845b3/mobile/android/components/extensions/ext-browserAction.js#87

Because the `tab` parameter is an instance of the Android native tab object defined here:

- https://dxr.mozilla.org/mozilla-central/rev/7dddbd85047c6dc73ddbe1e423cd643a217845b3/mobile/android/chrome/content/browser.js#3494

and the right way to check if it is the currently selected tab is `tab.getActive()` and not `tab.selected`, which is a property of the WE tab wrapper defined here: 

- https://dxr.mozilla.org/mozilla-central/rev/7dddbd85047c6dc73ddbe1e423cd643a217845b3/mobile/android/components/extensions/ext-utils.js#412-414
Assignee: nobody → lgreco
Blocks: 1330159
Status: NEW → ASSIGNED
Priority: -- → P1
Attachment #8899541 - Flags: review?(mixedpuppy)
Comment on attachment 8899541 [details]
Bug 1392322 - Fix browserAction.setTitle for currently active tab on Android.

https://reviewboard.mozilla.org/r/170832/#review176086
Attachment #8899541 - Flags: review?(mixedpuppy) → review+
Pushed by luca.greco@alcacoop.it:
https://hg.mozilla.org/integration/autoland/rev/530b7300609f
Fix browserAction.setTitle for currently active tab on Android. r=mixedpuppy
https://hg.mozilla.org/mozilla-central/rev/530b7300609f
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
Attached image browserActionTitle.gif
This issue is verified as fixed on Fennec 57.0a1 (2017-08-23) under Android 6.0.1. 

The browserAction custom title is updated in the current active tab.
Status: RESOLVED → VERIFIED
Comment on attachment 8899541 [details]
Bug 1392322 - Fix browserAction.setTitle for currently active tab on Android.

Approval Request Comment
[Feature/Bug causing the regression]:
Bug 1330159 - [tracking] BrowserAction API support for Android WebExtensions

[User impact if declined]:
As described in Comment 0, when an extension calls browserAction.setTitle for the currently active tab, the updated title will not be shown in the browser action menu item until the user switch explicitly between tabs, which is definitely going to confuse the user and it will probably lead to bugs wrongly reported as an extension issue.

[Is this code covered by automated tests?]:
Yes, a new test case has been added alongside the fix.

[Has the fix been verified in Nightly?]:
Yes

[Needs manual test from QE? If yes, steps to reproduce]:
Yes, same STR used to verify it on Nightly

[List of other uplifts needed for the feature/fix]:
None

[Is the change risky?]:
No

[Why is the change risky/not risky?]:
The fix is limited to the browserAction API android implementation and it is a very small change, it is tested using a new automated test (added to the set of tests that already exists for this feature) and it has also been verified by the QA.

[String changes made/needed]:
None
Attachment #8899541 - Flags: approval-mozilla-beta?
Comment on attachment 8899541 [details]
Bug 1392322 - Fix browserAction.setTitle for currently active tab on Android.

Minor change, fix verified in nightly, includes new tests. 
How could it be any more reassuring?
Let's land this for beta 7!
Attachment #8899541 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Attached image 56.0b7-1392322.gif
This issue is verified as fixed on Fennec 56.0b7 under Android 6.0.1. 

The browserAction custom title is updated in the current active tab.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.