Closed Bug 1617675 Opened 5 years ago Closed 5 years ago

web-ext run fails intermittently

Categories

(GeckoView :: Extensions, defect, P1)

Unspecified
All
defect

Tracking

(firefox75 fixed)

RESOLVED FIXED
mozilla75
Tracking Status
firefox75 --- fixed

People

(Reporter: csadilek, Assigned: agi)

Details

(Whiteboard: [geckoview:m75])

Attachments

(1 file)

We're seeing intermittent failures of web-ext run caused by:

o: Remote Firefox: listTabs() error: unknownError: can't access property "selectedBrowser", aWindow.BrowserApp is undefined
    at /usr/local/lib/node_modules/web-ext/dist/web-ext.js:1:5319
    at /usr/local/lib/node_modules/web-ext/node_modules/@cliqz-oss/firefox-client/lib/client-methods.js:73:9
    at Client.handleMessage (/usr/local/lib/node_modules/web-ext/node_modules/@cliqz-oss/firefox-client/lib/client.js:162:7)
    at Client.readMessage (/usr/local/lib/node_modules/web-ext/node_modules/@cliqz-oss/firefox-client/lib/client.js:221:10)
    at Client.onData (/usr/local/lib/node_modules/web-ext/node_modules/@cliqz-oss/firefox-client/lib/client.js:187:16)
    at Socket.emit (events.js:321:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:273:9)
    at Socket.Readable.push (_stream_readable.js:214:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:186:23)

This is reproducible on GeckoViewExample as well.

Flags: needinfo?(lgreco)

(In reply to Christian Sadilek [:csadilek] from comment #0)

We're seeing intermittent failures of web-ext run caused by:

o: Remote Firefox: listTabs() error: unknownError: can't access property "selectedBrowser", aWindow.BrowserApp is undefined
...

As I mentioned to Christian, this error is very likely thrown from here: https://searchfox.org/mozilla-central/rev/96f1457323cc598a36f5701f8e67aedaf97acfcf/mobile/android/modules/dbg-browser-actors.js#82

Looking at the blame for that line, it looks it is coming directly from Fennec (introduced by Bug 909782), which makes sense given that BrowserApp was originally part of the Fennec internals.

In GeckoView that BrowserApp global is lazily created here from GeckoViewTab.jsm:

and so my guess is that web-ext is triggering a race between the "remote debugging server calling listTabs" (because web-ext run is quickly connecting to the RemoteDebuggingServer are soon as it is reachable) and "BrowserApp global being created by GeckoViewTab.jsm".

This issue looks something that we should fix in dbg-browser-actors.js, e.g. we could either:

  • import GeckoViewTab.jsm from dbg-browser-actors.js and then use BrowserAppShim.getBrowserApp(window) to get the BrowserApp object for a given window (and avoid the race that is likely triggering the error), but it is worth to mention that BrowserAppShim doesn't provide a tabs property and so MobileTabList.prototype._getChildren would still be broken (it seems to be used here to iterate over all the tabs).

  • or remove any usage of BrowserApp from it (and replace with a more "GeckoView"-way of implementing those methods)

Flags: needinfo?(lgreco)
Priority: -- → P1
Whiteboard: [geckoview:m75]

In GeckoView every window has always exactly only one browser. Also selectedTab
is not defined.

Assignee: nobody → agi
Status: NEW → ASSIGNED
Pushed by asferro@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/5b0bd8cfdc33 Don't use Fennec BrowserApp in dbg-browser-actors. r=ochameau,snorp
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla75
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: