Match-id-b1a480e5c4932daff22eb8e301cc4434240bfdc5

This commit is contained in:
* 2022-04-28 10:20:35 +08:00 committed by *
parent 559038fe67
commit a54d90bc58
1 changed files with 2 additions and 1 deletions

View File

@ -16,7 +16,7 @@ chrome.runtime.onConnect.addListener(function (port) {
if (type === InitDevToolPageConnection) {
// 记录 panel 所在 tab 页的tabId如果已经记录了覆盖原有port因为原有port可能关闭了
// 可能这次是 panel 发起的重新建立请求
connections[data] = port;
connections[data] = port; // data 是 tabId 值,该值指当前浏览器分配给 web_page 的 id 值。是panel页面查询得到
passMessage = packagePayload({ type: RequestAllVNodeTreeInfos }, DevToolBackground);
} else {
passMessage = message;
@ -56,6 +56,7 @@ chrome.runtime.onMessage.addListener(function (message, sender, sendResponse) {
// Messages from content scripts should have sender.tab set
if (sender.tab) {
const tabId = sender.tab.id;
// 和 InitDevToolPageConnection 时得到的 tabId 值一致时,向指定的 panel 页面 port 发送消息
if (tabId in connections && checkMessage(message, DevToolContentScript)) {
changeSource(message, DevToolBackground);
connections[tabId].postMessage(message);