Socket
Socket
Sign inDemoInstall

jsdom

Package Overview
Dependencies
111
Maintainers
6
Versions
258
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 18.0.1 to 18.1.0

lib/jsdom/living/helpers/page-transition-event.js

11

lib/jsdom/browser/Window.js

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

const OnErrorEventHandlerNonNull = require("../living/generated/OnErrorEventHandlerNonNull");
const PageTransitionEvent = require("../living/generated/PageTransitionEvent");
const { fireAPageTransitionEvent } = require("../living/helpers/page-transition-event");
const namedPropertiesWindow = require("../living/named-properties-window");

@@ -909,13 +909,12 @@ const postMessage = require("../living/post-message");

const documentImpl = idlUtils.implForWrapper(window._document);
if (window.document.readyState === "complete") {
fireAnEvent("load", window, undefined, {}, documentImpl);
fireAnEvent("load", window, undefined, {}, true);
} else {
window.document.addEventListener("load", () => {
fireAnEvent("load", window, undefined, {}, documentImpl);
fireAnEvent("load", window, undefined, {}, true);
const documentImpl = idlUtils.implForWrapper(window._document);
if (!documentImpl._pageShowingFlag) {
documentImpl._pageShowingFlag = true;
fireAnEvent("pageshow", window, PageTransitionEvent, { persisted: false }, documentImpl);
fireAPageTransitionEvent("pageshow", window, false);
}

@@ -922,0 +921,0 @@ });

@@ -10,4 +10,4 @@ "use strict";

abort() {
this.signal._signalAbort();
abort(reason) {
this.signal._signalAbort(reason);
}

@@ -14,0 +14,0 @@ }

@@ -7,2 +7,3 @@ "use strict";

const AbortSignal = require("../generated/AbortSignal");
const DOMException = require("domexception/webidl2js-wrapper");

@@ -16,18 +17,31 @@ class AbortSignalImpl extends EventTargetImpl {

this.aborted = false;
this.reason = undefined;
this.abortAlgorithms = new Set();
}
static abort(globalObject) {
get aborted() {
return this.reason !== undefined;
}
static abort(globalObject, reason) {
const abortSignal = AbortSignal.createImpl(globalObject, []);
abortSignal.aborted = true;
if (reason !== undefined) {
abortSignal.reason = reason;
} else {
abortSignal.reason = DOMException.create(globalObject, ["The operation was aborted.", "AbortError"]);
}
return abortSignal;
}
_signalAbort() {
_signalAbort(reason) {
if (this.aborted) {
return;
}
this.aborted = true;
if (reason !== undefined) {
this.reason = reason;
} else {
this.reason = DOMException.create(this._globalObject, ["The operation was aborted.", "AbortError"]);
}
for (const algorithm of this.abortAlgorithms) {

@@ -34,0 +48,0 @@ algorithm();

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

// legacyOutputDidListenersThrowFlag optional parameter is not necessary here since it is only used by indexDB.
_dispatch(eventImpl, targetOverride /* , legacyOutputDidListenersThrowFlag */) {
_dispatch(eventImpl, legacyTargetOverrideFlag /* , legacyOutputDidListenersThrowFlag */) {
let targetImpl = this;

@@ -112,3 +112,5 @@ let clearTargets = false;

targetOverride = targetOverride || targetImpl;
const targetOverride = legacyTargetOverrideFlag ?
idlUtils.implForWrapper(targetImpl._globalObject._document) :
targetImpl;
let relatedTarget = retarget(eventImpl.relatedTarget, targetImpl);

@@ -115,0 +117,0 @@

@@ -24,2 +24,7 @@ "use strict";

// https://fetch.spec.whatwg.org/#concept-header-value-normalize
function normalizeValue(potentialValue) {
return potentialValue.replace(/^[\n\r\t ]+|[\n\r\t ]+$/g, "");
}
class HeadersImpl {

@@ -65,3 +70,3 @@ constructor(globalObject, args) {

append(name, value) {
value = value.trim();
value = normalizeValue(value);
assertName(name);

@@ -102,3 +107,3 @@ assertValue(value);

set(name, value) {
value = value.trim();
value = normalizeValue(value);
assertName(name);

@@ -105,0 +110,0 @@ assertValue(value);

@@ -101,4 +101,14 @@ "use strict";

}
return esValue[implSymbol].abort();
const args = [];
{
let curArg = arguments[0];
if (curArg !== undefined) {
curArg = conversions["any"](curArg, {
context: "Failed to execute 'abort' on 'AbortController': parameter 1",
globals: globalObject
});
}
args.push(curArg);
}
return esValue[implSymbol].abort(...args);
}

@@ -105,0 +115,0 @@

@@ -110,2 +110,14 @@ "use strict";

get reason() {
const esValue = this !== null && this !== undefined ? this : globalObject;
if (!exports.is(esValue)) {
throw new globalObject.TypeError(
"'get reason' called on an object that is not a valid instance of AbortSignal."
);
}
return esValue[implSymbol]["reason"];
}
get onabort() {

@@ -143,3 +155,14 @@ const esValue = this !== null && this !== undefined ? this : globalObject;

static abort() {
return utils.tryWrapperForImpl(Impl.implementation.abort(globalObject));
const args = [];
{
let curArg = arguments[0];
if (curArg !== undefined) {
curArg = conversions["any"](curArg, {
context: "Failed to execute 'abort' on 'AbortSignal': parameter 1",
globals: globalObject
});
}
args.push(curArg);
}
return utils.tryWrapperForImpl(Impl.implementation.abort(globalObject, ...args));
}

@@ -149,2 +172,3 @@ }

aborted: { enumerable: true },
reason: { enumerable: true },
onabort: { enumerable: true },

@@ -151,0 +175,0 @@ [Symbol.toStringTag]: { value: "AbortSignal", configurable: true }

{
"name": "jsdom",
"version": "18.0.1",
"version": "18.1.0",
"description": "A JavaScript implementation of many web standards",

@@ -5,0 +5,0 @@ "keywords": [

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc