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

happy-dom

Package Overview
Dependencies
Maintainers
1
Versions
593
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

happy-dom - npm Package Compare versions

Comparing version 0.2.8 to 0.2.9

2

lib/AsyncWindow.d.ts

@@ -10,3 +10,3 @@ /// <reference types="node" />

private asyncTaskCount;
private hasAsyncError;
private asyncError;
private asyncTimeout;

@@ -13,0 +13,0 @@ private asyncPromises;

@@ -68,3 +68,3 @@ "use strict";

_this.asyncTaskCount = 0;
_this.hasAsyncError = false;
_this.asyncError = null;
_this.asyncTimeout = null;

@@ -178,3 +178,3 @@ _this.asyncPromises = [];

_this.asyncPromises.push({ resolve: resolve, reject: reject });
_this.asyncTimeout = setTimeout(function () { return _this.endAsyncTask(); }, 0);
_this.endAsyncTask();
})];

@@ -190,3 +190,3 @@ });

this.isDisposed = true;
this.hasAsyncError = false;
this.asyncError = null;
this.asyncTaskCount = 0;

@@ -208,20 +208,28 @@ this.asyncPromises = [];

AsyncWindow.prototype.endAsyncTask = function (error) {
var _this = this;
if (!this.isDisposed) {
var promises = this.asyncPromises;
this.asyncTaskCount--;
if (error) {
this.hasAsyncError = true;
this.asyncPromises = [];
for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {
var promise = promises_1[_i];
promise.reject(error);
}
if (error && !this.asyncError) {
this.asyncError = error;
}
else if (this.asyncTaskCount === 0 && !this.hasAsyncError) {
this.asyncPromises = [];
for (var _a = 0, promises_2 = promises; _a < promises_2.length; _a++) {
var promise = promises_2[_a];
promise.resolve();
clearTimeout(this.asyncTimeout);
this.asyncTimeout = setTimeout(function () {
if (!_this.isDisposed) {
var promises = _this.asyncPromises;
if (_this.asyncError) {
_this.asyncPromises = [];
for (var _i = 0, promises_1 = promises; _i < promises_1.length; _i++) {
var promise = promises_1[_i];
promise.reject(_this.asyncError);
}
}
else if (_this.asyncTaskCount === 0) {
_this.asyncPromises = [];
for (var _a = 0, promises_2 = promises; _a < promises_2.length; _a++) {
var promise = promises_2[_a];
promise.resolve();
}
}
}
}
}, 0);
}

@@ -228,0 +236,0 @@ };

{
"name": "happy-dom",
"version": "0.2.8",
"version": "0.2.9",
"license": "MIT",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/capricorn86/happy-dom#readme",

@@ -13,3 +13,3 @@ import NodeFetch from 'node-fetch';

private asyncTaskCount: number = 0;
private hasAsyncError: boolean = false;
private asyncError: Error = null;
private asyncTimeout: NodeJS.Timeout = null;

@@ -117,3 +117,3 @@ private asyncPromises: { resolve: () => void; reject: (error: Error) => void }[] = [];

this.asyncPromises.push({ resolve, reject });
this.asyncTimeout = setTimeout(() => this.endAsyncTask(), 0);
this.endAsyncTask();
});

@@ -128,3 +128,3 @@ }

this.isDisposed = true;
this.hasAsyncError = false;
this.asyncError = null;
this.asyncTaskCount = 0;

@@ -149,20 +149,28 @@ this.asyncPromises = [];

if (!this.isDisposed) {
const promises = this.asyncPromises;
this.asyncTaskCount--;
if (error) {
this.hasAsyncError = true;
this.asyncPromises = [];
for (const promise of promises) {
promise.reject(error);
if (error && !this.asyncError) {
this.asyncError = error;
}
clearTimeout(this.asyncTimeout);
this.asyncTimeout = setTimeout(() => {
if (!this.isDisposed) {
const promises = this.asyncPromises;
if (this.asyncError) {
this.asyncPromises = [];
for (const promise of promises) {
promise.reject(this.asyncError);
}
} else if (this.asyncTaskCount === 0) {
this.asyncPromises = [];
for (const promise of promises) {
promise.resolve();
}
}
}
} else if (this.asyncTaskCount === 0 && !this.hasAsyncError) {
this.asyncPromises = [];
for (const promise of promises) {
promise.resolve();
}
}
}, 0);
}
}
}

Sorry, the diff of this file is not supported yet

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