Fix PII mapping add (plus button) not persisting and not dismissing notification
The plus button handler in the pre-send PII warning had two bugs: 1. It read/wrote mappings directly via the storage bridge (api.storage.local), bypassing the Storage module's encryption layer. When at-rest encryption was enabled, getStorageData returned an encrypted blob instead of an array, causing .push() to throw a TypeError that silently aborted the handler — the mapping was never saved and replaceInInput never ran. 2. Unlike the ignore button which immediately removes the DOM item, the plus button relied on a re-scan at 150ms to dismiss the notification. If replaceInInput didn't stick (e.g. React-controlled inputs), the re-scan found PII again and the notification persisted. Fix: Route mapping creation through the background service worker via a new 'add:mapping' message handler (which uses Storage.addMapping with proper encryption support), and immediately dismiss the notification item from the DOM like the ignore button does. https://claude.ai/code/session_01RfzvB5sHah326acr8Xa7Jn
This commit is contained in:
@@ -138,6 +138,12 @@ const messageHandlers = {
|
||||
sendResponse({ mappings });
|
||||
},
|
||||
|
||||
async 'add:mapping'(message, _sender, sendResponse) {
|
||||
const newMapping = await Storage.addMapping(message.mapping);
|
||||
const mappings = await Storage.getMappings();
|
||||
sendResponse({ mapping: newMapping, mappings });
|
||||
},
|
||||
|
||||
async 'get:settings'(_message, _sender, sendResponse) {
|
||||
const settings = await Storage.getSettings();
|
||||
sendResponse({ settings });
|
||||
|
||||
Reference in New Issue
Block a user