Share the Same DOM MessagePort for Inter-App Communication and Shared Worker

RESOLVED INCOMPLETE

Status

()

RESOLVED INCOMPLETE
5 years ago
8 months ago

People

(Reporter: airpingu, Unassigned)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

5 years ago
Per off-line discussion, in the long term we need to share the same MessagePort structure and common codes for both Inter-App Communication and Shared Worker.

Quoting Bent's comment as below:

The main difference is the logic of postMessage(...) which can have diverging implementations for different kinds of messaging. For example, an MessagePort can communicate with a worker, another process, another window in the same process, etc. And a MessagePort object can be passed around so that a MessagePort that originally talked to another window might have to be transformed into one that talks to a worker or something. This means we'll need to abstract the actual message passing into some kind of interface object that we can swap in and out of a MessagePort object. Pseudo codes could be:

  class nsIMessageTarget : public nsISupports
  {
    void postMessage(JS::Value& aMessage) = 0;
  };

  class MessagePort
  {
    // ...
  private:
    nsCOMPtr<nsIMessageTarget> mTarget;

  public:
    MessagePort(nsIMessageTarget* aTarget) : mTarget(aTarget) { }

    ChangeTarget(nsIMessageTarget* aTarget) { mTarget = aTarget; }

    // ...
  };
(Reporter)

Updated

4 years ago
Blocks: 876397
No longer depends on: 876397
(Reporter)

Updated

4 years ago
Assignee: gene.lian → nobody
More mass-incompleting of FxOS bugs in the Device Interfaces component.

Please update and let me know if any of these are still valid.
Status: NEW → RESOLVED
Last Resolved: 8 months ago
Resolution: --- → INCOMPLETE
Keywords: dev-doc-needed
You need to log in before you can comment on or make changes to this bug.