Skip to content

Injected script: Avoid depending on globals #4687

Open
@inancgumus

Description

@inancgumus

What

The injected script should not depend on global JavaScript objects, such as Set and Map.

Why

Websites under test can overwrite these objects, leading to unexpected behavior.

Example

One website can overwrite Set with a simple function like this:

function Set() {
    ...
}

The injected script would then use the function above while it was expecting a native Set object here, leading to unexpected issues, like throwing exceptions when it shouldn't have.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions