bugzilla.mozilla.org has resumed normal operation. Attachments prior to 2014 will be unavailable for a few days. This is tracked in Bug 1475801.
Please report any other irregularities here.

WebExtensions content script created iframe response message use Promise, will invalid



11 months ago
27 days ago


(Reporter: pea3nut, Unassigned)



Firefox Tracking Flags

(Not tracked)



(1 attachment)

5.82 KB, application/x-xpinstall


11 months ago
Created attachment 8898191 [details]
a webextensions demo

User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Firefox/52.0
Build ID: 20170802111520

Steps to reproduce:

I use content script created a iframe and insert to page in my webextensions, then, The background script use broswer.tab.sendmessage send message, iframe script response it. I find it's no works when iframe listener return a promise, but ,if listener called the sendResponse function, it will works.
you can install file description webextensions, click the broswerAction button, it will insert a iframe in page. clink the iframe inner button ,check console ,you will easy to understand what i say

Actual results:

content script created iframe and insert to page, iframe script broswer.message.onMessage listener return a promise will be invalid.

Expected results:

expected it can same as content script


11 months ago
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Version: 57 Branch → Trunk


11 months ago
Flags: needinfo?(amckay)

Comment 1

11 months ago
For what its worth, I simplified your script down and found that basically sending sendMessage with Promise based replies between a content script and background script seems to work just fine, that was my main concern. Zombie might know more.
Flags: needinfo?(amckay) → needinfo?(tomica)
Priority: -- → P5

Comment 2

11 months ago
This happens because of the way we handle content script API bindings in unprivileged extension frames. We create the bindings in a Sandbox rather than in the window global, but when we check whether a return value is a promise, we test against the Promise constructor in the sandbox.
Flags: needinfo?(tomica)

Comment 3

11 months ago
Thanks Kris. Would you call this by design then, and we should close?

Comment 4

11 months ago
No, it's definitely a bug.


27 days ago
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.