mobx-devtools icon indicating copy to clipboard operation
mobx-devtools copied to clipboard

Changes tab, ObservableMap open error.

Open YuK1Game opened this issue 6 years ago • 2 comments

I use Changes tab and click to ObservableMap@5{...} +1 -1, not working.

chrome console error backend.js:4189 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.

YuK1Game avatar Dec 18 '18 05:12 YuK1Game

chrome console error backend.js:4189 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.

This is a known issue of using postMessage, see: https://stackoverflow.com/questions/52122011/failed-to-execute-postmessage-on-window-googletagmanager/52223341#52223341

The code of the extension should be changed to tackle this. If you want to try yourself a workaround, when this error appears in the console (Chrome):

backend.js:4189 Uncaught DOMException: Failed to execute 'postMessage' on 'Window': [object Object] could not be cloned.
    at Object.send (chrome-extension://pfgnfdagidkfgccljigdamigbcnndkod/backend.js:4189:14)
    at Bridge.flushBufferSlice (chrome-extension://pfgnfdagidkfgccljigdamigbcnndkod/backend.js:1045:18)
    at Bridge.flushBufferWhileIdle (chrome-extension://pfgnfdagidkfgccljigdamigbcnndkod/backend.js:1023:14)

click on the first line of the trace (backend.js) and you will be pointed to the source of the error.

Then you'll see the following lines:

    send: function send(data) {
      (0, _debugConnection2.default)('[BACKEND -> contentScript]', data);
      window.postMessage({ source: 'mobx-devtools-backend', payload: data, contentScriptId: contentScriptId, backendId: backendId }, '*');
    }

change them with the following:

    send: function send(data) {
      (0, _debugConnection2.default)('[BACKEND -> contentScript]', data);
      window.postMessage({ source: 'mobx-devtools-backend', payload: JSON.parse(JSON.stringify(data)), contentScriptId: contentScriptId, backendId: backendId }, '*');
    }

then save the file. The error will disappear until you refresh your browser.

I don't know if this project is maintained anymore, maybe I'll open a PR with a fix in the future..

pfurini avatar Mar 06 '19 11:03 pfurini

Works for me, how to reproduce it? Screen Shot 2019-03-09 at 16 28 48

andykog avatar Mar 09 '19 14:03 andykog