Browser startup leak testing

Discussion in 'other software & services' started by TheWindBringeth, Oct 15, 2016.

  1. TheWindBringeth

    TheWindBringeth Registered Member

    Feb 29, 2012
    I created an aid to help test browser/extension/filterset combinations for leaks during browser startup. The more eyes on that subject the better. So I thought I would share this and create a thread in case someone has even better ideas and/or interesting findings. Below is the source for "IntervalLoader.html" and a "testimage.png" that it uses. The idea is simple:
    1. Configure your filters to block testimage.png loads and verify that is working
    2. Create a native shortcut to IntervalLoader.html
    3. Close your browser
    4. Click on the shortcut
    5. Browser starts and opens IntervalLoader.html. Which periodically inserts img elements into the page using unique src attributes of the form: testimage.png?number=N
    If the blocking mechanism was fully ready then no images should be requested/loaded. If it was not ready for a time then you should see 1+ images load successfully with the remaining ones blocked.

    The "Number 0" load doesn't require Javascript and is meant to happen as quickly as possible. After that the Javascript based interval loading occurs. The setInterval + time reporting approach isn't very accurate but it provides some information about when blocking kicked in.

    If you want to test file: scheme blocking you don't need a server. For other schemes you will want at least the test image on one. There's not much to the source so please review it and notice the variables you might want to adjust for testing. I would suggest monitoring traffic to confirm whether the img requests do/don't happen, testing all applicable schemes (including ftp), and testing under different load conditions. Have fun.

    <!doctype html>
    <meta charset="utf-8">
    <title>Interval Loader v1.1</title>
    <style type="text/css">
    table {border-collapse:collapse}
    td {border:1px solid black; height:32px; width:90px; text-align:center; white-space:nowrap;}
    <script type="text/javascript">
    var msStart     = new Date().getTime();
    var msInterval  = 100;
    var numElements = 50;
    var baseUrl     = "";  // You may want to change Number 0 src too
    var elementHtml = '<img id="i{#}" onload="result(1);" onerror="result(0);" height="16" width="16" alt="" src="' + baseUrl + 'testimage.png?number={#}" />';
    var numLoads    = 0;
    var numErrors   = 0;
    function result(loaded) {
      if(loaded) {
      else {
      if(numLoads + numErrors > numElements) {
        document.getElementById("results").innerHTML = "Loads: " + numLoads + ", Errors: " + numErrors;
    <p>Number 0: <img id="i0" onload="result(1);" onerror="result(0);" height="16" width="16" alt="" src="testimage.png?number=0" /></p>
    <script type="text/javascript">
    var number = 1;
    var timer;
    function insertElement() {
      document.getElementById('n' + number).innerHTML = number;
      document.getElementById('t' + number).innerHTML = new Date().getTime() - msStart + ' ms';
      document.getElementById('e' + number).innerHTML = elementHtml.replace(/\{#\}/g, number);
      if(number > numElements) {
    var html = '<p id="results">Loads: TBD, Errors: TBD</p>' +
               '<p>Interval: ' + msInterval + ' ms, Elements: ' + numElements + '</p>' +
               '<table><tr><td id="n0">Number</td><td id="t0">Time</td><td id="e0">Element</td></tr>';
    for(var i=1; i<=numElements; i++) {
       html += '<tr><td id="n' + i + '"></td><td id="t' + i + '"></td><td id="e' + i + '"></td></tr>';
    html += '</table>';
    timer = setInterval(function(){insertElement();}, msInterval);
    <noscript><p>Javascript is required for some functionality</p></noscript>
    testimage.png: testimage.png

    Note #1: I've seen some surprisingly erratic results. Such as several tests in a row where numerous requests leaked, followed by a couple of tests where none leaked, followed by tests where numerous requests leaked. A single tab open on a lightly loaded system that was disconnected from the Internet too. So you might want to run multiple tests and check for consistency.

    Note #2: After one test only image Number 1 was visible, the requests for Number 0 and Number 1 leaked, and the rest were blocked. For that test I was trying something on the server side and using a primitive script that handles one connection at a time. Everything but Number 1 went over the first connection. Number 1 used a second connection and was the last image to be returned. So we might have to consider even those aspects in some cases.

    Version 1.1 reports load/error counts
    Last edited: Oct 15, 2016