/**
 * Meters number of invocations of window.alert, window.confirm, and
 * window.prompt.
 */

exports.version = '0.1';

exports.module = function(phantomas) {
	var alerts = [],
		confirms = [],
		prompts = [];

	phantomas.on('alert', function(msg) {
		alerts.push(msg);
	});

	phantomas.on('confirm', function(msg) {
		confirms.push(msg);
	});

	phantomas.on('prompt', function(msg) {
		prompts.push(msg);
	});

	phantomas.on('report', function() {
		phantomas.setMetric('windowAlerts', alerts.length);
		phantomas.setMetric('windowConfirms', confirms.length);
		phantomas.setMetric('windowPrompts', prompts.length);

		notifyWhenPresent(alerts, 'alert');
		notifyWhenPresent(confirms, 'confirm');
		notifyWhenPresent(prompts, 'prompt');
	});

	function notifyWhenPresent(array, nameOfWindowFn) {
		var len = array.length;
		if (len > 0) {
			phantomas.addNotice('window.' + nameOfWindowFn + ' (' + len + '):');
			array.forEach(function(msg) {
				phantomas.addNotice(' ' + msg);
			});
			phantomas.addNotice(); // Extra Line
		}
	}
};

@@ -616,425 +616,12 @@
 h);%0A
-%0A%09%09notifyWhenPresent(alerts, 'alert');%0A%09%09notifyWhenPresent(confirms, 'confirm');%0A%09%09notifyWhenPresent(prompts, 'prompt');%0A%09%7D);%0A%0A%09function notifyWhenPresent(array, nameOfWindowFn) %7B%0A%09%09var len = array.length;%0A%09%09if (len %3E 0) %7B%0A%09%09%09phantomas.addNotice('window.' + nameOfWindowFn + ' (' + len + '):');%0A%09%09%09array.forEach(function(msg) %7B%0A%09%09%09%09phantomas.addNotice(' ' + msg);%0A%09%09%09%7D);%0A%09%09%09phantomas.addNotice(); // Extra Line%0A%09%09%7D%0A
 %09%7D
+);
 %0A%7D;%0A

Remove notices on window.* functions