From 9b6b0f39f071df46205508ae711a0c6e95b3c420 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABl=20M=C3=A9tais?= Date: Wed, 6 Aug 2014 18:25:52 +0200 Subject: [PATCH] Add a line when a JS file is loaded --- .../modules/jsFileLoadYLT/jsFileLoadYLT.js | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 phantomas_custom/modules/jsFileLoadYLT/jsFileLoadYLT.js diff --git a/phantomas_custom/modules/jsFileLoadYLT/jsFileLoadYLT.js b/phantomas_custom/modules/jsFileLoadYLT/jsFileLoadYLT.js new file mode 100644 index 0000000..50ad55e --- /dev/null +++ b/phantomas_custom/modules/jsFileLoadYLT/jsFileLoadYLT.js @@ -0,0 +1,29 @@ +/** + * Meters the number of page errors, and provides traces as offenders for "jsErrors" metric + */ +'use strict'; + +exports.version = '0.0'; + +exports.module = function(phantomas) { + + phantomas.on('recv', function(entry, res) { + if (!entry.isJS) { + return; + } + + // Yeah, this is weird, i'm sending the information back to the browser... + phantomas.evaluate(function(url) { + (function(phantomas) { + + phantomas.pushContext({ + type: 'script loaded', + callDetails: { + arguments: [url] + } + }); + + })(window.__phantomas); + }, entry.url); + }); +};