Skip to content

Function.prototype.constructor is tamed in the host #52

@evanw

Description

@evanw

We recently ran into a problem with the Realm shim. We're injecting the shim into our page via <script src="..."> and then using the Realm object. However, that causes Function to be tamed in the host page, which we weren't expecting to happen.

Recently we upgraded selenium-webdriver, one of our 3rd-party dependencies, that apparently now calls Function("...") to eval something. When the Realm shim is loaded, that no longer works. We end up getting TypeError: Not available when we call their driver.executeScript API call.

Is there a reason to tame Function in the host environment? We think we can work around it on our end by loading the Realm shim into a same-origin iframe instead, but I wanted to file this issue with you in case this behavior was unintended. I imagine this behavior will also trip up others trying to use the shim in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions