chrome插件报错原因

时间:2022-08-25 17:48:59

Chrome报错提示Unchecked runtime.lastError: The message port closed before a response was received.

出错原因:

消息通信的问题,发送消息有个callback可以接收到收到消息的那方传递回来的消息,若是onMessage这方使用sendResponse而sendMessage这方没有写接收sendResponse的回调函数,就会报这样的错