Currently, if we want to toggle side panel's availability for a given tab id depending on its URL, we have to observe navigation in all tabs all the time, which frequently wakes up the background script, because we can't use url-filtering in webNavigation.onCommitted (or a filtered tabs.onUpdated in Firefox): it won't be triggered in the tab that previously contained our supported site example.com, but then was navigated to unsupported.com. We also can't register a listener for this tab id dynamically because such listeners won't wake up the background script.
Add URL patterns to chrome.sidePanel.setOptions()
It would be fully declarative, no need to observe navigation, here's some naming ideas:
Specifying documentId will automatically discard the specific options object when the page is destroyed on navigation or when the tab is closed, which will restore the global mode that we set in chrome.sidePanel.setOptions({enabled: false}). This solution can be used on top of the other solutions.
Currently, if we want to toggle side panel's availability for a given tab id depending on its URL, we have to observe navigation in all tabs all the time, which frequently wakes up the background script, because we can't use
url
-filtering in webNavigation.onCommitted (or a filtered tabs.onUpdated in Firefox): it won't be triggered in the tab that previously contained our supported site example.com, but then was navigated to unsupported.com. We also can't register a listener for this tab id dynamically because such listeners won't wake up the background script.Add URL patterns to chrome.sidePanel.setOptions()
It would be fully declarative, no need to observe navigation, here's some naming ideas:
urls
andexcludedUrls
matches
andexcludeMatches
documentUrlPatterns
similarly to chrome.contextMenus.create andexcludedDocumentUrlPatterns
Add documentId to chrome.sidePanel.setOptions()
Specifying
documentId
will automatically discard the specific options object when the page is destroyed on navigation or when the tab is closed, which will restore the global mode that we set inchrome.sidePanel.setOptions({enabled: false})
. This solution can be used on top of the other solutions.Add
SetSidePanel
action with parameters to declarativeContent APIA fully declarative method similar to SetIcon action. The declarativeContent API already supports advanced URL filtering.