You can get the responses to work by using the sendResponse callback. If you look at the browser compatibility table for onMessage listener - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessage#Browser_compatibility you will see that responses via promises only natively work on Firefox (and if you're using a browser. polyfill then the promise response works for chrome too).
You can do something like this for safari:
browser.runtime.onMessage.addListener((message, sender, sendResponse) => {
	if (x === 'hello') {
		console.warn(x);
		performAsyncOperation(function callback() { sendResponse('ok') })
		// need to return true if you plan on sending a response asynchronously
		return true;
	}
	if (x === 'bye') {
		sendResponse('ok')
		// no need to return anything here, since we send the response synchronously
	}
});
Topic:
Safari & Web
SubTopic:
General
Tags: