Multiple triggers of chrome.tabs.onUpdated in Google Docs

I am developing a Chrome extension that interacts with Google Docs, and I’ve run into a problem where the chrome.tabs.onUpdated event fires several times for the same tab. Despite having configured info.status to complete and all_frames to false in the manifest file, this unexpected firing is leading to performance issues. Below is the pertinent code from my background.js file:

chrome.tabs.onUpdated.addListener(async (tabId, info, tab) => {
    if (info.status === "complete" && tab.status === "complete"){
        console.log('Tab updated');
    }
});

And here is the relevant section of my manifest.json:

{
    "matches": ["*://docs.google.com/document/*"],
    "js": ["gdocs.js"],
    "all_frames": false,
    "run_at": "document_end"
}

I believed that setting all_frames to false would limit the event to the main frame only. I also verify that tab.status is complete before executing any further logic. Could anyone offer assistance with this issue?

Hi! Google’s docs way complex, often sending background updates. Try throttling the event handler using a setTimeout to ensure your logic runs once per xhr session. You might also want to consider debouncing or adding a simple hasUpdated flag to track updates.