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

async-listener

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-listener - npm Package Compare versions

Comparing version 0.4.4 to 0.4.5

62

glue.js

@@ -206,9 +206,2 @@ var wrap = require('shimmer').wrap;

/**
* The error handler in the error-checker for old Node must rethrow to give
* domains and other uncaughtException handlers a chance to fire, but there's
* nothing for the uncaughtException handler to do.
*/
var threw = false;
/**
* If an error handler in asyncWrap throws, the process must die. Under 0.8

@@ -227,7 +220,2 @@ * and earlier the only way to put a bullet through the head of the process

asyncCatcher = function uncaughtCatcher(er) {
if (threw) {
threw = false;
return;
}
// going down hard

@@ -278,2 +266,10 @@ if (errorThrew) throw er;

return function () {
/*jshint maxdepth:4*/
// after() handlers don't run if threw
var threw = false;
// ...unless the error is handled
var handled = false;
/* More than one listener can end up inside these closures, so save the

@@ -305,3 +301,3 @@ * current listeners on a stack.

catch (er) {
var handled = false;
threw = true;
for (var i = 0; i < length; ++i) {

@@ -320,23 +316,29 @@ var error = listeners[i].callbacks.error;

// back to the previous listener list on the stack
listeners = listenerStack.pop();
if (!handled) {
// having an uncaughtException handler here alters crash semantics
process.removeListener('uncaughtException', asyncCatcher);
process._originalNextTick(function () {
process.addListener('uncaughtException', asyncCatcher);
});
if (handled) return;
threw = true;
throw er;
throw er;
}
}
finally {
/*
* after handlers (not run if original throws)
*/
if (!threw || handled) {
inAsyncTick = true;
for (i = 0; i < length; ++i) {
var after = list[i].callbacks && list[i].callbacks.after;
if (typeof after === 'function') after(this, values[i], returned);
}
inAsyncTick = false;
}
/*
* after handlers (not run if original throws)
*/
inAsyncTick = true;
for (i = 0; i < length; ++i) {
var after = list[i].callbacks && list[i].callbacks.after;
if (typeof after === 'function') after(this, values[i], returned);
// back to the previous listener list on the stack
listeners = listenerStack.pop();
}
inAsyncTick = false;
// back to the previous listener list on the stack
listeners = listenerStack.pop();

@@ -348,3 +350,3 @@ return returned;

// will be the first to fire if async-listener is the first module loaded
process.on('uncaughtException', asyncCatcher);
process.addListener('uncaughtException', asyncCatcher);
}

@@ -351,0 +353,0 @@

@@ -90,2 +90,7 @@ 'use strict';

// need unwrapped nextTick for use within < 0.9 async error handling
if (!process._fatalException) {
process._originalNextTick = process.nextTick;
}
var processors = ['nextTick'];

@@ -92,0 +97,0 @@ if (process._nextDomainTick) processors.push('_nextDomainTick');

{
"name": "async-listener",
"version": "0.4.4",
"version": "0.4.5",
"description": "Polyfill exporting trevnorris's 0.11+ asyncListener API.",

@@ -33,3 +33,3 @@ "author": "Forrest L Norvell <ogd@aoaioxxysz.net>",

"dependencies": {
"shimmer": "~1"
"shimmer": "1.0.0"
},

@@ -36,0 +36,0 @@ "devDependencies": {

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