remove background.js
This commit is contained in:
parent
427ba7cb4f
commit
782802a376
1 changed files with 0 additions and 33 deletions
|
|
@ -1,33 +0,0 @@
|
||||||
const extensionApi = globalThis.browser ?? globalThis.chrome;
|
|
||||||
|
|
||||||
extensionApi.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
|
||||||
if (message.type !== "COOKIE") {
|
|
||||||
sendResponse({ error: `Unknown message type ${message.type}` });
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const details = {
|
|
||||||
url: message.url,
|
|
||||||
name: message.key
|
|
||||||
};
|
|
||||||
|
|
||||||
if (globalThis.browser?.cookies?.get) {
|
|
||||||
extensionApi.cookies.get(details)
|
|
||||||
.then((cookie) => sendResponse(cookie))
|
|
||||||
.catch((error) => sendResponse({ error: error.message }));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
extensionApi.cookies.get(details, (cookie) => {
|
|
||||||
const runtimeError = extensionApi.runtime.lastError;
|
|
||||||
|
|
||||||
if (runtimeError) {
|
|
||||||
sendResponse({ error: runtimeError.message });
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
sendResponse(cookie);
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
});
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue