Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Error caused by patched XMLHttpRequest #657

Closed
@devoto13

Description

@devoto13

We're using Angular with Zone.js 0.7.7 in the WebView in our mobile application. The problem is that quite often we get following error:

Error: macroTask 'XMLHttpRequest.send': can not transition to 'running', expecting state 'scheduled', was 'notScheduled'.

Real application is complex, but we managed to come up with a minimal reproduction. Basically it's mobile application, which does following sequence of actions in the infinite loop with 1s delay:

  1. Native code calls function in the WebView using stringByEvaluatingJavaScript function.
  2. This function sends HTTP request using XMLHttpRequest.

Once I scroll page up/down for 2-3 seconds, mentioned error occurs.

  • Error doesn't happen, when there is no scrolling done. So it seems to be related to some events happening in browser.
  • Error doesn't happen if we call function using setInterval() inside WebView instead of calling from native code. So it seems to be related to how WebView executes code from outside.
  • Error doesn't happen, when I add small synchronous computation in the ZoneTask._transitionTo() (O.o). Tried to log unique IDs for every task using approach described here. See commented code. This one looks like a complete magic to me.

I understand that this is still pretty complex reproduction, but I have no idea how to reduce it further. Do you have any ideas why it can happen and how can I debug it further? I can also provide any extra details if needed.

Project can be found here. To reproduce you need to open project with XCode, run it on device, connect with Safari remote debugging and scroll up/down for 2-3 seconds. Error is usually reproducible after couple of seconds of scrolling.

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