Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- asyncTest('should not wait if scripts are added recursively', function () {
- var barrier = new ScriptExecutionBarrier();
- var scriptCounter = 0;
- window.stopAppending = false;
- window.appendCustomScript = function () {
- var script = document.createElement('script');
- var scriptContent = encodeURIComponent('if(!window.stopAppending)window.appendCustomScript()');
- script.src = '/xhr-test/' + scriptCounter + '?expectedResponse=' + scriptContent;
- scriptCounter++;
- document.body.appendChild(script);
- };
- barrier.SCRIPT_LOADING_TIMEOUT = 500;
- barrier.BARRIER_TIMEOUT = 500;
- window.appendCustomScript();
- barrier
- .wait()
- .then(function () {
- window.stopAppending = true;
- // NOTE: if barrier timeout doesn't work test fails with timeout
- expect(0);
- start();
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement