Closed Bug 1444294 Opened 6 years ago Closed 4 years ago

Implement permissions API events

Categories

(WebExtensions :: General, enhancement, P1)

60 Branch
enhancement

Tracking

(firefox77 fixed)

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: ykonotopov, Assigned: mixedpuppy)

References

(Blocks 2 open bugs)

Details

(Keywords: dev-doc-complete, parity-chrome)

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36



Actual results:

Permissions API events are not supported by Firefox [1]

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/permissions
Blocks: 1197420
Hi Yuri Konotopov,

I'm not sure I understand what exactly this bug is about. Could you please give some more details?
Flags: needinfo?(ykonotopov)
Hi, David Olah!

As stated at [1][2][3] both "permissions.onAdded" [2] and "permissions.onRemoved" [3] event handlers are missed at Firefox.
This issue is filled to request events implementation.

This is needed to make GNOME Shell integration webextension [4] funtionality equal to Chrome's variant.

[1] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/permissions
[2] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/permissions/onAdded
[3] https://developer.mozilla.org/en-US/Add-ons/WebExtensions/API/permissions/onRemoved
[4] https://addons.mozilla.org/ru/firefox/addon/gnome-shell-integration/
Flags: needinfo?(ykonotopov)
Based on Comment 2, I will mark this bug as an enhancement.
Severity: normal → enhancement
Status: UNCONFIRMED → NEW
Component: Untriaged → WebExtensions: Untriaged
Ever confirmed: true
Product: Firefox → Toolkit
Priority: -- → P5
Product: Toolkit → WebExtensions
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
When can we expect the release of this feature. I believe its essential for user privacy as asking for all permissions initially is not necessary for add-ons having conditional features.
Flags: needinfo?(dwalsh)
Flags: needinfo?(dwalsh)
Whiteboard: [permission][chrome]

I wrote a polyfill for this feature in Firefox: https://github.com/bfred-it/chrome-permissions-events-polyfill

Assignee: nobody → mixedpuppy
Blocks: 1458585, 1578508
Priority: P5 → P1

We'll need to update the compat chart when this lands.

Whiteboard: [permission][chrome]
Blocks: 1624513
Pushed by scaraveo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/b35022051d3d
implement browser.permissions onAdded/Removed r=robwu

Backed out for failures on test_ext_all_apis.html.

Push with failures: https://treeherder.mozilla.org/#/jobs?repo=autoland&resultStatus=testfailed%2Cbusted%2Cexception&revision=1dde649fe4e020be0f13f0b4549d78d711897ae5&selectedJob=299482799

Failure log: https://treeherder.mozilla.org/logviewer.html#?job_id=299482799&repo=autoland

Backout link: https://hg.mozilla.org/integration/autoland/rev/0844fc02acaff58b6ec23f2dc8e22d064a81b0c8

[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6009 INFO TEST-OK | layout/svg/tests/test_use_tree_cycle.html | took 55ms
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6010 INFO TEST-START | Shutdown
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6011 INFO Passed:  16
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6012 INFO Failed:  0
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6013 INFO Todo:    0
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6014 INFO Mode:    e10s
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6015 INFO Slowest: 1105ms - /tests/layout/svg/tests/test_bug1544209.html
[task 2020-04-26T20:58:20.512Z] 20:58:20     INFO -  6016 INFO SimpleTest FINISHED
[task 2020-04-26T20:58:22.463Z] 20:58:22     INFO -  wait for org.mozilla.geckoview.test complete; top activity=com.android.launcher3
[task 2020-04-26T20:58:22.570Z] 20:58:22     INFO -  remoteautomation.py | Application ran for: 0:00:16.710334
[task 2020-04-26T20:58:23.102Z] 20:58:23     INFO -  Stopping web server
[task 2020-04-26T20:58:23.105Z] 20:58:23     INFO -  Stopping web socket server
[task 2020-04-26T20:58:23.125Z] 20:58:23     INFO -  Stopping ssltunnel
[task 2020-04-26T20:58:23.146Z] 20:58:23     INFO -  leakcheck | refcount logging is off, so leaks can't be detected!
[task 2020-04-26T20:58:23.147Z] 20:58:23     INFO -  runtests.py | Running tests: end.
[task 2020-04-26T20:58:24.445Z] 20:58:24     INFO -  Buffered messages finished
[task 2020-04-26T20:58:24.445Z] 20:58:24     INFO -  Running manifest: mobile/android/components/extensions/test/mochitest/mochitest.ini
[task 2020-04-26T20:58:25.147Z] 20:58:25     INFO -  runtests.py | Failed to copy /builds/worker/workspace/build/tests/mochitest/hyphenation to profile
[task 2020-04-26T20:58:25.732Z] 20:58:25     INFO -  pk12util: PKCS12 IMPORT SUCCESSFUL
[task 2020-04-26T20:58:25.915Z] 20:58:25     INFO -  MochitestServer : launching [u'/builds/worker/workspace/build/hostutils/host-utils-76.0a1.en-US.linux-x86_64/xpcshell', '-g', '/builds/worker/workspace/build/hostutils/host-utils-76.0a1.en-US.linux-x86_64', '-f', '/builds/worker/workspace/build/hostutils/host-utils-76.0a1.en-US.linux-x86_64/components/httpd.js', '-e', "const _PROFILE_PATH = '/tmp/tmpxJfBra.mozrunner'; const _SERVER_PORT = '8854'; const _SERVER_ADDR = '10.0.2.2'; const _TEST_PREFIX = undefined; const _DISPLAY_RESULTS = false;", '-f', '/builds/worker/workspace/build/tests/mochitest/server.js']
[task 2020-04-26T20:58:25.915Z] 20:58:25     INFO -  runtests.py | Server pid: 8225
[task 2020-04-26T20:58:25.924Z] 20:58:25     INFO -  runtests.py | Websocket server pid: 8228
[task 2020-04-26T20:58:25.932Z] 20:58:25     INFO -  runtests.py | SSL tunnel pid: 8232
[task 2020-04-26T20:58:26.580Z] 20:58:26     INFO -  runtests.py | Running with scheme: http
[task 2020-04-26T20:58:26.580Z] 20:58:26     INFO -  runtests.py | Running with e10s: True
[task 2020-04-26T20:58:26.580Z] 20:58:26     INFO -  runtests.py | Running with fission: False
[task 2020-04-26T20:58:26.580Z] 20:58:26     INFO -  runtests.py | Running with serviceworker_e10s: True
[task 2020-04-26T20:58:26.581Z] 20:58:26     INFO -  runtests.py | Running with socketprocess_e10s: False
[task 2020-04-26T20:58:26.581Z] 20:58:26     INFO -  runtests.py | Running tests: start.
[task 2020-04-26T20:58:26.897Z] 20:58:26     INFO -  adb Granting important runtime permissions to org.mozilla.geckoview.test
[task 2020-04-26T20:58:28.131Z] 20:58:28     INFO -  adb launch_application: am start -W -n org.mozilla.geckoview.test/org.mozilla.geckoview.test.TestRunnerActivity -a android.intent.action.MAIN --es env9 MOZ_UPLOAD_DIR=/data/local/tmp/tests/mozlog --es env8 R_LOG_DESTINATION=stderr --es args "-no-remote -profile /data/local/tmp/tests/profile//" --es env3 R_LOG_VERBOSE=1 --es env2 XPCOM_DEBUG_BREAK=stack --es env1 MOZ_WEBRENDER=0 --es env0 MOZ_CRASHREPORTER=1 --es env7 MOZ_CRASHREPORTER_SHUTDOWN=1 --es env6 MOZ_IN_AUTOMATION=1 --es env5 MOZ_DISABLE_NONLOCAL_CONNECTIONS=1 --es env4 MOZ_HIDE_RESULTS_TABLE=1 --ez use_multiprocess True --es env11 R_LOG_LEVEL=6 --es env10 MOZ_CRASHREPORTER_NO_REPORT=1 -d "http://mochi.test:8888/tests?autorun=1&closeWhenDone=1&logFile=%2Fdata%2Flocal%2Ftmp%2Ftests%2Flogs%2Fmochitest.log&fileLevel=INFO&consoleLevel=INFO&hideResultsTable=1&manifestFile=tests.json&dumpOutputDirectory=%2Fdata%2Flocal%2Ftmp%2Ftests"
[task 2020-04-26T20:58:28.955Z] 20:58:28     INFO -  remoteautomation.py | Application pid: 13900
[task 2020-04-26T20:58:30.909Z] 20:58:30     INFO -  6017 INFO SimpleTest START
[task 2020-04-26T20:58:30.909Z] 20:58:30     INFO -  6018 INFO TEST-START | mobile/android/components/extensions/test/mochitest/test_ext_all_apis.html
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  Buffered messages logged at 20:58:30
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6019 INFO add_task | Entering test test_enumerate_content_script_apis
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6020 INFO Extension loaded
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6021 INFO TEST-PASS | mobile/android/components/extensions/test/mochitest/test_ext_all_apis.html | content script APIs
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6022 INFO add_task | Leaving test test_enumerate_content_script_apis
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6023 INFO add_task | Entering test test_enumerate_background_script_apis
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  6024 INFO Extension loaded
[task 2020-04-26T20:58:41.349Z] 20:58:41     INFO -  Buffered messages finished
[task 2020-04-26T20:58:41.350Z] 20:58:41  WARNING -  6025 INFO TEST-UNEXPECTED-FAIL | mobile/android/components/extensions/test/mochitest/test_ext_all_apis.html | background script APIs -     Structures begin differing at:
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -  got[26] = "browser.permissions.onAdded"
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -  expected[26] = "browser.permissions.remove"
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -      SimpleTest.isDeeply@SimpleTest/SimpleTest.js:1889:16
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -      test_enumerate_background_script_apis@mobile/android/components/extensions/test/mochitest/test_ext_all_apis.js:176:11
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -  6026 INFO add_task | Leaving test test_enumerate_background_script_apis
[task 2020-04-26T20:58:41.350Z] 20:58:41     INFO -  6027 INFO TEST-OK | mobile/android/components/extensions/test/mochitest/test_ext_all_apis.html | took 1384ms
Flags: needinfo?(mixedpuppy)
Pushed by scaraveo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/cb1de4ab7ddb
implement browser.permissions onAdded/Removed r=robwu
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
Flags: needinfo?(mixedpuppy)

As previously noted, these 2 events appear to be documented already (onAdded and onRemoved). So, unless I've overlooked anything, the changes made are:

Please let me know if you think there are any omissions or the event documentation needs otherwise updating. Thanks!

Flags: needinfo?(mixedpuppy)

Thanks!

Flags: needinfo?(mixedpuppy)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: