Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
tab.active && tab.url == request.value.url &&
browser.tabs.remove( tab.id );
});
});
break;
case msg.MESSAGE_ACTION.menu:
const { id, value } = request.value;
// hack code refresh options menu changed, and not saved storage
storage.option.menu[id] = value;
value === true ? menu.Create( id ) : menu.Remove( id );
break;
case msg.MESSAGE_ACTION.updated:
watch.Push( request.value.type, request.value.value );
break;
case msg.MESSAGE_ACTION.save_verify:
sendResponse( watch.Lock( request.value.url ));
break;
case msg.MESSAGE_ACTION.auth:
browser.tabs.create({ url: browser.extension.getURL( "options/options.html#labs?auth=" + request.value.name.toLowerCase() ) });
break;
case msg.MESSAGE_ACTION.update_site:
getCurTab({ active: true, url: request.value.url }, tabs => {
tabs.length > 0 && ( upTabId = tabs[0].id );
browser.tabs.create({ url: browser.extension.getURL( "options/options.html#sites?update=" + encodeURI( JSON.stringify( request.value.site ))) });
});
break;
case msg.MESSAGE_ACTION.save_site:
browser.tabs.create({ url: browser.extension.getURL( "options/options.html#sites?pending=" + encodeURI( JSON.stringify( request.value ))) });
break;
case msg.MESSAGE_ACTION.temp_site:
browser.tabs.create({ url: browser.extension.getURL( "options/options.html#sites?temp=" + encodeURI( JSON.stringify( request.value ))) });
break;
});
break;
case msg.MESSAGE_ACTION.new_tab:
browser.tabs.create({ url: request.value.url });
break;
case msg.MESSAGE_ACTION.menu:
const { id, value } = request.value;
// hack code refresh options menu changed, and not saved storage
storage.option.menu[id] = value;
value === true ? menu.Create( id ) : menu.Remove( id );
break;
case msg.MESSAGE_ACTION.updated:
watch.Push( request.value.type, request.value.value );
break;
case msg.MESSAGE_ACTION.save_verify:
sendResponse( watch.Lock( request.value.url ));
break;
case msg.MESSAGE_ACTION.auth:
browser.tabs.create({ url: browser.extension.getURL( "options/options.html#labs?auth=" + request.value.name.toLowerCase() ) });
break;
case msg.MESSAGE_ACTION.auth_success:
getCurTab( { url: request.value.url }, tabs => {
if ( tabs && tabs.length > 0 ) {
browser.tabs.remove( tabs[0].id );
getCurTab( { "active": true }, tabs => {
tabs.forEach( tab => browser.tabs.sendMessage( tab.id, msg.Add( msg.MESSAGE_ACTION.export, {type: request.value.name.toLowerCase()} )) );
});
}
});
break;
case msg.MESSAGE_ACTION.track:
tracked( request.value );