happy-dom 7.7.1 → 7.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of happy-dom might be problematic. Click here for more details.

Files changed (109) hide show
  1. package/README.md +62 -27
  2. package/lib/async-task-manager/AsyncTaskManager.d.ts +3 -8
  3. package/lib/async-task-manager/AsyncTaskManager.js +21 -24
  4. package/lib/async-task-manager/AsyncTaskManager.js.map +1 -1
  5. package/lib/cookie/Cookie.d.ts +53 -0
  6. package/lib/cookie/Cookie.js +146 -0
  7. package/lib/cookie/Cookie.js.map +1 -0
  8. package/lib/cookie/CookieJar.d.ts +30 -0
  9. package/lib/cookie/CookieJar.js +84 -0
  10. package/lib/cookie/CookieJar.js.map +1 -0
  11. package/lib/event/IEventListener.d.ts +1 -1
  12. package/lib/exception/DOMExceptionNameEnum.d.ts +4 -1
  13. package/lib/exception/DOMExceptionNameEnum.js +3 -0
  14. package/lib/exception/DOMExceptionNameEnum.js.map +1 -1
  15. package/lib/fetch/FetchHandler.d.ts +3 -2
  16. package/lib/fetch/FetchHandler.js +31 -3
  17. package/lib/fetch/FetchHandler.js.map +1 -1
  18. package/lib/fetch/RequestInfo.d.ts +5 -0
  19. package/lib/fetch/RequestInfo.js +3 -0
  20. package/lib/fetch/RequestInfo.js.map +1 -0
  21. package/lib/fetch/ResourceFetchHandler.d.ts +2 -2
  22. package/lib/fetch/ResourceFetchHandler.js +9 -8
  23. package/lib/fetch/ResourceFetchHandler.js.map +1 -1
  24. package/lib/index.d.ts +1 -2
  25. package/lib/index.js +3 -4
  26. package/lib/index.js.map +1 -1
  27. package/lib/location/Location.d.ts +2 -1
  28. package/lib/location/Location.js +4 -7
  29. package/lib/location/Location.js.map +1 -1
  30. package/lib/location/RelativeURL.d.ts +3 -1
  31. package/lib/location/RelativeURL.js +2 -11
  32. package/lib/location/RelativeURL.js.map +1 -1
  33. package/lib/nodes/document/Document.d.ts +14 -3
  34. package/lib/nodes/document/Document.js +21 -6
  35. package/lib/nodes/document/Document.js.map +1 -1
  36. package/lib/nodes/document/IDocument.d.ts +2 -0
  37. package/lib/nodes/html-link-element/HTMLLinkElement.js +5 -2
  38. package/lib/nodes/html-link-element/HTMLLinkElement.js.map +1 -1
  39. package/lib/nodes/html-script-element/HTMLScriptElement.js +1 -1
  40. package/lib/nodes/html-script-element/HTMLScriptElement.js.map +1 -1
  41. package/lib/nodes/html-script-element/ScriptUtility.js +4 -0
  42. package/lib/nodes/html-script-element/ScriptUtility.js.map +1 -1
  43. package/lib/window/IHappyDOMSettings.d.ts +9 -0
  44. package/lib/window/IHappyDOMSettings.js +3 -0
  45. package/lib/window/IHappyDOMSettings.js.map +1 -0
  46. package/lib/window/IWindow.d.ts +15 -6
  47. package/lib/window/Window.d.ts +18 -3
  48. package/lib/window/Window.js +26 -4
  49. package/lib/window/Window.js.map +1 -1
  50. package/lib/xml-http-request/XMLHttpRequest.d.ts +196 -0
  51. package/lib/xml-http-request/XMLHttpRequest.js +777 -0
  52. package/lib/xml-http-request/XMLHttpRequest.js.map +1 -0
  53. package/lib/xml-http-request/XMLHttpRequestCertificate.d.ts +5 -0
  54. package/lib/xml-http-request/XMLHttpRequestCertificate.js +55 -0
  55. package/lib/xml-http-request/XMLHttpRequestCertificate.js.map +1 -0
  56. package/lib/xml-http-request/XMLHttpRequestEventTarget.d.ts +15 -0
  57. package/lib/xml-http-request/XMLHttpRequestEventTarget.js +23 -0
  58. package/lib/xml-http-request/XMLHttpRequestEventTarget.js.map +1 -0
  59. package/lib/xml-http-request/XMLHttpRequestReadyStateEnum.d.ts +8 -0
  60. package/lib/xml-http-request/XMLHttpRequestReadyStateEnum.js +12 -0
  61. package/lib/xml-http-request/XMLHttpRequestReadyStateEnum.js.map +1 -0
  62. package/lib/xml-http-request/XMLHttpRequestUpload.d.ts +6 -0
  63. package/lib/xml-http-request/XMLHttpRequestUpload.js +13 -0
  64. package/lib/xml-http-request/XMLHttpRequestUpload.js.map +1 -0
  65. package/lib/xml-http-request/XMLHttpResponseTypeEnum.d.ts +8 -0
  66. package/lib/xml-http-request/XMLHttpResponseTypeEnum.js +12 -0
  67. package/lib/xml-http-request/XMLHttpResponseTypeEnum.js.map +1 -0
  68. package/lib/xml-http-request/utilities/XMLHttpRequestSyncRequestScriptBuilder.d.ts +15 -0
  69. package/lib/xml-http-request/utilities/XMLHttpRequestSyncRequestScriptBuilder.js +55 -0
  70. package/lib/xml-http-request/utilities/XMLHttpRequestSyncRequestScriptBuilder.js.map +1 -0
  71. package/lib/xml-http-request/utilities/XMLHttpRequestURLUtility.d.ts +35 -0
  72. package/lib/xml-http-request/utilities/XMLHttpRequestURLUtility.js +62 -0
  73. package/lib/xml-http-request/utilities/XMLHttpRequestURLUtility.js.map +1 -0
  74. package/package.json +2 -2
  75. package/src/async-task-manager/AsyncTaskManager.ts +24 -26
  76. package/src/cookie/Cookie.ts +158 -0
  77. package/src/cookie/CookieJar.ts +82 -0
  78. package/src/event/IEventListener.ts +1 -1
  79. package/src/exception/DOMExceptionNameEnum.ts +4 -1
  80. package/src/fetch/FetchHandler.ts +40 -4
  81. package/src/fetch/RequestInfo.ts +6 -0
  82. package/src/fetch/ResourceFetchHandler.ts +10 -8
  83. package/src/index.ts +1 -2
  84. package/src/location/Location.ts +3 -3
  85. package/src/location/RelativeURL.ts +3 -14
  86. package/src/nodes/document/Document.ts +24 -6
  87. package/src/nodes/document/IDocument.ts +2 -0
  88. package/src/nodes/html-link-element/HTMLLinkElement.ts +7 -2
  89. package/src/nodes/html-script-element/HTMLScriptElement.ts +1 -1
  90. package/src/nodes/html-script-element/ScriptUtility.ts +8 -0
  91. package/src/window/IHappyDOMSettings.ts +9 -0
  92. package/src/window/IWindow.ts +15 -6
  93. package/src/window/Window.ts +36 -5
  94. package/src/xml-http-request/XMLHttpRequest.ts +998 -0
  95. package/src/xml-http-request/XMLHttpRequestCertificate.ts +52 -0
  96. package/src/xml-http-request/XMLHttpRequestEventTarget.ts +17 -0
  97. package/src/xml-http-request/XMLHttpRequestReadyStateEnum.ts +9 -0
  98. package/src/xml-http-request/XMLHttpRequestUpload.ts +6 -0
  99. package/src/xml-http-request/XMLHttpResponseTypeEnum.ts +9 -0
  100. package/src/xml-http-request/utilities/XMLHttpRequestSyncRequestScriptBuilder.ts +53 -0
  101. package/src/xml-http-request/utilities/XMLHttpRequestURLUtility.ts +64 -0
  102. package/lib/cookie/CookieUtility.d.ts +0 -15
  103. package/lib/cookie/CookieUtility.js +0 -83
  104. package/lib/cookie/CookieUtility.js.map +0 -1
  105. package/lib/location/URL.d.ts +0 -53
  106. package/lib/location/URL.js +0 -96
  107. package/lib/location/URL.js.map +0 -1
  108. package/src/cookie/CookieUtility.ts +0 -87
  109. package/src/location/URL.ts +0 -102
