Tap into content scope, or transfer ports from WebWorker?

Hi all,
I was wondering which of these methods would be better. Both situations they are trying to establish MessageChannel communication between framescript and content so I can transfer arraybuffers.

Method 1 - Tap scope and share ports

Framescript does this:

var msgchan = new content.MessageChannel();
var port1 = msgchan.port1;

Method 2 - Spawn worker and transfer between three scopes

Framescript spawns a WebWorker. The WebWorker does new MessageChannel() and then transfers to the framescript the ports.

Framescript then transfers one of the ports to content with content.postMessage.

Thanks

Frame scripts are there to access content. What is it you are worried about being a problem? Pretty much any web API should work in a frame script. Are you communicating with content or with another addon script?

Thanks litho! I need to transfer large arraybuffers so needed to establish this transferable connection. I’m communicating with my own addons content script and pages.