discoveryjs/JsonDiscovery

JSON is not parsed successfully when downloading from some servers

Closed this issue · 0 comments

Based on discoveryjs/discovery#48

JsonDiscovery reads JSON from text nodes of a document (since there is no any other way to get a loading content). Our assumption was that a browser never changes a nodeValue of added text nodes on loading. As we found, that's not always true. In some conditions, like slow servers, a browser can append a new content to existing text node instead of creating a new one. As a result JsonDiscovery skips some part of content and fails with a parse error. This problem was hard to investigate since hard to reproduce a conditions. Since the root cause is clear now, a fix is coming.