Skip to content

discoverProxyCandidates example code does not find all candidates correctly #1468

@Roaders

Description

@Roaders

Area of Issue

  • App Directory
  • API
  • Context Data
  • Intents
  • Desktop Agent Bridging
  • Use Cases
  • Other

Issue Description:

The sample code for discovering proxy candidates here:

https://fdc3.finos.org/docs/next/api/specs/webConnectionProtocol#12-desktop-agent-discovery

Is not complete. It does not add parents of the opener. These parent could also have openers of course. We actually need a recursive function I think. Something like:

export function discoverProxyCandidates(windowRef?: WindowProxy): WindowProxy[] {
    const candidates: WindowProxy[] = [];

    return addCandidates(windowRef ?? window, candidates);
}

function addCandidates(window: WindowProxy, candidates: WindowProxy[]): WindowProxy[] {
    candidates.push(window);

    if (window.opener != null) {
        addCandidates(window.opener, candidates);
    }

    if (window.parent != window) {
        addCandidates(window.parent, candidates);
    }

    return candidates;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions