Unable to update tab URL in geckoview

RESOLVED FIXED in Firefox 63

Status

defect
P2
normal
RESOLVED FIXED
10 months ago
6 months ago

People

(Reporter: rwood, Assigned: mbrubeck)

Tracking

(Blocks 1 bug)

unspecified
mozilla63
Dependency tree / graph

Firefox Tracking Flags

(firefox-esr52 wontfix, firefox-esr60 wontfix, firefox61 wontfix, firefox62 wontfix, firefox63 fixed)

Details

Attachments

(3 attachments)

Reporter

Description

10 months ago
I am attempting to get Raptor (performance automation tool) running in GeckoView (using the GeckoView Example app) to run the speedometer benchmark. Raptor is a web extension [1] and uses the tab API to navigate to the benchmark pages.

I am unable to change the URL in the geckoview example app by using 'browser.tabs.update'. If I don't provide a tabID (so by default it should use the current tab) I get this error:

E GeckoConsole: [JavaScript Error: "nativeTab is null" {file: "chrome://geckoview/content/ext-tabs.js" line: 311}]

I have also tried providing a tabID of 0 and 1 but if I do that I get an 'invalid TabID' error.

Is the tabs API not supported in geckoview? Are there plans to support this? If not, how can I set the URL from within a web extension, is that possible? Thanks!

[1] https://searchfox.org/mozilla-central/source/testing/raptor/webext/raptor
Reporter

Comment 1

10 months ago
If I could send the URL in to navigate to the benchmark URL upon app startup that would be good however I still need the ability to refresh the page / reload the same URL as we do multiple cycles of each benchmark without restarting the browser in between.
Reporter

Comment 2

10 months ago
browser.tabs.reload() results in the same error:

E GeckoConsole: [JavaScript Error: "nativeTab is null" {file: "chrome://geckoview/content/ext-tabs.js" line: 342}]
Reporter

Comment 3

10 months ago
Hi Jim, do you know if the tabs api will be supported in geckoView? Or is there is another way to change the URL and refresh/reload, from within a webext? Thanks!

If this is not going to be supported we will need to come up with a new solution for running speedometer on geckoview/android.
Flags: needinfo?(nchen)
We should be able to make browser.tabs work in GeckoView, though it's probably only going to return a single tab.
one tab should be good, but what is the timeline to make this work?
I can take a look. :esawin did some work already to make `browser.tabs` work, so I don't think there should be too much more work to get `reload` working.
Assignee: nobody → nchen
Status: NEW → ASSIGNED
Flags: needinfo?(nchen)
Priority: -- → P2
Reporter

Comment 7

10 months ago
(In reply to Jim Chen [:jchen] [:darchons] from comment #6)
> I can take a look. :esawin did some work already to make `browser.tabs`
> work, so I don't think there should be too much more work to get `reload`
> working.

Is there a different bug for the browser.tabs work you mentioned? I just tried a geckoview_example app from the latest inbound and still seeing the same browser.tabs errors.
Flags: needinfo?(nchen)
I think bug 1329154 made parts of the `browser.tabs` API work.
Flags: needinfo?(nchen)
Reporter

Comment 9

10 months ago
Thanks - I was seeing old adb logcat entries that are dumped each time it starts. With the latest geckoview example app it looks like the raptor webext isn't loading now, so I can't get far enough to try out tabs yet.
Reporter

Updated

10 months ago
See Also: → 1482456
Hey Matt, do you have some time to help Rob with this? You'll probably want to look at "ext-tabs.js" and "GeckoViewTab.jsm" to make "browser.tabs.reload" work.
Flags: needinfo?(mbrubeck)
Reporter

Comment 11

10 months ago
With an Anroid 4.0 geckoview_example from today's inbound, on google pixel 2, confirmed that browser.tabs.update is still giving this error:

08-10 15:13:02.517  8586  8603 E GeckoConsole: [JavaScript Error: "nativeTab is null" {file: "chrome://geckoview/content/ext-tabs.js" line: 316}]
Assignee

Comment 12

10 months ago
> Hey Matt, do you have some time to help Rob with this?

Sure.
Assignee: nchen → mbrubeck
Flags: needinfo?(mbrubeck)
Assignee

Comment 13

10 months ago
`windowTracker.topWindow` is returning null here:

https://searchfox.org/mozilla-central/rev/ca869724246f4230b272ed1c8b9944596e80d920/mobile/android/components/extensions/ext-utils.js#439

`topWindow` calls the window-mediator service:

    get topWindow() {
      return Services.wm.getMostRecentWindow("navigator:browser");
    }
Assignee

Comment 14

10 months ago
For this to work with GeckoView, it would need to use "navigator:geckoview" instead.
Comment on attachment 9000015 [details]
Bug 1481471 - Implement browser.tab.getActive() in GeckoView. r=snorp

James Willcox (:snorp) (jwillcox@mozilla.com) has approved the revision.
Attachment #9000015 - Flags: review+
Comment on attachment 9000014 [details]
Bug 1481471 - Allow browser.tabs extension APIs to find GeckoView windows. r=snorp

James Willcox (:snorp) (jwillcox@mozilla.com) has approved the revision.
Attachment #9000014 - Flags: review+
Comment on attachment 9000013 [details]
Bug 1481471 - Remove some cruft left behind by Bug 1481471. r=snorp

James Willcox (:snorp) (jwillcox@mozilla.com) has approved the revision.
Attachment #9000013 - Flags: review+
Reporter

Comment 21

10 months ago
Verified (with a build on try from :jmaher with your patches applied) that the fix works great - browser.tabs.update now works from within the raptor web extension on the geckoview example app. Thanks!

Comment 23

10 months ago
Pushed by mbrubeck@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/9288bcd578ed
Remove some cruft left behind by Bug 1481471. r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/0f4415f29a66
Allow browser.tabs extension APIs to find GeckoView windows. r=snorp
https://hg.mozilla.org/integration/mozilla-inbound/rev/7d9cc6236b1f
Implement browser.tab.getActive() in GeckoView. r=snorp
Assignee

Updated

10 months ago

Updated

6 months ago
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 63 → mozilla63
You need to log in before you can comment on or make changes to this bug.