Open Bug 1637814 Opened 5 years ago Updated 2 years ago

Document the preferred way to retrieve a sender's principal from a JSWindowActor message

Categories

(Core :: DOM: Core & HTML, task)

task

Tracking

()

People

(Reporter: MattN, Unassigned)

References

()

Details

It seems like this.manager.documentPrincipal is safe to rely on and would be better than this.browsingContext.currentWindowGlobal.documentPrincipal.

If you need to lookup some data for the site in response to an actor's message it's not currently clear how to safely do that. Perhaps Fission prevents accidentally using a different global/principal after navigation but it's not clear if that is currently guaranteed with Fission off.

Is it ever useful to send the BrowsingContext of the JSWindowActorChild as part of a message to the parent? I've seen that pattern used but when would that be preferred over this.browsingContext in the parent? (Ignoring the case of sending a BrowsingContext for a different frame)

We should also document that this.manager/this.browsingContext exist on a JSWindowActorParent, probably at https://firefox-source-docs.mozilla.org/dom/Fission.html?highlight=manager#windowglobalparent

Some other potential improvements here might include:

  • Adding a this.documentPrincipal getter, if this is a common check
  • Adding a this.windowContext getter which might be more clear than this.manager
Flags: needinfo?(nika)
Flags: needinfo?(nika) → needinfo?(afarre)
Severity: -- → S3
Flags: needinfo?(afarre)
You need to log in before you can comment on or make changes to this bug.