If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

System Message API: the listeners should be indexed by [manifestURL + pageURL]

RESOLVED WONTFIX

Status

()

Core
General
RESOLVED WONTFIX
4 years ago
4 years ago

People

(Reporter: Gene Lian (I already quit Mozilla), Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

4 years ago
In SystemMessageInternal.js, the current ._listners[aManifestURI] mechanism is indexed by the manifest URL only. I suggest we should make it indexed by (manifest URL + page URL) when registering the target, because one [manifest URL + page URL] must be equivalent to *one* target (i.e. one SystemMessageManager). I mean, only *one* target is going to be delivered with the system message, since the system message's target [manifest URL + page URL] is always unique in any way. If my assumption is yes, then we don't need the |targets| loop and the page URL check as shown as the following code segment. We should just focus on that unique target to send our system message.

let targets = this._listeners[aManifestURI];
if (targets) {
  for (let index = 0; index < targets.length; ++index) {
     let target = targets[index];
     // We only need to send the system message to the targets which match
     // the manifest URL and page URL of the destination of system message.
     if (target.uri != aPageURI) {
       continue;
     }
     ...
     let manager = target.target;
     manager.sendAsyncMessage("SystemMessageManager:Message", ...);
  }
}

Looping some people who used to modify the codes here.
(Reporter)

Comment 1

4 years ago
(In reply to Gene Lian [:gene] from comment #0)
> In SystemMessageInternal.js, the current ._listners[aManifestURI] mechanism
> is indexed by the manifest URL only. I suggest we should make it indexed by
> (manifest URL + page URL) when registering the target, because one [manifest
> URL + page URL] must be equivalent to *one* target (i.e. one
> SystemMessageManager).

This assumption is wrong. Multiple window pages can share the same target (see bug 878395).
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.