Hello to all. I really need help!
The extension is all depended on the context menu feature. But it’s available and working only on fresh install. After Firefox is closed and reopened the context menu item is gone.
manifest.json
{
"manifest_version": 2,
"name": "my full name",
"short_name": "my short name",
"version": "1.1.5",
"author": "My author name",
"description": "Some description here.",
"content_security_policy": "script-src 'self'; object-src 'self'; media-src 'self'",
"icons": {
"16": "img/context/icon-bitty.png",
"48": "img/context/icon-small.png",
"128": "img/context/icon-large.png"
},
"browser_action": {
"default_icon": {
"16": "img/icon_off.png",
"32": "img/icon_off.png",
"64": "img/icon_off.png"
},
"default_popup": "popup.html"
},
"options_page": "options.html",
"permissions": [
"tabs",
"activeTab",
"contextMenus",
"notifications",
"<all_urls>"
],
"background": {
"persistent": false,
"scripts": ["js/jquery-3.2.1.min.js", "js/common.js", "js/background.js"]
},
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["css/content-style.css"],
"js": ["js/jquery-3.2.1.min.js", "js/content-script.js"],
"match_about_blank": true,
"all_frames" : true,
"run_at" : "document_end"
}
],
"web_accessible_resources": [
"options.html"
]
}
Since it’s a cross-browser extension I have this in my common.js
var extension = window.msBrowser || window.browser || window.chrome;
Then in my background.js
extension.runtime.onInstalled.addListener(function() {
extension.contextMenus.create({
id: contextMenuApiID,
title: cmName,
enabled: isEnabled,
contexts: ["all"]
});
});
extension.contextMenus.onClicked.addListener(function(data, tab) {
// Some stuff here
});
What am I missing do doing wrong?
And one more thing: What should I do to bring the Context Menu item to all users which have already installed the extension?
Please help.