Advertisement
Guest User

Untitled

a guest
Jan 19th, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. asyncTest('should not wait if scripts are added recursively', function () {
  2. var barrier = new ScriptExecutionBarrier();
  3.  
  4. var scriptCounter = 0;
  5.  
  6. window.stopAppending = false;
  7. window.appendCustomScript = function () {
  8. var script = document.createElement('script');
  9. var scriptContent = encodeURIComponent('if(!window.stopAppending)window.appendCustomScript()');
  10.  
  11. script.src = '/xhr-test/' + scriptCounter + '?expectedResponse=' + scriptContent;
  12. scriptCounter++;
  13.  
  14. document.body.appendChild(script);
  15. };
  16.  
  17. barrier.SCRIPT_LOADING_TIMEOUT = 500;
  18. barrier.BARRIER_TIMEOUT = 500;
  19.  
  20. window.appendCustomScript();
  21.  
  22. barrier
  23. .wait()
  24. .then(function () {
  25. window.stopAppending = true;
  26.  
  27. // NOTE: if barrier timeout doesn't work test fails with timeout
  28. expect(0);
  29. start();
  30. });
  31. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement