[mediacapture-region] [QUESTION] How to pass CropTarget to chrome extension service worker? (#75)

wlevchenko has just created a new issue for https://github.com/w3c/mediacapture-region:

== [QUESTION] How to pass CropTarget to chrome extension service worker?  ==
I am trying to receive cropTarget from the content script in the service worker. 

`
async function getCropTarget () {
  const element = document.getElementById('crop-area')
  const cropTarget = await window.CropTarget.fromElement(element)

  return cropTarget
}
(async () => {
  const tabId = await getTabId()
  if (tabId != null) {
    chrome.scripting
      .executeScript({
        target: { tabId },
        func: getCropTarget
      })
      .then(injectionResults => {
        console.log(injectionResults)
      })
  }
})()
`

But I just received a blank object.
![image](https://user-images.githubusercontent.com/38959370/218342895-92b9c2a9-aeec-4f44-b371-e645b88ea620.png)

Do I have any chance to do this?

Please view or discuss this issue at https://github.com/w3c/mediacapture-region/issues/75 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Sunday, 12 February 2023 23:10:21 UTC