pixiebrix-extension icon indicating copy to clipboard operation
pixiebrix-extension copied to clipboard

Content script remains "ready" even after unloading

Open fregante opened this issue 3 years ago • 1 comments

My logic might have been incorrect in:

  • https://github.com/pixiebrix/pixiebrix-extension/pull/3915

See:

https://github.com/pixiebrix/pixiebrix-extension/blob/e6644547df7a73dca2fe9600b18a2423e0fa2ce2/src/contentScript/ready.ts#L18-L32

Related

  • https://github.com/pixiebrix/pixiebrix-extension/issues/4189

In the situation described by that issue, our logic trips trips on the "ready" attribute and reports the content script as "ready" even if the new one hasn't been injected.

Solution

onContextInvalidated().then(() => {
  if body[READY_ATTRIBUTE] === currentUuid
    removeAttribute(body, READY_ATTRIBUTE) 
})

fregante avatar Aug 31 '22 08:08 fregante

Also related

  • https://github.com/pixiebrix/pixiebrix-extension/issues/4124

fregante avatar Aug 31 '22 08:08 fregante