validator/chromeextension/background.js
/**
 * Handles events for a specific tab and asks the tab's content_script to
 * determine AMP details about the page's content.
 *
 * @param {Tab} tab The Tab which triggered the event.
 */
Handles events for a specific tab and asks the tab's content_script to
determine AMP details about the page's content.

@param {Tab} tab The Tab which triggered the event.
Handles events for a specific tab and asks the tab ' s content_script to determine AMP details about the page ' s content . @param { Tab } tab The Tab which triggered the event .
function updateTab(tab) {
  if (!isForbiddenUrl(tab.url))
    chrome.tabs.sendMessage(
        tab.id, {'getAmpDetails': true}, function(response) {
          if (response && response.fromAmpCache && response.ampHref) {
            handleAmpCache(tab.id, response.ampHref);
          } else if (response && response.isAmp) {
            validateUrlFromTab(tab);
          } else if (response && !response.isAmp && response.ampHref) {
             handleAmpLink(tab.id, response.ampHref);
          }
        }
    );
}
function updateTab ( tab ) { if ( ! isForbiddenUrl ( tab . url ) ) chrome . tabs . sendMessage ( tab . id , { 'getAmpDetails' : true } , function ( response ) { if ( response && response . fromAmpCache && response . ampHref ) { handleAmpCache ( tab . id , response . ampHref ) ; } else if ( response && response . isAmp ) { validateUrlFromTab ( tab ) ; } else if ( response && ! response . isAmp && response . ampHref ) { handleAmpLink ( tab . id , response . ampHref ) ; } } ) ; }
Handles events for a specific tab and asks the tab's content_script to
 determine AMP details about the page's content.
Handles events for a specific tab and asks the tab ' s content_script to determine AMP details about the page ' s content .