Chrome sendrequest error: TypeError: Converting circular structure to JSON

后端 未结 11 1056
醉梦人生
醉梦人生 2020-11-22 04:16

I\'ve got the following...

chrome.extension.sendRequest({
  req: \"getDocument\",
  docu: pagedoc,
  name: \'name\'
}, function(response){
  var efjs = respo         


        
11条回答
  •  悲哀的现实
    2020-11-22 04:58

    It means that the object you pass in the request (I guess it is pagedoc) has a circular reference, something like:

    var a = {};
    a.b = a;
    

    JSON.stringify cannot convert structures like this.

    N.B.: This would be the case with DOM nodes, which have circular references, even if they are not attached to the DOM tree. Each node has an ownerDocument which refers to document in most cases. document has a reference to the DOM tree at least through document.body and document.body.ownerDocument refers back to document again, which is only one of multiple circular references in the DOM tree.

提交回复
热议问题