Visitar URL original
Make ErrorConstructor more robust for DataCloneError (v1.7.4) · Issue #16707 · angular/angular.js · GitHub
Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Make ErrorConstructor more robust for DataCloneError (v1.7.4) #16707

Description

@binarykitchen

Seeing lots of those errors in my app:

Uncaught DataCloneError: Failed to execute 'postMessage' on 'Window': function (){var paramPrefix,i,code=arguments[0],template=arguments[1],message=\"[\"+(module?module+\":\":\"\")+code+\"...<omitted>...)} could not be cloned.

caused from user agent facebookexternalhit. After some examinations it turns out to happen inside the ErrorConstructor of v1.7.4 itself.

I think the constructor itself should be more stable when an error inside occurs, probably with a try-catch block. My guess is the toDebugString() fn which calls the serializeObject() fn where this happens, where a cloning attempt is made and fails.

There I would make the code more robust.

Activity

  1. gkalpak commented on Oct 1, 2018

    @gkalpak
    Member

    The ErrorConstructor is usually just the built-in Error constructor (so I doubt that's where the error happens). We need more info in order to understand the root cause of the problem and the most appropriate fix (although you are probably right that we should be more fault-tolerant inside toDebugString() anyway).

    Can you reliably reproduce the error? If so, it would be helpful to get more context about the actual error that is thrown.

  2. added this to the 1.7.x milestone on Oct 1, 2018
  3. binarykitchen commented on Oct 1, 2018

    @binarykitchen
    Author

    Well, since this only happens with the user agent facebookexternalhit, very hard to reproduce on my app with minified code.

    Already have invested almost one hour deciphering that and am 99% sure it's a problem in toDebugString and/or serializeObject ...

    Yes please, can you make it more fault tolerant pretty please? With more unit test coverages and try-catch blocks skipping the problematic values.

  4. gkalpak commented on Oct 2, 2018

    @gkalpak
    Member

    With AngularJS having entered its LTS period, I am a little reluctant to make a change in order to solve a problem we don't fully understand. It would be nice to get more info on this.

  5. petebacondarwin commented on Oct 10, 2018

    @petebacondarwin
    Contributor

    So it appears that something in your code is trying to pass the return value from a call to minerr (e.g. this function https://github.com/angular/angular.js/blob/master/src/minErr.js#L101) across a thread boundary (hence the postmessage). It is not related to the ErrorConstructor.

    This is not a scenario that AngularJS supports. If you could find exactly where this was happening we could look into it, but otherwise there is not much more we can do.

  6. binarykitchen commented on Oct 10, 2018

    @binarykitchen
    Author

    I hear you. Very difficult to debug or reproduce this scenario here. More weird is that this only happens with the facebookexternalhit user agent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions