function loadImageAndRemoveFrame() {
    const hostname = 'slow-resourcetype-image-remove-frame';
    const url = getSlowURL(hostname);
    const mainUrl = getPageWithFrame('empty.html', hostname);

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

    waitUntilSendHeaders('image', url, function() {
      // Cancels load and triggers onErrorOccurred.
      chrome.tabs.executeScript(tabId, {
        code: 'document.querySelector("iframe").remove();',
      });
    });

    navigateAndWait(mainUrl, function() {
      chrome.tabs.executeScript(tabId, {
        allFrames: true,
        code: `if (top !== window) {
          var img = new Image();
          img.src = '${url}';
        }`
      });
    });
  }
// Loads a slow image in an iframe and removes it.
Loads a slow image in an iframe and removes it.
Loads a slow image in an iframe and removes it .
function loadImageAndRemoveFrame() {
    const hostname = 'slow-resourcetype-image-remove-frame';
    const url = getSlowURL(hostname);
    const mainUrl = getPageWithFrame('empty.html', hostname);
    expect([
      { label: 'onBeforeRequest',
        event: 'onBeforeRequest',
        details: {
          type: 'image',
          url,
          frameId: 1,
          parentFrameId: 0,
          frameUrl: 'unknown frame URL',
        }
      },
      { label: 'onBeforeSendHeaders',
        event: 'onBeforeSendHeaders',
        details: {
          type: 'image',
          url,
          frameId: 1,
          parentFrameId: 0,
        },
      },
      { label: 'onSendHeaders',
        event: 'onSendHeaders',
        details: {
          type: 'image',
          url,
          frameId: 1,
          parentFrameId: 0,
        },
      },
      { label: 'onErrorOccurred',
        event: 'onErrorOccurred',
        details: {
          type: 'image',
          url,
          frameId: 1,
          parentFrameId: 0,
          fromCache: false,
          error: 'net::ERR_ABORTED',
        },
      }],
      [['onBeforeRequest', 'onBeforeSendHeaders', 'onSendHeaders',
        'onErrorOccurred']],
      {
        urls: ['<all_urls>'],
        types: ['image'],
      });
    waitUntilSendHeaders('image', url, function() {
      chrome.tabs.executeScript(tabId, {
        code: 'document.querySelector("iframe").remove();',
      });
    });
    navigateAndWait(mainUrl, function() {
      chrome.tabs.executeScript(tabId, {
        allFrames: true,
        code: `if (top !== window) {
          var img = new Image();
          img.src = '${url}';
        }`
      });
    });
  }
function loadImageAndRemoveFrame ( ) { const hostname = 'slow-resourcetype-image-remove-frame' ; const url = getSlowURL ( hostname ) ; const mainUrl = getPageWithFrame ( 'empty.html' , hostname ) ; expect ( [ { label : 'onBeforeRequest' , event : 'onBeforeRequest' , details : { type : 'image' , url , frameId : 1 , parentFrameId : 0 , frameUrl : 'unknown frame URL' , } } , { label : 'onBeforeSendHeaders' , event : 'onBeforeSendHeaders' , details : { type : 'image' , url , frameId : 1 , parentFrameId : 0 , } , } , { label : 'onSendHeaders' , event : 'onSendHeaders' , details : { type : 'image' , url , frameId : 1 , parentFrameId : 0 , } , } , { label : 'onErrorOccurred' , event : 'onErrorOccurred' , details : { type : 'image' , url , frameId : 1 , parentFrameId : 0 , fromCache : false , error : 'net::ERR_ABORTED' , } , } ] , [ [ 'onBeforeRequest' , 'onBeforeSendHeaders' , 'onSendHeaders' , 'onErrorOccurred' ] ] , { urls : [ '<all_urls>' ] , types : [ 'image' ] , } ) ; waitUntilSendHeaders ( 'image' , url , function ( ) { chrome . tabs . executeScript ( tabId , { code : 'document.querySelector("iframe").remove();' , } ) ; } ) ; navigateAndWait ( mainUrl , function ( ) { chrome . tabs . executeScript ( tabId , { allFrames : true , code : ` ${ url } ` } ) ; } ) ; }
Loads a slow image in an iframe and removes it.
Loads a slow image in an iframe and removes it .
// Cancels load and triggers onErrorOccurred.