function loadImageAndRemoveTab() {
    const hostname = 'slow-resourcetype-image-remove-tab';
    const url = getSlowURL(hostname);
    const mainUrl = getServerURL('empty.html', hostname);

    expect([
      { label: 'onBeforeRequest',
        event: 'onBeforeRequest',
        details: {
          type: 'image',
          url,
          frameUrl: 'unknown frame URL',
        }
      },
      { label: 'onBeforeSendHeaders',
        event: 'onBeforeSendHeaders',
        details: {
          type: 'image',
          url,
        },
      },
      { label: 'onSendHeaders',
        event: 'onSendHeaders',
        details: {
          type: 'image',
          url,
        },
      },
      { label: 'onErrorOccurred',
        event: 'onErrorOccurred',
        details: {
          type: 'image',
          url,
          fromCache: false,
          error: 'net::ERR_ABORTED',
        },
      }],
      [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
        'onErrorOccurred']],
      {
        urls: ['<all_urls>'],
        types: ['image'],
      });

    var callbackDone = chrome.test.callbackAdded();

    waitUntilSendHeaders('image', url, function() {
      // Cancels load and triggers onErrorOccurred.
      chrome.tabs.remove(tabId, callbackDone);
    }),

    navigateAndWait(mainUrl, function() {
      chrome.tabs.executeScript(tabId, {
        code: `var img = new Image(); img.src = '${url}';`
      });
    });
  }
// Load a slow image in the main frame and close the tab.
Load a slow image in the main frame and close the tab.
Load a slow image in the main frame and close the tab .
function loadImageAndRemoveTab() {
    const hostname = 'slow-resourcetype-image-remove-tab';
    const url = getSlowURL(hostname);
    const mainUrl = getServerURL('empty.html', hostname);
    expect([
      { label: 'onBeforeRequest',
        event: 'onBeforeRequest',
        details: {
          type: 'image',
          url,
          frameUrl: 'unknown frame URL',
        }
      },
      { label: 'onBeforeSendHeaders',
        event: 'onBeforeSendHeaders',
        details: {
          type: 'image',
          url,
        },
      },
      { label: 'onSendHeaders',
        event: 'onSendHeaders',
        details: {
          type: 'image',
          url,
        },
      },
      { label: 'onErrorOccurred',
        event: 'onErrorOccurred',
        details: {
          type: 'image',
          url,
          fromCache: false,
          error: 'net::ERR_ABORTED',
        },
      }],
      [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
        'onErrorOccurred']],
      {
        urls: ['<all_urls>'],
        types: ['image'],
      });
    var callbackDone = chrome.test.callbackAdded();
    waitUntilSendHeaders('image', url, function() {
      chrome.tabs.remove(tabId, callbackDone);
    }),
    navigateAndWait(mainUrl, function() {
      chrome.tabs.executeScript(tabId, {
        code: `var img = new Image(); img.src = '${url}';`
      });
    });
  }
function loadImageAndRemoveTab ( ) { const hostname = 'slow-resourcetype-image-remove-tab' ; const url = getSlowURL ( hostname ) ; const mainUrl = getServerURL ( 'empty.html' , hostname ) ; expect ( [ { label : 'onBeforeRequest' , event : 'onBeforeRequest' , details : { type : 'image' , url , frameUrl : 'unknown frame URL' , } } , { label : 'onBeforeSendHeaders' , event : 'onBeforeSendHeaders' , details : { type : 'image' , url , } , } , { label : 'onSendHeaders' , event : 'onSendHeaders' , details : { type : 'image' , url , } , } , { label : 'onErrorOccurred' , event : 'onErrorOccurred' , details : { type : 'image' , url , fromCache : false , error : 'net::ERR_ABORTED' , } , } ] , [ [ 'onBeforeRequest' , 'onBeforeSendHeaders' , 'onSendHeaders' , 'onErrorOccurred' ] ] , { urls : [ '<all_urls>' ] , types : [ 'image' ] , } ) ; var callbackDone = chrome . test . callbackAdded ( ) ; waitUntilSendHeaders ( 'image' , url , function ( ) { chrome . tabs . remove ( tabId , callbackDone ) ; } ) , navigateAndWait ( mainUrl , function ( ) { chrome . tabs . executeScript ( tabId , { code : ` ${ url } ` } ) ; } ) ; }
Load a slow image in the main frame and close the tab.
Load a slow image in the main frame and close the tab .
// Cancels load and triggers onErrorOccurred.