Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

karma-ie-launcher

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

karma-ie-launcher - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

98

index.js
var fs = require('fs');
var urlparse = require('url').parse;
var urlformat = require('url').format;
var exec = require('child_process').exec;
var IEBrowser = function(baseBrowserDecorator, args) {
var processName = 'iexplore.exe';
var IEBrowser = function(baseBrowserDecorator, logger, args) {
baseBrowserDecorator(this);
args = args || {};
var log = logger.create('launcher');
var flags = args.flags || [];
// Handle x-ua-compatible option:
//
// Usage :
// customLaunchers: {
// IE9: {
// base: 'IE',
// 'x-ua-compatible': 'IE=EmulateIE9'
// }
// }
//
// This is done by passing the option on the url, in response the Karma server will
// set the following meta in the page.
// <meta http-equiv="X-UA-Compatible" content="[VALUE]"/>
function handleXUaCompatible(args, urlObj) {
if (args['x-ua-compatible']) {
urlObj.query['x-ua-compatible'] = args['x-ua-compatible'];
}
}
// Spawning iexplore.exe spawns two processes (IE does that). The way karma kills the
// browser process (hard kill) leaves the other process in memory.
//
// The second process is created using command-line args like this:
// "C:\Program Files\Internet Explorer\iexplore.exe" SCODEF:2632 CREDAT:275457 /prefetch:2
// Where the SCODEF value is the pid of the 'original' process created by this launcher.
//
// This function kills any iexplore.exe process who's command line args match 'SCODEF:pid'.
// On IE11 this will kill the extra process. On older versions, no process will be found.
function killExtraIEProcess(pid, cb) {
var scodef = 'SCODEF:' + pid;
//wmic.exe : http://msdn.microsoft.com/en-us/library/aa394531(v=vs.85).aspx
var wmic = 'wmic.exe Path win32_Process ' +
'where "Name=\'' + processName + '\' and ' +
'CommandLine Like \'%' + scodef + '%\'" call Terminate';
exec(wmic, function(err) {
if (err) {
log.error('Killing extra IE process failed. ' + err);
} else {
log.debug('Killed extra IE process ' + pid);
}
cb();
});
}
this._getOptions = function(url) {
var urlObj = urlparse(url, true);
handleXUaCompatible(args, urlObj);
delete urlObj.search; //url.format does not want search attribute
url = urlformat(urlObj);
return [
'-extoff'
].concat(flags, [url]);
}
};
var baseOnProcessExit = this._onProcessExit;
this._onProcessExit = function(code, errorOutput) {
var pid = this._process.pid;
killExtraIEProcess(pid, function() {
baseOnProcessExit(code, errorOutput);
});
};
};
function getInternetExplorerExe() {
var suffix = '\\Internet Explorer\\iexplore.exe',
prefixes = [process.env['PROGRAMW6432'], process.env['PROGRAMFILES(X86)'], process.env['PROGRAMFILES']],
prefix, i;
var suffix = '\\Internet Explorer\\' + processName,
prefixes = [process.env['' + 'PROGRAMW6432'], // '' + ' trick to keep jscs happy
process.env['' + 'PROGRAMFILES(X86)'],
process.env['' + 'PROGRAMFILES']],
prefix, i;
for (i = 0; i < prefixes.length; i++) {
prefix = prefixes[i];
if (prefix && fs.existsSync(prefix + suffix)) {
return prefix + suffix;
}
for (i = 0; i < prefixes.length; i++) {
prefix = prefixes[i];
if (prefix && fs.existsSync(prefix + suffix)) {
return prefix + suffix;
}
}
throw new Error("Internet Explorer not found");
throw new Error('Internet Explorer not found');
}

@@ -39,5 +110,4 @@

IEBrowser.$inject = ['baseBrowserDecorator'];
IEBrowser.$inject = ['baseBrowserDecorator', 'logger', 'args'];
// PUBLISH DI MODULE

@@ -44,0 +114,0 @@ module.exports = {

8

package.json
{
"name": "karma-ie-launcher",
"version": "0.1.3",
"version": "0.1.4",
"description": "A Karma plugin. Launcher for Internet Explorer.",

@@ -28,5 +28,9 @@ "main": "index.js",

"grunt-npm": "~0.0.2",
"grunt-auto-release": "~0.0.2"
"grunt-auto-release": "~0.0.2",
"grunt-contrib-jshint": "~0.7.2",
"grunt-jscs-checker": "~0.4.0"
},
"contributors": [
"sylvain-hamel <sylvainhamel0@gmail.com>",
"Sylvain Hamel <sylvainhamel0@gmail.com>",
"Andreas Krummsdorf <a.krummsdorf@litixsoft.de>",

@@ -33,0 +37,0 @@ "Christopher Currie <ccurrie@impresys.com>"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc