Skip to content

The global browser can be overriden by DOM elements #720

@ouuan

Description

@ouuan

The issue fixed in #153 was introduced again in #582. Now the browser global can be overriden by a DOM element if there is either browser.runtime.id or exports:

if (!(globalThis.browser && globalThis.browser.runtime && globalThis.browser.runtime.id)) {

<form id="browser"></form>
<form id="browser" name="runtime"></form>

} else if (typeof exports !== "undefined") {

<form id="exports">

This can be fixed by checking that browser.runtime.id and exports are of the correct type, e.g. are not instances of HTMLElement or HTMLCollection.

Credit: discovered by me and skadi.

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