Conversation
…or preliminary testing.
Recipe.min.js
Outdated
|
|
||
| var isExternalJSAndNotRecipeJS = (element.src !== undefined && element.src !== "" && !element.src.includes("Recipe.min.js")); | ||
| var xhr; | ||
| if (isExternalJSAndNotRecipeJS) |
There was a problem hiding this comment.
Isn't this making XHRs for every single element with a src? (An image from an img tag, for example, would be pulled down as part of this). I think you'll want to do a check for nodeName == "SCRIPT" here as well.
There was a problem hiding this comment.
Or move this into the block of code where we know for sure we have an external script
There was a problem hiding this comment.
Ah that's a good spot, I did not think of that case at all.
Recipe.min.js
Outdated
| } | ||
|
|
||
| if (nodeName === "SCRIPT") { | ||
| // if inline script. ensure that it's not our recipe script and look for string of interest |
There was a problem hiding this comment.
Update comment here since we know that it's not our recipe script at this point (iirc, the recipe script is injected as a script tag, right?)
There was a problem hiding this comment.
Yeah so I was finding that the recipe would check the recipe.min.js script before this check was put in. Will update the comments as a result of the changes. :)
Recipe.min.js
Outdated
| else if (isExternalJSAndNotRecipeJS) | ||
| { | ||
| if (xhr.status === 200 && xhr.responseText.indexOf(event) !== -1) { | ||
| var regex = new RegExp(event, 'g'); |
There was a problem hiding this comment.
NIT: Redundant code to the above. Could be pulled into a function.
There was a problem hiding this comment.
Yeah so I have packed all this stuff into the external script check if statement.
I have created a recipe which checks all places where we could find an instance of a pointerevent being listened to and counts each instance it finds to provide us with a running total.
The recipe checks for desired attributes on HTML elements, but this didn't work on the test page when I tried in Chrome, so could not test this, but it is possible to listen to events in this way.
Data collected using this recipe from a small set of URLs is here: https://cosmos15.osdinfra.net/cosmos/asimov.partner.osg/shares/asimov.prod.data/Public/Upload/DataGrid/WPT/Recipe-WORKER4/Recipe-WORKER4/1.0/2017/11/02/Recipe-WORKER4_2017_11_02_08-0.txt?property=info