package/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  ![Happy DOM Logo](https://github.com/capricorn86/happy-dom/raw/master/docs/happy-dom-logo.jpg)
2
2
 
3
-
4
3
  # About
5
4
 
6
5
  [Happy DOM](https://github.com/capricorn86/happy-dom) is a JavaScript implementation of a web browser without its graphical user interface. It includes many web standards from WHATWG [DOM](https://dom.spec.whatwg.org/) and [HTML](https://html.spec.whatwg.org/multipage/).
@@ -9,7 +8,6 @@ The goal of [Happy DOM](https://github.com/capricorn86/happy-dom) is to emulate
9
8
 
10
9
  [Happy DOM](https://github.com/capricorn86/happy-dom) focuses heavily on performance and can be used as an alternative to [JSDOM](https://github.com/jsdom/jsdom).
11
10
 
12
-
13
11
  ### DOM Features
14
12
 
15
13
  - Custom Elements (Web Components)
@@ -26,8 +24,6 @@ The goal of [Happy DOM](https://github.com/capricorn86/happy-dom) is to emulate
26
24
 
27
25
  And much more..
28
26
 
29
-
30
-
31
27
  ### Works With
32
28
 
33
29
  - [Google LitHTML](https://lit-html.polymer-project.org)
@@ -40,20 +36,14 @@ And much more..
40
36
 
41
37
  - [Vue](https://vuejs.org/)
42
38
 
43
-
44
-
45
39
  # Installation
46
40
 
47
41
  ```bash
48
42
  npm install happy-dom
49
43
  ```
50
44
 
51
-
52
-
53
45
  # Usage
54
46
 
55
-
56
-
57
47
  ## Basic Usage
58
48
 
59
49
  A simple example of how you can use Happy DOM.
@@ -75,8 +65,6 @@ container.appendChild(button);
75
65
  console.log(document.body.innerHTML);
76
66
  ```
77
67
 
78
-
79
-
80
68
  ## VM Context
81
69
 
82
70
  The default Window class is a [VM context](https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox_options). A [VM context](https://nodejs.org/api/vm.html#vm_vm_createcontext_sandbox_options) will execute JavaScript code scoped within the context where the Window instance will be the global object.
@@ -85,9 +73,9 @@ The default Window class is a [VM context](https://nodejs.org/api/vm.html#vm_vm_
85
73
  import { Window } from 'happy-dom';
86
74
 
87
75
  const window = new Window({
88
- innerWidth: 1024,
89
- innerHeight: 768,
90
- url: 'http://localhost:8080'
76
+ innerWidth: 1024,
77
+ innerHeight: 768,
78
+ url: 'http://localhost:8080'
91
79
  });
92
80
  const document = window.document;
93
81
 
@@ -146,9 +134,9 @@ The example below will show you how to setup a Node [VM context](https://nodejs.
146
134
  import { Window } from 'happy-dom';
147
135
 
148
136
  const window = new Window({
149
- innerWidth: 1024,
150
- innerHeight: 768,
151
- url: 'http://localhost:8080'
137
+ innerWidth: 1024,
138
+ innerHeight: 768,
139
+ url: 'http://localhost:8080'
152
140
  });
153
141
  const document = window.document;
154
142
 
@@ -207,19 +195,15 @@ Will output:
207
195
  console.log(document.body.querySelector('div').getInnerHTML({ includeShadowRoots: true }));
208
196
  ```
209
197
 
210
-
211
-
212
198
  ## Additional Features
213
199
 
214
- Happy DOM exposes two functions that may be useful when working with asynchrounous code.
215
-
216
200
  **whenAsyncComplete()**
217
201
 
218
202
  Returns a [Promise](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise) that is resolved when all async tasks has been completed.
219
203
 
220
204
  ```javascript
221
205
  window.happyDOM.whenAsyncComplete().then(() => {
222
- // Do something when all async tasks are completed.
206
+ // Do something when all async tasks are completed.
223
207
  });
224
208
  ```
225
209
 
@@ -229,7 +213,7 @@ This method will cancel all running async tasks.
229
213
 
230
214
  ```javascript
231
215
  window.setTimeout(() => {
232
- // This timeout will be canceled
216
+ // This timeout will be canceled
233
217
  });
234
218
  window.happyDOM.cancelAsync();
235
219
  ```
@@ -250,7 +234,60 @@ Sets the property `window.innerHeight` and dispatches a "resize" event.
250
234
  window.happyDOM.setInnerHeight(768);
251
235
  ```
252
236
 
237
+ **setURL()**
238
+
239
+ Sets the property `window.location.href`.
240
+
241
+ ```javascript
242
+ window.happyDOM.setURL('https://localhost:3000');
243
+ ```
244
+
245
+ ## Settings
246
+
247
+ Settings can be sent to the constructor or by setting them on the "window.happyDOM.settings" property.
248
+
249
+ Set by constructor:
250
+
251
+ ```javascript
252
+ const window = new Window({
253
+ innerWidth: 1024,
254
+ innerHeight: 768,
255
+ url: 'https://localhost:8080',
256
+ settings: {
257
+ disableJavaScriptFileLoading: true,
258
+ disableJavaScriptEvaluation: true,
259
+ disableCSSFileLoading: true,
260
+ enableFileSystemHttpRequests: true
261
+ }
262
+ });
263
+ ```
264
+
265
+ Set by property:
266
+
267
+ ```javascript
268
+ const window = new Window();
269
+
270
+ window.happyDOM.settings.disableJavaScriptFileLoading = true;
271
+ window.happyDOM.settings.disableJavaScriptEvaluation = true;
272
+ window.happyDOM.settings.disableCSSFileLoading = true;
273
+ window.happyDOM.settings.enableFileSystemHttpRequests = true;
274
+ ```
275
+
276
+ **disableJavaScriptFileLoading**
277
+
278
+ Set it to "true" to disable JavaScript file loading. Defaults to "false".
279
+
280
+ **disableJavaScriptEvaluation**
281
+
282
+ Set it to "true" to completely disable JavaScript evaluation. Defaults to "false".
253
283
 
284
+ **disableCSSFileLoading**
285
+
286
+ Set it to "true" to disable CSS file loading using the HTMLLinkElement. Defaults to "false".
287
+
288
+ **enableFileSystemHttpRequests**
289
+
290
+ Set it to "true" to enable file system HTTP requests using XMLHttpRequest. Defaults to "false".
254
291
 
255
292
  # Performance
256
293
 
@@ -268,12 +305,10 @@ window.happyDOM.setInnerHeight(768);
268
305
 
269
306
  [See how the test was done here](https://github.com/capricorn86/happy-dom-performance-test)
270
307
 
271
-
272
-
273
308
  # Jest
274
309
 
275
310
  Happy DOM provide with a package called [@happy-dom/jest-environment](https://github.com/capricorn86/happy-dom/tree/master/packages/jest-environment) that makes it possible to use Happy DOM with [Jest](https://jestjs.io/).
276
311
 
277
312
  # Global Registration
278
313
 
279
- Happy DOM provide with a package called [@happy-dom/global-registrator](https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator) that can register Happy DOM globally. It makes it possible to use Happy DOM for testing in a Node environment.
314
+ Happy DOM provide with a package called [@happy-dom/global-registrator](https://github.com/capricorn86/happy-dom/tree/master/packages/global-registrator) that can register Happy DOM globally. It makes it possible to use Happy DOM for testing in a Node environment.
@@ -15,7 +15,7 @@ export default class AsyncTaskManager {
15
15
  */
16
16
  whenComplete(): Promise<void>;
17
17
  /**
18
- * Cancels all tasks.
18
+ * Ends all tasks.
19
19
  *
20
20
  * @param [error] Error.
21
21
  */
@@ -35,9 +35,10 @@ export default class AsyncTaskManager {
35
35
  /**
36
36
  * Starts an async task.
37
37
  *
38
+ * @param abortHandler Abort handler.
38
39
  * @returns Task ID.
39
40
  */
40
- startTask(): number;
41
+ startTask(abortHandler?: () => void): number;
41
42
  /**
42
43
  * Ends an async task.
43
44
  *
@@ -50,12 +51,6 @@ export default class AsyncTaskManager {
50
51
  * @returns Count.
51
52
  */
52
53
  getTaskCount(): number;
53
- /**
54
- * Returns the amount of running timers.
55
- *
56
- * @returns Count.
57
- */
58
- getTimerCount(): number;
59
54
  /**
60
55
  * Returns a new task ID.
61
56
  *
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
5
5
  */
6
6
  class AsyncTaskManager {
7
7
  constructor() {
8
- this.runningTasks = [];
8
+ this.runningTasks = {};
9
9
  this.runningTimers = [];
10
10
  this.queue = [];
11
11
  }
@@ -25,18 +25,23 @@ class AsyncTaskManager {
25
25
  });
26
26
  }
27
27
  /**
28
- * Cancels all tasks.
28
+ * Ends all tasks.
29
29
  *
30
30
  * @param [error] Error.
31
31
  */
32
32
  cancelAll(error) {
33
- for (const timerID of this.runningTimers) {
34
- global.clearTimeout(timerID);
35
- }
33
+ const runningTimers = this.runningTimers;
34
+ const runningTasks = this.runningTasks;
36
35
  const promises = this.queue;
37
- this.runningTasks = [];
36
+ this.runningTasks = {};
38
37
  this.runningTimers = [];
39
38
  this.queue = [];
39
+ for (const timer of runningTimers) {
40
+ global.clearTimeout(timer);
41
+ }
42
+ for (const key of Object.keys(runningTasks)) {
43
+ runningTasks[key]();
44
+ }
40
45
  for (const promise of promises) {
41
46
  if (error) {
42
47
  promise.reject(error);
@@ -64,18 +69,19 @@ class AsyncTaskManager {
64
69
  if (index !== -1) {
65
70
  this.runningTimers.splice(index, 1);
66
71
  }
67
- if (!this.runningTasks.length && !this.runningTimers.length) {
72
+ if (!Object.keys(this.runningTasks).length && !this.runningTimers.length) {
68
73
  this.cancelAll();
69
74
  }
70
75
  }
71
76
  /**
72
77
  * Starts an async task.
73
78
  *
79
+ * @param abortHandler Abort handler.
74
80
  * @returns Task ID.
75
81
  */
76
- startTask() {
82
+ startTask(abortHandler) {
77
83
  const taskID = this.newTaskID();
78
- this.runningTasks.push(taskID);
84
+ this.runningTasks[taskID] = abortHandler ? abortHandler : () => { };
79
85
  return taskID;
80
86
  }
81
87
  /**
@@ -84,12 +90,11 @@ class AsyncTaskManager {
84
90
  * @param taskID Task ID.
85
91
  */
86
92
  endTask(taskID) {
87
- const index = this.runningTasks.indexOf(taskID);
88
- if (index !== -1) {
89
- this.runningTasks.splice(index, 1);
90
- }
91
- if (!this.runningTasks.length && !this.runningTimers.length) {
92
- this.cancelAll();
93
+ if (this.runningTasks[taskID]) {
94
+ delete this.runningTasks[taskID];
95
+ if (!Object.keys(this.runningTasks).length && !this.runningTimers.length) {
96
+ this.cancelAll();
97
+ }
93
98
  }
94
99
  }
95
100
  /**
@@ -98,15 +103,7 @@ class AsyncTaskManager {
98
103
  * @returns Count.
99
104
  */
100
105
  getTaskCount() {
101
- return this.runningTasks.length;
102
- }
103
- /**
104
- * Returns the amount of running timers.
105
- *
106
- * @returns Count.
107
- */
108
- getTimerCount() {
109
- return this.runningTimers.length;
106
+ return Object.keys(this.runningTasks).length;
110
107
  }
111
108
  /**
112
109
  * Returns a new task ID.
@@ -1 +1 @@
1
- {"version":3,"file":"AsyncTaskManager.js","sourceRoot":"","sources":["../../src/async-task-manager/AsyncTaskManager.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAqB,gBAAgB;IAArC;QAES,iBAAY,GAAa,EAAE,CAAC;QAC5B,kBAAa,GAAqB,EAAE,CAAC;QACrC,UAAK,GAA8D,EAAE,CAAC;IAwH/E,CAAC;IAtHA;;;;;OAKG;IACI,KAAK,CAAC,YAAY;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;gBACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC,EAAE,CAAC,CAAC,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,KAAa;QAC7B,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE;YACzC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;SAC7B;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;QAE5B,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB,IAAI,CAAC,aAAa,GAAG,EAAE,CAAC;QACxB,IAAI,CAAC,KAAK,GAA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,EAAE,CAAC;SACjB;IACF,CAAC;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,aAAa;QACnB,OAAO,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACK,SAAS;QACU,IAAI,CAAC,WAAY,CAAC,MAAM,EAAE,CAAC;QACrD,OAAiC,IAAI,CAAC,WAAY,CAAC,MAAM,CAAC;IAC3D,CAAC;;AA3HF,mCA4HC;AA3He,uBAAM,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"AsyncTaskManager.js","sourceRoot":"","sources":["../../src/async-task-manager/AsyncTaskManager.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,MAAqB,gBAAgB;IAArC;QAES,iBAAY,GAAgC,EAAE,CAAC;QAC/C,kBAAa,GAAqB,EAAE,CAAC;QACrC,UAAK,GAA8D,EAAE,CAAC;IAsH/E,CAAC;IApHA;;;;;OAKG;IACI,KAAK,CAAC,YAAY;QACxB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACtC,MAAM,OAAO,GAAG,MAAM,CAAC,UAAU,CAAC,GAAG,EAAE;gBACtC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACxB,CAAC,EAAE,CAAC,CAAC,CAAC;YACN,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;YACzB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;QACtC,CAAC,CAAC,CAAC;IACJ,CAAC;IAED;;;;OAIG;IACI,SAAS,CAAC,KAAa;QAC7B,MAAM,aAAa,GAAG,IAAI,CAAC,aAAa,CAAC;QACzC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC;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CAAC,CAAC,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;QACnE,OAAO,MAAM,CAAC;IACf,CAAC;IAED;;;;OAIG;IACI,OAAO,CAAC,MAAc;QAC5B,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;YAC9B,OAAO,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;YAEjC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;gBACzE,IAAI,CAAC,SAAS,EAAE,CAAC;aACjB;SACD;IACF,CAAC;IAED;;;;OAIG;IACI,YAAY;QAClB,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC;IAC9C,CAAC;IAED;;;;OAIG;IACK,SAAS;QACU,IAAI,CAAC,WAAY,CAAC,MAAM,EAAE,CAAC;QACrD,OAAiC,IAAI,CAAC,WAAY,CAAC,MAAM,CAAC;IAC3D,CAAC;;AAzHF,mCA0HC;AAzHe,uBAAM,GAAG,CAAC,CAAC"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Cookie.
3
+ */
4
+ export default class Cookie {
5
+ private pairs;
6
+ key: string;
7
+ value: string;
8
+ size: number;
9
+ domain: string;
10
+ path: string;
11
+ expriesOrMaxAge: Date;
12
+ httpOnly: boolean;
13
+ secure: boolean;
14
+ sameSite: string;
15
+ /**
16
+ * Constructor.
17
+ *
18
+ * @param cookie Cookie.
19
+ */
20
+ constructor(cookie: string);
21
+ /**
22
+ * Returns a raw string of the cookie.
23
+ */
24
+ rawString(): string;
25
+ /**
26
+ *
27
+ */
28
+ cookieString(): string;
29
+ /**
30
+ *
31
+ */
32
+ isExpired(): boolean;
33
+ /**
34
+ *
35
+ */
36
+ isHttpOnly(): boolean;
37
+ /**
38
+ *
39
+ */
40
+ isSecure(): boolean;
41
+ /**
42
+ * Parse a cookie string.
43
+ *
44
+ * @param cookieString
45
+ */
46
+ static parse(cookieString: string): Cookie;
47
+ /**
48
+ * Stringify a Cookie object.
49
+ *
50
+ * @param cookie
51
+ */
52
+ static stringify(cookie: Cookie): string;
53
+ }
@@ -0,0 +1,146 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const CookiePairRegex = /([^=]+)(?:=([\s\S]*))?/;
4
+ /**
5
+ * Cookie.
6
+ */
7
+ class Cookie {
8
+ /**
9
+ * Constructor.
10
+ *
11
+ * @param cookie Cookie.
12
+ */
13
+ constructor(cookie) {
14
+ this.pairs = {};
15
+ //
16
+ this.key = '';
17
+ this.value = '';
18
+ this.size = 0;
19
+ // Optional
20
+ this.domain = '';
21
+ this.path = '';
22
+ this.expriesOrMaxAge = null;
23
+ this.httpOnly = false;
24
+ this.secure = false;
25
+ this.sameSite = '';
26
+ let match;
27
+ const parts = cookie.split(';').filter(Boolean);
28
+ // Part[0] is the key-value pair.
29
+ match = new RegExp(CookiePairRegex).exec(parts[0]);
30
+ if (!match) {
31
+ throw new Error(`Invalid cookie: ${cookie}`);
32
+ }
33
+ this.key = match[1].trim();
34
+ this.value = match[2];
35
+ // Set key is empty if match[2] is undefined.
36
+ if (!match[2]) {
37
+ this.value = this.key;
38
+ this.key = '';
39
+ }
40
+ this.pairs[this.key] = this.value;
41
+ this.size = this.key.length + this.value.length;
42
+ // Attribute.
43
+ for (const part of parts.slice(1)) {
44
+ match = new RegExp(CookiePairRegex).exec(part);
45
+ if (!match) {
46
+ throw new Error(`Invalid cookie: ${part}`);
47
+ }
48
+ const key = match[1].trim();
49
+ const value = match[2];
50
+ switch (key.toLowerCase()) {
51
+ case 'expires':
52
+ this.expriesOrMaxAge = new Date(value);
53
+ break;
54
+ case 'max-age':
55
+ this.expriesOrMaxAge = new Date(parseInt(value, 10) * 1000 + Date.now());
56
+ break;
57
+ case 'domain':
58
+ this.domain = value;
59
+ break;
60
+ case 'path':
61
+ this.path = value.startsWith('/') ? value : `/${value}`;
62
+ break;
63
+ case 'httponly':
64
+ this.httpOnly = true;
65
+ break;
66
+ case 'secure':
67
+ this.secure = true;
68
+ break;
69
+ case 'samesite':
70
+ this.sameSite = value;
71
+ break;
72
+ default:
73
+ continue; // Skip.
74
+ }
75
+ // Skip unknown key-value pair.
76
+ if (['expires', 'max-age', 'domain', 'path', 'httponly', 'secure', 'samesite'].indexOf(key.toLowerCase()) === -1) {
77
+ continue;
78
+ }
79
+ this.pairs[key] = value;
80
+ }
81
+ }
82
+ /**
83
+ * Returns a raw string of the cookie.
84
+ */
85
+ rawString() {
86
+ return Object.keys(this.pairs)
87
+ .map((key) => {
88
+ if (key) {
89
+ return `${key}=${this.pairs[key]}`;
90
+ }
91
+ return this.pairs[key];
92
+ })
93
+ .join('; ');
94
+ }
95
+ /**
96
+ *
97
+ */
98
+ cookieString() {
99
+ if (this.key) {
100
+ return `${this.key}=${this.value}`;
101
+ }
102
+ return this.value;
103
+ }
104
+ /**
105
+ *
106
+ */
107
+ isExpired() {
108
+ // If the expries/maxage is set, then determine whether it is expired.
109
+ if (this.expriesOrMaxAge && this.expriesOrMaxAge.getTime() < Date.now()) {
110
+ return true;
111
+ }
112
+ // If the expries/maxage is not set, it's a session-level cookie that will expire when the browser is closed.
113
+ // (it's never expired in happy-dom)
114
+ return false;
115
+ }
116
+ /**
117
+ *
118
+ */
119
+ isHttpOnly() {
120
+ return this.httpOnly;
121
+ }
122
+ /**
123
+ *
124
+ */
125
+ isSecure() {
126
+ return this.secure;
127
+ }
128
+ /**
129
+ * Parse a cookie string.
130
+ *
131
+ * @param cookieString
132
+ */
133
+ static parse(cookieString) {
134
+ return new Cookie(cookieString);
135
+ }
136
+ /**
137
+ * Stringify a Cookie object.
138
+ *
139
+ * @param cookie
140
+ */
141
+ static stringify(cookie) {
142
+ return cookie.toString();
143
+ }
144
+ }
145
+ exports.default = Cookie;
146
+ //# sourceMappingURL=Cookie.js.map
@@ -0,0 +1 @@
1
+ {"version":3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IAAI,CAAC,MAAM,CAAC;IACpB,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,KAAK,CAAC,YAAoB;QACvC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;IAED;;;;OAIG;IACI,MAAM,CAAC,SAAS,CAAC,MAAc;QACrC,OAAO,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC1B,CAAC;CACD;AAxJD,yBAwJC"}
@@ -0,0 +1,30 @@
1
+ import Location from 'src/location/Location';
2
+ /**
3
+ * CookieJar.
4
+ *
5
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie.
6
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie.
7
+ */
8
+ export default class CookieJar {
9
+ private cookies;
10
+ /**
11
+ * Validate cookie.
12
+ *
13
+ * @param cookie
14
+ */
15
+ private validateCookie;
16
+ /**
17
+ * Set cookie.
18
+ *
19
+ * @param cookieString
20
+ */
21
+ setCookiesString(cookieString: string): void;
22
+ /**
23
+ * Get cookie.
24
+ *
25
+ * @param location Location.
26
+ * @param fromDocument If true, the caller is a document.
27
+ * @returns Cookie string.
28
+ */
29
+ getCookiesString(location: Location, fromDocument: boolean): string;
30
+ }
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Cookie_1 = __importDefault(require("./Cookie"));
7
+ /**
8
+ * CookieJar.
9
+ *
10
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie.
11
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie.
12
+ */
13
+ class CookieJar {
14
+ constructor() {
15
+ this.cookies = [];
16
+ }
17
+ /**
18
+ * Validate cookie.
19
+ *
20
+ * @param cookie
21
+ */
22
+ validateCookie(cookie) {
23
+ if (cookie.key.toLowerCase().startsWith('__secure-') && !cookie.isSecure()) {
24
+ return false;
25
+ }
26
+ if (cookie.key.toLowerCase().startsWith('__host-') &&
27
+ (!cookie.isSecure() || cookie.path !== '/' || cookie.domain)) {
28
+ return false;
29
+ }
30
+ return true;
31
+ }
32
+ /**
33
+ * Set cookie.
34
+ *
35
+ * @param cookieString
36
+ */
37
+ setCookiesString(cookieString) {
38
+ if (!cookieString) {
39
+ return;
40
+ }
41
+ const newCookie = new Cookie_1.default(cookieString);
42
+ if (!this.validateCookie(newCookie)) {
43
+ return;
44
+ }
45
+ this.cookies
46
+ .filter((cookie) => cookie.key === newCookie.key)
47
+ .forEach((cookie) => {
48
+ this.cookies.splice(this.cookies.indexOf(cookie), 1);
49
+ });
50
+ this.cookies.push(newCookie);
51
+ }
52
+ /**
53
+ * Get cookie.
54
+ *
55
+ * @param location Location.
56
+ * @param fromDocument If true, the caller is a document.
57
+ * @returns Cookie string.
58
+ */
59
+ getCookiesString(location, fromDocument) {
60
+ const cookies = this.cookies.filter((cookie) => {
61
+ // Skip when use document.cookie and the cookie is httponly.
62
+ if (fromDocument && cookie.isHttpOnly()) {
63
+ return false;
64
+ }
65
+ if (cookie.isExpired()) {
66
+ return false;
67
+ }
68
+ if (cookie.isSecure() && location.protocol !== 'https:') {
69
+ return false;
70
+ }
71
+ if (cookie.domain && !location.hostname.endsWith(cookie.domain)) {
72
+ return false;
73
+ }
74
+ if (cookie.path && !location.pathname.startsWith(cookie.path)) {
75
+ return false;
76
+ }
77
+ // TODO: check SameSite.
78
+ return true;
79
+ });
80
+ return cookies.map((cookie) => cookie.cookieString()).join('; ');
81
+ }
82
+ }
83
+ exports.default = CookieJar;
84
+ //# sourceMappingURL=CookieJar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CookieJar.js","sourceRoot":"","sources":["../../src/cookie/CookieJar.ts"],"names":[],"mappings":";;;;;AACA,sDAA8B;AAE9B;;;;;GAKG;AACH,MAAqB,SAAS;IAA9B;QACS,Y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AA4D;YAC5D,IAAI,YAAY,IAAI,MAAM,CAAC,UAAU,EAAE,EAAE;gBACxC,OAAO,KAAK,CAAC;aACb;YACD,IAAI,MAAM,CAAC,SAAS,EAAE,EAAE;gBACvB,OAAO,KAAK,CAAC;aACb;YACD,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,QAAQ,CAAC,QAAQ,KAAK,QAAQ,EAAE;gBACxD,OAAO,KAAK,CAAC;aACb;YACD,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE;gBAChE,OAAO,KAAK,CAAC;aACb;YACD,IAAI,MAAM,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;gBAC9D,OAAO,KAAK,CAAC;aACb;YACD,wBAAwB;YACxB,OAAO,IAAI,CAAC;QACb,CAAC,CAAC,CAAC;QACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAClE,CAAC;CACD;AAxED,4BAwEC"}
@@ -6,7 +6,7 @@ export default interface IEventListener {
6
6
  /**
7
7
  * Handles event.
8
8
  *
9
- * @param type Event type.
9
+ * @param event Event.
10
10
  */
11
11
  handleEvent(event: Event): void;
12
12
  }
@@ -8,6 +8,9 @@ declare enum DOMExceptionNameEnum {
8
8
  invalidNodeTypeError = "InvalidNodeTypeError",
9
9
  invalidCharacterError = "InvalidCharacterError",
10
10
  notFoundError = "NotFoundError",
11
- domException = "DOMException"
11
+ securityError = "SecurityError",
12
+ networkError = "NetworkError",
13
+ domException = "DOMException",
14
+ invalidAccessError = "InvalidAccessError"
12
15
  }
13
16
  export default DOMExceptionNameEnum;