Get url of activetab from popup on Android

In a Webextension created for Firefox desktop i can get the url of the activetab by using this code:

chrome.tabs.query({active: true, currentWindow: true}, function (tabs) {

However, if I use this in latest Firefox Nightly on Android, I get only ‘undefined’.

How can I retrieve the url of the activetab?

And yes, in permissions, I have set activetab.

I assume undefined is tze value of the first tab that the promise resolves to i.e. it resolves to an empty array?

Where/when are you querying?

Also, does removing the currentWindow filter change anything? I could see that producing incorrect results if it’s not impmemented on android.

Yeah I ran into the same issue. Removing currentWindow: true worked for me. I guess the new Firefox for Android doesn’t implement windows at all.

It does not change, when I suppress currentWindow. As you can see in the attached screenshot, i get some information about the tab. But i miss the url info, which is what i need.

As permission, i have not set tabs, but i have enabled activeTab. It works as expected on the desktop, but not on Android. The screenshot is from the Dev console, with USB Debugging enabled.

This is without currentWindow:

BTW: Currently I install an AddOn in Firefox Android by releasing a new version on AMO and installing it in Nightly with a custom collection. I have not found a way, to install a extension without AMO, so that i can test it before releasing a new version. If someone knows a way, please let me know.

Sure you can follow the instructions at using web-ext.

1 Like

Thanks. It seems to me like you’re querying tab info from somewhere that isn’t considered a user interaction for some reason. So I repeat the question: when/where are you running this?

There should be a forum rule that you have to upload a test extension that demonstrates your problem or what you’re trying to do.

I have a popup which is displayed when I click the browserAction icon. I have not found a other way to add custom menus. That’s why, i use the popup. In this popup i have placed a dynamic menu structure. When I click one of this menu entrys, the above code should be executed. This works at least on the desktop but not on Android.

1 Like

Many thx for that link. This helped a lot. I have tried it now with “tabs” permission and it worked as a workaround and i get the correct url in my callback. I hope this bug will be fixed soon, since i only need “activeTab” as permission in reality.

Many thx for helping also with installing temporary on Android. I never used npm or nodejs before. But now i can pre-test before releasing a new version.