Skip to content

Commit 36b7fbf

Browse files
committed
Fix bug for Firefox
1 parent ba0079e commit 36b7fbf

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

src/background.js

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
'use strict';
22

3-
chrome.runtime.onInstalled.addListener(() => {
4-
chrome.contextMenus.create(
5-
{
6-
contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image'],
7-
id: 'background_img',
8-
title: chrome.i18n.getMessage('extName'),
9-
},
10-
() => {
11-
if (chrome.runtime.lastError) {
12-
console.log(chrome.runtime.lastError);
13-
}
14-
},
15-
);
16-
});
3+
chrome.contextMenus.create(
4+
{
5+
contexts: ['page', 'frame', 'selection', 'link', 'editable', 'image'],
6+
documentUrlPatterns: ['http://*/*', 'https://*/*', 'file:///*/*'],
7+
id: 'background_img',
8+
title: chrome.i18n.getMessage('extName'),
9+
},
10+
() => {
11+
if (chrome.runtime.lastError) {
12+
console.log(chrome.runtime.lastError);
13+
}
14+
},
15+
);
1716

1817
const cache = new Map();
1918

src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"content_scripts": [
1212
{
13-
"matches": ["<all_urls>"],
13+
"matches": ["http://*/*", "https://*/*", "file:///*/*"],
1414
"js": ["content.js"],
1515
"run_at": "document_start",
1616
"all_frames": true

0 commit comments

Comments
 (0)