Open Bug 1950027 Opened 4 months ago Updated 3 months ago

exportFlags error: can't access property "hasPermission", extension is undefined

Categories

(GeckoView :: Extensions, defect)

All
Android
defect

Tracking

(Not tracked)

People

(Reporter: robwu, Assigned: robwu)

References

(Depends on 1 open bug)

Details

(Whiteboard: [addons-jira])

Attachments

(1 file)

The exportFlags function in GeckoViewWebExtension.sys.mjs (source) expects aPolicy.extension to always exist. This is not guaranteed, e.g. if extension startup was interrupted.

As an example, see the following test case that initiates startup and then immediately triggers extension shutdown. It triggers a test failure:

https://searchfox.org/mozilla-central/rev/45d158e24489a6bad5a2d2d384b5083595c6c29c/toolkit/mozapps/extensions/test/xpcshell/test_shutdown_barriers.js#113

./mach xpcshell-test toolkit/mozapps/extensions/test/xpcshell/test_shutdown_barriers.js triggers the following error:

  FAIL test_wait_addons_startup_before_granting_quit - [test_wait_addons_startup_before_granting_quit : 266] A promise chain failed to handle a rejection: can't access property "hasPermission", extension is undefined - stack: exportFlags@resource://gre/modules/GeckoViewWebExtension.sys.mjs:281:7
exportExtension@resource://gre/modules/GeckoViewWebExtension.sys.mjs:393:24
async*onExtensionReady@resource://gre/modules/GeckoViewWebExtension.sys.mjs:681:29
async*emit@resource://gre/modules/ExtensionCommon.sys.mjs:336:32
startup@resource://gre/modules/Extension.sys.mjs:3903:18
async*startup@resource://gre/modules/Extension.sys.mjs:3001:27
callBootstrapMethod@resource://gre/modules/addons/XPIProvider.sys.mjs?2:1854:33
startup@resource://gre/modules/addons/XPIProvider.sys.mjs?2:1970:34
startup@resource://gre/modules/addons/XPIProvider.sys.mjs?2:2598:41
callProvider@resource://gre/modules/AddonManager.sys.mjs:228:31
_startProvider@resource://gre/modules/AddonManager.sys.mjs:537:17
startup@resource://gre/modules/AddonManager.sys.mjs:750:14
startup@resource://gre/modules/AddonManager.sys.mjs:3684:26
observe@resource://gre/modules/amManager.sys.mjs:73:29
promiseStartupManager@resource://testing-common/AddonTestUtils.sys.mjs:853:34
test_wait_addons_startup_before_granting_quit@test_shutdown_barriers.js:113:3
async*_run_next_test/<@/data/local/tmp/test_root/xpc/head.js:1759:22
_run_next_test@/data/local/tmp/test_root/xpc/head.js:1759:38
run@/data/local/tmp/test_root/xpc/head.js:808:9
_do_main@/data/local/tmp/test_root/xpc/head.js:245:6
_execute_test@/data/local/tmp/test_root/xpc/head.js:596:5
@-e:1:1
See Also: → 1872867

The severity field is not set for this bug.
:towhite, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(towhite)

Adding dependency per https://phabricator.services.mozilla.com/D239630#inline-1328194

This only affects apps where out of process extensions are disabled. So not on Fenix, but on other A-C derivatives, including e.g. Focus.

Severity: -- → S4
Depends on: 1642012
Flags: needinfo?(towhite)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: