Verified Commit c10698fe authored by Vincent's avatar Vincent

Reflect that a message might not have a sender

This _might_ be causing an error and, with that, #166, but I'm not
sure yet. In any case, this is a potential failure case, so fixing
it should not cause harm.

(Also marked other optional properties as optional, but since we're
not using them anywhere, those did not require code changes.)
parent c007f245
Pipeline #71129469 passed with stage
in 2 minutes and 11 seconds
......@@ -4,7 +4,7 @@ import browser from 'webextension-polyfill';
import { ExtensionMessage, isFoundDoisMessage } from '../interfaces';
browser.runtime.onMessage.addListener<ExtensionMessage>((message, sender) => {
if (isFoundDoisMessage(message)) {
if (isFoundDoisMessage(message) && {
if (message.dois.length === 1) {;
} else {
......@@ -53,11 +53,11 @@ declare namespace browser.runtime.onMessage {
message: MessageTypes,
sender: {
contextId: number,
id: string,
id?: string,
extensionId: string,
frameId: number,
url: string,
tab: Tab,
frameId?: number,
url?: string,
tab?: Tab,
sendResponse: (response: MessageTypes) => void,
) => boolean | Promise<void>,
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment