Skip to content

Commit d85f7ac

Browse files
committed
start to migrate Chrome (but not Firefox) browser extension to manifest v3
1 parent 979cd0e commit d85f7ac

File tree

4 files changed

+47
-8
lines changed

4 files changed

+47
-8
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ Here's how to cut a new release of the browser extension and publish it [to addo
168168
169169
Browser extension: Changelog
170170
---
171+
0.6, unreleased
172+
173+
* [Migrate from Manifest v2 to v3.](https://developer.chrome.com/docs/extensions/mv3/intro/mv3-migration/#man-sw) ([Ugh.](https://blog.mozilla.org/addons/2022/05/18/manifest-v3-in-firefox-recap-next-steps/))
174+
171175
0.5, 2022-07-21
172176
173177
* Update Instagram scraping.

browser-extension/background.js

+10-8
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ import {Facebook} from './facebook.js'
2121

2222
const FREQUENCY_MIN = 30
2323

24-
function schedulePoll() {
25-
browser.alarms.onAlarm.addListener((alarm) => {
26-
if (alarm.name == 'bridgy-facebook-poll') {
27-
Facebook.poll()
28-
} else if (alarm.name == 'bridgy-instagram-poll') {
29-
Instagram.poll()
30-
}
31-
})
24+
// Must be top level in non-persistent background (aka event) pages
25+
// https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Background_scripts#move_event_listeners
26+
browser.alarms.onAlarm.addListener((alarm) => {
27+
if (alarm.name == 'bridgy-facebook-poll') {
28+
Facebook.poll()
29+
} else if (alarm.name == 'bridgy-instagram-poll') {
30+
Instagram.poll()
31+
}
32+
})
3233

34+
function schedulePoll() {
3335
for (const silo of [Instagram, Facebook]) {
3436
const name = silo.alarmName()
3537
browser.alarms.get(name).then(function(alarm) {
+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"name": "Bridgy",
3+
"version": "0.6.0",
4+
"description": "Bridgy connects your web site to social media. This extension adds Facebook and Instagram support.",
5+
"homepage_url": "https://brid.gy/",
6+
"manifest_version": 3,
7+
"minimum_chrome_version": "74",
8+
"permissions": [
9+
"alarms",
10+
"contextualIdentities",
11+
"cookies",
12+
"storage",
13+
"webRequest",
14+
"webRequestBlocking"
15+
],
16+
"host_permissions": [
17+
"*://*.brid.gy/*",
18+
"*://*.instagram.com/*",
19+
"*://*.facebook.com/*"
20+
],
21+
"background": {
22+
"service_worker": "background.js",
23+
"type": "module"
24+
},
25+
"icons": {
26+
"128": "bridgy_logo_128.jpg",
27+
"1024": "bridgy_logo_square_1024.jpg"
28+
},
29+
"options_ui": {
30+
"page": "options.html",
31+
"browser_style": true
32+
}
33+
}
File renamed without changes.

0 commit comments

Comments
 (0)