🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

webext-tools

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

webext-tools - npm Package Compare versions

Comparing version
4.0.1
to
4.0.2
+10
-3
distribution/create-context-menu.js
import chromeP from 'webext-polyfill-kinda';
const listeners = new Map();
let globalListenerAdded = false;
function isDuplicateError(error) {
return (error.includes('Cannot create item with duplicate id')
|| error.includes('already exists in menus.create'));
return (error.includes('Cannot create item with duplicate id') // Chrome
|| error.includes('already exists in menus.create') // Firefox
|| error.includes('Identifier is already used') // Safari
);
}

@@ -29,3 +32,7 @@ /* Throws an error due to misconfiguration, unless misconfiguration can't be verified (Firefox cleans the manifest of unknown properties) */

// Add single listener or else multiple `create` calls will register multiple listeners.
chrome.contextMenus.onClicked.addListener(globalListener);
// Safari (unlike Chrome/Firefox) does not deduplicate addListener calls, so we guard it manually.
if (!globalListenerAdded) {
chrome.contextMenus.onClicked.addListener(globalListener);
globalListenerAdded = true;
}
listeners.set(createSettings.id, onclick);

@@ -32,0 +39,0 @@ }

{
"name": "webext-tools",
"version": "4.0.1",
"version": "4.0.2",
"description": "Utility functions for Web Extensions",

@@ -5,0 +5,0 @@ "keywords": [