为什么这个 chrome 内容脚本没有被注入?

why is this chrome content-script not getting injected?

我正在检测创建的​​书签后尝试注入代码。

**manifest.json**

"manifest_version": 3,
  "background": {
  "service_worker": "background.js"
  },
  "permissions": ["storage", "activeTab", 
  "scripting","pageCapture","bookmarks","tabs","contextMenus"],
  "host_permissions": ["http://localhost/*", "*://*/*"],

**Background.js**

function greeting() {
  console.log("dynamic content script injected");
  document.body.style.backgroundColor = 'orange';
}

chrome.bookmarks.onCreated.addListener( () => {
  console.log("Bookmark created");

      chrome.tabs.query({currentWindow: true, active: true}), function (tabArray) {
      chrome.scripting.executeScript(
      {
        target: {tabId: tabArray[tabArray.length - 1].id},
        function : greeting
      })
  }
  
});

函数“greeting”永远不会执行。我也在 chrome.tabs.query() 中尝试了 lastFocusedWindow: true 属性 但它仍然没有 运行.

这只是一个错字。我太依赖自动完成了。

感谢 wOxxOm 指出。

You have a typo: the ) before function(abArray) should be moved after the lone closing } below.