title: Adding a delay in FiddlerScript
body: <p>I would like to add a uniform delay to responses in all sessions that Fiddler intercepts. The use of <code>"response-trickle-delay"</code> is unacceptable, since that doesn't actually introduce a uniform delay, but rather delays each 1KB of transfer (which simulates low bandwidth, rather than high latency).</p>
  
  <p>The only reference I could find was <a href="https://pholpar.wordpress.com/2012/07/15/emulating-slow-server-response-times-using-fiddler/" rel="noreferrer">here</a>, which used the following atrocity (DO NOT USE!):</p>
  
  <pre><code>static function wait(msecs) 
  { 
  var start = new Date().getTime(); 
  var cur = start; 
  while(cur – start &lt; msecs) 
  { 
  cur = new Date().getTime(); 
  } 
  }
  </code></pre>
  
  <p>and <code>wait(5000);</code> is inserted into <code>OnBeforeResponse</code>.</p>
  
  <p>As expected, it locked up my computer and started overheating my CPU and I had to quit Fiddler. </p>
  
  <p>I'm looking for something:</p>
  
  <ul>
  <li>Less stupid, and</li>
  <li>As simple as possible.</li>
  </ul>
  
  <p>It looks like FiddlerScript is written in JScript.NET, and from what I gather there is a <code>setTimeout()</code> function, but I'm having trouble calling it (and I don't know JavaScript or .NET at all). Here is my <code>OnBeforeResponse</code>:</p>
  
  <pre><code>static function OnBeforeResponse(oSession: Session) {
      if (m_Hide304s &amp;&amp; oSession.responseCode == 304) {
          oSession["ui-hide"] = "true";
      }
      setTimeout(function(){},1000);
  }
  </code></pre>
  
  <p>It just gives a syntax error at the <code>setTimeout</code> line. Can <code>setTimeout()</code> be used from a FiddlerScript to introduce uniform delay?</p>