Open Bug 1391188 Opened 7 years ago Updated 2 years ago

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

Categories

(WebExtensions :: General, defect, P5)

defect

Tracking

(Not tracked)

UNCONFIRMED

People

(Reporter: 626954412, Unassigned)

Details

Attachments

(1 file)

5.82 KB, application/x-xpinstall
Details
Attached file 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
Component: Untriaged → WebExtensions: Untriaged
Product: Firefox → Toolkit
Version: 57 Branch → Trunk
Flags: needinfo?(amckay)
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
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)
Thanks Kris. Would you call this by design then, and we should close?
No, it's definitely a bug.
Product: Toolkit → WebExtensions
Bulk move of bugs per https://bugzilla.mozilla.org/show_bug.cgi?id=1483958
Component: Untriaged → General
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: