Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

window.Function.constructor should be equal overriden window.Function #913

Closed
AlexanderMoskovkin opened this issue Nov 8, 2016 · 4 comments
Assignees
Labels
!IMPORTANT! STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Milestone

Comments

@AlexanderMoskovkin
Copy link
Contributor

page: http://todomvc.com/examples/humble
error: Uncaught Error: interface conversion: interface is map[string]interface {}, not func(...interface {}) *js.Object

reproduced in playground. Tested in Chrome but should be check in other browsers

@AlexanderMoskovkin
Copy link
Contributor Author

I'm working on this

@AlexanderMoskovkin
Copy link
Contributor Author

The problem appears because we override the window.Function object.
As a result the following script:

<script>
    var f = function () {
    };

    switch (f.constructor) {
        case Function:
            alert('OK');
            break;
        default:
            alert('FAIL');
    }
</script>

raises alert('OK') on the original page, but alert('FAIL') via playground.

As a workaround we can process a .constructor property and return an original Function object
/cc @churkin

@AlexanderMoskovkin
Copy link
Contributor Author

It seems I've found a fix for this, I'll create a pull request tomorrow

AlexanderMoskovkin added a commit to AlexanderMoskovkin/testcafe-hammerhead that referenced this issue Nov 10, 2016
@miherlosev miherlosev changed the title [todomvc] Js-error appears on the Humble demo page window.Function.constructor should be equal overriden window.Function Dec 2, 2016
AndreyBelym pushed a commit to AndreyBelym/testcafe-hammerhead that referenced this issue Feb 28, 2019
…ss#913) (DevExpress#929)

* the constructor field of a function should return wrapped Function object (closes DevExpress#913)

* linting fixed

* Update test name

* test refactoring
@lock
Copy link

lock bot commented Mar 28, 2019

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

@lock lock bot added the STATE: Auto-locked Issues that were automatically locked by the Lock bot label Mar 28, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Mar 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
!IMPORTANT! STATE: Auto-locked Issues that were automatically locked by the Lock bot TYPE: bug
Projects
None yet
Development

No branches or pull requests

1 participant