IE8 native JSON.parse bug causes stack overflow

前端 未结 6 1194
生来不讨喜
生来不讨喜 2020-12-13 00:45

TL;DR: Adding any non-built-in functions to Array.prototype AND Function.prototype will cause the IE8 native JSON parser to get a stack overflow when parsing any JSO

6条回答
  •  再見小時候
    2020-12-13 01:02

    An extension of this issue (which is still present in IE9), is the native JSON.stringify function crashes IE when there is:

    1. a large object graph
    2. the object graph references jQuery 'data' objects.
    3. the object graph is circular.

    We're unsure which specific point causes the crash.

    Our workaround in this instance was to use a replacer function on the stringify function to return null on a particular object property and stop the object graph from being traversed.

提交回复
热议问题