MCPcopy Create free account
hub / github.com/ampproject/amphtml / updateTabStatus

Function updateTabStatus

validator/js/chromeextension/worker.js:250–270  ·  view source on GitHub ↗

* Updates the tabId's extension icon and badge. * * @param {number} tabId ID of a tab. * @param {string} iconPrefix File name prefix of the icon to use. * @param {string} title Title to display in extension icon hover. * @param {string} text Text to display in badge. * @param {string} color Ba

(tabId, iconPrefix, title, text, color)

Source from the content-addressed store, hash-verified

248 * @param {string} color Background color for badge.
249 */
250function updateTabStatus(tabId, iconPrefix, title, text, color) {
251 // Verify tab still exists
252 chrome.tabs.get(tabId, () => {
253 if (!chrome.runtime.lastError) {
254 chrome.action.setIcon({
255 path: {
256 '19': iconPrefix + '-128.png',
257 '38': iconPrefix + '-38.png',
258 },
259 tabId,
260 });
261 if (title !== undefined)
262 {chrome.action.setTitle({title, tabId});}
263 if (text !== undefined)
264 {chrome.action.setBadgeText({text, tabId});}
265 if (color !== undefined)
266 {chrome.action.setBadgeBackgroundColor(
267 {color: hex2rgba(color), tabId});}
268 }
269 });
270}
271
272/**
273 * Fetches the content of the tab's URL and validates it. Then updates the

Callers 6

handleAmpCacheFunction · 0.85
handleAmpDevModeFunction · 0.85
handleAmpFailFunction · 0.85
handleAmpLinkFunction · 0.85
handleAmpPassFunction · 0.85

Calls 2

hex2rgbaFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected