Skip to content

Target current tab from any iframe #72

@fregante

Description

@fregante

We have tabId: "this" for this purpose:

however it only works between extension pages because:

  • only extension pages can use chrome.tab without intermediary steps

  • the current logic only handles "this" by comparing the sender to the current context, but this could be trivially changed:

     on send:
     	if isContentScript && tabId === "this"
     		send to background
    
     on background receive:
     	if tabId === "this"
     		forward to this.trace[0].tab.id

    // Set "this" tab to the current tabId
    if (to.tabId === "this" && thisTarget.tabId === from.tab?.id) {
    to.tabId = thisTarget.tabId;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions