-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #505 from MindscapeHQ/ht/fix-recursive-loop-on-umd…
…-init Fix infinite recursive loop on UMD module init
- Loading branch information
Showing
9 changed files
with
124 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "raygun4js", | ||
"version": "2.27.2", | ||
"version": "2.27.3", | ||
"homepage": "http://raygun.com", | ||
"authors": [ | ||
"Mindscape <[email protected]>" | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Raygun4JS with V2 API</title> | ||
<script src="/fixtures/common/instrumentXHRs.js"></script> | ||
<script> | ||
document.onreadystatechange = () => { | ||
if (document.readyState === "complete") { | ||
rg4js('apiKey', 'abcdef=='); //this should trigger an infinite loop | ||
rg4js('enableCrashReporting', false); | ||
rg4js('enablePulse', true); | ||
} | ||
}; | ||
</script> | ||
<script src="/dist/raygun.umd.min.js"></script> | ||
</head> | ||
|
||
<body> | ||
<script type="text/javascript"> | ||
|
||
setTimeout(function () { | ||
rg4js('trackEvent', { | ||
type: 'customTiming', | ||
name: 'timingName', | ||
duration: 100, | ||
}); | ||
}, 250); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
var webdriverio = require('webdriverio'); | ||
|
||
|
||
|
||
|
||
/** | ||
* What does this test do? | ||
* When using the UMD module, if raygun events are fired (e.g. rg4js('send', ...)) | ||
* before raygun is fully loaded they are stored in an object on the window. | ||
* When Raygun loads these are then processed. | ||
* However a bug was found where we were assuming raygun was loaded when | ||
* `document.readyState === complete` but it is not loaded until slightly | ||
* after when the `load` event is fired. This means that if a rayugn event | ||
* is processed in this gap an infinite loop can be caused. | ||
* This test ensures graceful handling of this situation | ||
*/ | ||
describe("UMD Infinite loop test", function() { | ||
beforeEach(async function() { | ||
/** | ||
* Clears the session between tests to ensure | ||
* that the sessionstart event is always fired | ||
*/ | ||
await browser.reloadSession(); | ||
}); | ||
|
||
describe('test infinite loop is not caused', function() { | ||
beforeEach(async function() { | ||
await browser.url('http://localhost:4567/fixtures/v2/UMDInfiniteLoop.html'); | ||
await browser.pause(1000); | ||
}); | ||
|
||
it('succesfully sends the event', async function() { | ||
var customTimingData = await browser.execute(function() { | ||
console.log(window.__requestPayloads) | ||
return window.__requestPayloads[2]; | ||
}); | ||
console.log(customTimingData.eventData[0].data); | ||
expect(JSON.parse(customTimingData.eventData[0].data)[0]).toEqual({ | ||
timing: { | ||
a: "0.00", | ||
du: "100.00", | ||
t: "t" | ||
}, | ||
url: "timingName", | ||
parentResource: { url: 'http://localhost:4567/fixtures/v2/UMDInfiniteLoop.html', type: 'p' } | ||
}); | ||
}); | ||
}); | ||
}); |