From what I tell, there are two ways that extension pages that open in popup windows (or in a new browser tab) can communicate with the background script: 1) sending messages using browser.runtime.sendMessage()
; or, 2) calling browser.runtime.getBackgroundPage()
to get a reference to the background page’s Window object, and using that to call the background script functions.
Is one of these two methods preferred or has any advantages over the other?