-
Notifications
You must be signed in to change notification settings - Fork 22.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CustomEvent documentation missing cloneInto
information for web extension scripts
#29232
Comments
Do you think it would be OK to document this in the WebExtensions documentation, perhaps in the content scripts guide? This already has a section on communicating with the web page. |
Yeah, for sure! This is certainly WebExtension-specific, to my knowledge (there are no isolated worlds in normal web code, right?) That section could definitely use a description of the |
cloneInto
informationcloneInto
information for web extension scripts
@rebloor , what do you think? |
Seem reasonable to me - any comment @mdn/yari-content-mozilla-add-ons |
I'm in favor of documenting this more explicitly. Perhaps in the form of a small note stating the requirement when used in WebExtensions' content scripts to communicate with the web page, with a link to the extension documentation. |
MDN URL
https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent
What specific section or headline is this issue about?
Section was removed in #9920.
What information was incorrect, unhelpful, or incomplete?
As per https://stackoverflow.com/a/46081249, CustomEvents with a non-string
detail
property will throw with "Permission denied to access property" in Firefox when they are used to communicate between the web extension content script isolated world and main world (this is the current state of the art in web extensions for cross-world communication, as I understand it). CallingcloneInto
on the payload is required to avoid this.There used to be a section describing this, but it was removed per #9920 (comment):
XUL extensions may be gone, but WebExtensions certainly aren't, and this is the logical place where one who ran into this permission error would probably be looking for this information!
What did you expect to see?
An updated form of the removed passage, detailing this Firefox behavior and the
cloneInto(/* whatever */, doc.defaultView)
method required to use it, with the example changed to a web extension context and a note that Chromium does not have this behavior.Link to the previous copy: https://github.com/mdn/content/blob/2279e5ae6c229c707a014a22aa1ec4635a0f981f/files/en-us/web/api/customevent/index.md
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
Not sure if I should make an issue at https://github.com/w3c/webextensions/ describing this? It seems like a platform discrepancy that has gone largely uncommented-upon.
MDN metadata
Page report details
en-us/web/api/customevent
The text was updated successfully, but these errors were encountered: