happy-dom 8.4.1 → 8.4.2
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.
- package/lib/navigator/Navigator.d.ts +96 -23
- package/lib/navigator/Navigator.js +141 -49
- package/lib/navigator/Navigator.js.map +1 -1
- package/package.json +1 -1
- package/src/navigator/Navigator.ts +142 -49
@@ -9,29 +9,102 @@ import PluginArray from './PluginArray';
|
|
9
9
|
* https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator.
|
10
10
|
*/
|
11
11
|
export default class Navigator {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
12
|
+
/**
|
13
|
+
* False if setting a cookie will be ignored and true otherwise.
|
14
|
+
*/
|
15
|
+
get cookieEnabled(): boolean;
|
16
|
+
/**
|
17
|
+
* TODO: Not implemented.
|
18
|
+
*/
|
19
|
+
get credentials(): string;
|
20
|
+
/**
|
21
|
+
* TODO: Not implemented.
|
22
|
+
*/
|
23
|
+
get geolocation(): string;
|
24
|
+
/**
|
25
|
+
* String representing the preferred language of the user, usually the language of the browser UI.
|
26
|
+
*/
|
27
|
+
get language(): string;
|
28
|
+
/**
|
29
|
+
* Array of string representing the user's preferred languages.
|
30
|
+
*/
|
31
|
+
get languages(): string[];
|
32
|
+
/**
|
33
|
+
* TODO: Not implemented.
|
34
|
+
*/
|
35
|
+
get locks(): string;
|
36
|
+
/**
|
37
|
+
* Maximum number of simultaneous touch contact points are supported by the current device.
|
38
|
+
*/
|
39
|
+
get maxTouchPoints(): number;
|
40
|
+
/**
|
41
|
+
* Number of logical processors available to run threads on the user's computer.
|
42
|
+
*/
|
43
|
+
get hardwareConcurrency(): number;
|
44
|
+
/**
|
45
|
+
* Browser app code name.
|
46
|
+
*/
|
47
|
+
get appCodeName(): string;
|
48
|
+
/**
|
49
|
+
* Browser app name.
|
50
|
+
*/
|
51
|
+
get appName(): string;
|
52
|
+
/**
|
53
|
+
* Browser app version.
|
54
|
+
*/
|
55
|
+
get appVersion(): string;
|
56
|
+
/**
|
57
|
+
* Browser platform.
|
58
|
+
*/
|
59
|
+
get platform(): string;
|
60
|
+
/**
|
61
|
+
* Browser product.
|
62
|
+
*/
|
63
|
+
get product(): string;
|
64
|
+
/**
|
65
|
+
* Browser product sub.
|
66
|
+
*/
|
67
|
+
get productSub(): string;
|
68
|
+
/**
|
69
|
+
* Browser vendor.
|
70
|
+
*/
|
71
|
+
get vendor(): string;
|
72
|
+
/**
|
73
|
+
* Browser vendor sub.
|
74
|
+
*/
|
75
|
+
get vendorSub(): string;
|
76
|
+
/**
|
77
|
+
* Browser user agent.
|
78
|
+
*
|
79
|
+
* "appCodeName/appVersion number (Platform; Security; OS-or-CPU; Localization; rv: revision-version-number) product/productSub Application-Name Application-Name-version".
|
80
|
+
*/
|
81
|
+
get userAgent(): string;
|
82
|
+
/**
|
83
|
+
* Boolean value indicating whether the browser is working online.
|
84
|
+
*/
|
85
|
+
get onLine(): boolean;
|
86
|
+
/**
|
87
|
+
* TODO: Not implemented.
|
88
|
+
*/
|
89
|
+
get permissions(): string;
|
90
|
+
/**
|
91
|
+
* Boolean Indicates whether the user agent is controlled by automation.
|
92
|
+
*/
|
93
|
+
get webdriver(): boolean;
|
94
|
+
/**
|
95
|
+
* The user's Do Not Track setting, which indicates whether the user is requesting web sites and advertisers to not track them.
|
96
|
+
*
|
97
|
+
* The value of the property reflects that of the DNT HTTP header, i.e. Values of "1", "0", or "unspecified".
|
98
|
+
*/
|
99
|
+
get doNotTrack(): string;
|
100
|
+
/**
|
101
|
+
* Browser mime-types.
|
102
|
+
*/
|
103
|
+
get mimeTypes(): MimeTypeArray;
|
104
|
+
/**
|
105
|
+
* Browser plugins.
|
106
|
+
*/
|
107
|
+
get plugins(): PluginArray;
|
35
108
|
/**
|
36
109
|
* Returns the object as a string.
|
37
110
|
*
|
@@ -14,55 +14,147 @@ const PluginArray_1 = __importDefault(require("./PluginArray"));
|
|
14
14
|
* https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator.
|
15
15
|
*/
|
16
16
|
class Navigator {
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
17
|
+
/**
|
18
|
+
* False if setting a cookie will be ignored and true otherwise.
|
19
|
+
*/
|
20
|
+
get cookieEnabled() {
|
21
|
+
return true;
|
22
|
+
}
|
23
|
+
/**
|
24
|
+
* TODO: Not implemented.
|
25
|
+
*/
|
26
|
+
get credentials() {
|
27
|
+
return null;
|
28
|
+
}
|
29
|
+
/**
|
30
|
+
* TODO: Not implemented.
|
31
|
+
*/
|
32
|
+
get geolocation() {
|
33
|
+
return null;
|
34
|
+
}
|
35
|
+
/**
|
36
|
+
* String representing the preferred language of the user, usually the language of the browser UI.
|
37
|
+
*/
|
38
|
+
get language() {
|
39
|
+
return 'en-US';
|
40
|
+
}
|
41
|
+
/**
|
42
|
+
* Array of string representing the user's preferred languages.
|
43
|
+
*/
|
44
|
+
get languages() {
|
45
|
+
return ['en-US', 'en'];
|
46
|
+
}
|
47
|
+
/**
|
48
|
+
* TODO: Not implemented.
|
49
|
+
*/
|
50
|
+
get locks() {
|
51
|
+
return null;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Maximum number of simultaneous touch contact points are supported by the current device.
|
55
|
+
*/
|
56
|
+
get maxTouchPoints() {
|
57
|
+
return 0;
|
58
|
+
}
|
59
|
+
/**
|
60
|
+
* Number of logical processors available to run threads on the user's computer.
|
61
|
+
*/
|
62
|
+
get hardwareConcurrency() {
|
63
|
+
return 8;
|
64
|
+
}
|
65
|
+
/**
|
66
|
+
* Browser app code name.
|
67
|
+
*/
|
68
|
+
get appCodeName() {
|
69
|
+
return 'Mozilla';
|
70
|
+
}
|
71
|
+
/**
|
72
|
+
* Browser app name.
|
73
|
+
*/
|
74
|
+
get appName() {
|
75
|
+
return 'Netscape';
|
76
|
+
}
|
77
|
+
/**
|
78
|
+
* Browser app version.
|
79
|
+
*/
|
80
|
+
get appVersion() {
|
81
|
+
return '5.0 (Windows)';
|
82
|
+
}
|
83
|
+
/**
|
84
|
+
* Browser platform.
|
85
|
+
*/
|
86
|
+
get platform() {
|
87
|
+
return 'Win32';
|
88
|
+
}
|
89
|
+
/**
|
90
|
+
* Browser product.
|
91
|
+
*/
|
92
|
+
get product() {
|
93
|
+
return 'Gecko';
|
94
|
+
}
|
95
|
+
/**
|
96
|
+
* Browser product sub.
|
97
|
+
*/
|
98
|
+
get productSub() {
|
99
|
+
return '20100101';
|
100
|
+
}
|
101
|
+
/**
|
102
|
+
* Browser vendor.
|
103
|
+
*/
|
104
|
+
get vendor() {
|
105
|
+
return '';
|
106
|
+
}
|
107
|
+
/**
|
108
|
+
* Browser vendor sub.
|
109
|
+
*/
|
110
|
+
get vendorSub() {
|
111
|
+
return '';
|
112
|
+
}
|
113
|
+
/**
|
114
|
+
* Browser user agent.
|
115
|
+
*
|
116
|
+
* "appCodeName/appVersion number (Platform; Security; OS-or-CPU; Localization; rv: revision-version-number) product/productSub Application-Name Application-Name-version".
|
117
|
+
*/
|
118
|
+
get userAgent() {
|
119
|
+
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0';
|
120
|
+
}
|
121
|
+
/**
|
122
|
+
* Boolean value indicating whether the browser is working online.
|
123
|
+
*/
|
124
|
+
get onLine() {
|
125
|
+
return true;
|
126
|
+
}
|
127
|
+
/**
|
128
|
+
* TODO: Not implemented.
|
129
|
+
*/
|
130
|
+
get permissions() {
|
131
|
+
return null;
|
132
|
+
}
|
133
|
+
/**
|
134
|
+
* Boolean Indicates whether the user agent is controlled by automation.
|
135
|
+
*/
|
136
|
+
get webdriver() {
|
137
|
+
return true;
|
138
|
+
}
|
139
|
+
/**
|
140
|
+
* The user's Do Not Track setting, which indicates whether the user is requesting web sites and advertisers to not track them.
|
141
|
+
*
|
142
|
+
* The value of the property reflects that of the DNT HTTP header, i.e. Values of "1", "0", or "unspecified".
|
143
|
+
*/
|
144
|
+
get doNotTrack() {
|
145
|
+
return 'unspecified';
|
146
|
+
}
|
147
|
+
/**
|
148
|
+
* Browser mime-types.
|
149
|
+
*/
|
150
|
+
get mimeTypes() {
|
151
|
+
return new MimeTypeArray_1.default([]);
|
152
|
+
}
|
153
|
+
/**
|
154
|
+
* Browser plugins.
|
155
|
+
*/
|
156
|
+
get plugins() {
|
157
|
+
return new PluginArray_1.default([]);
|
66
158
|
}
|
67
159
|
/**
|
68
160
|
* Returns the object as a string.
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/navigator/Navigator.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAC5C,gEAAwC;AAExC;;;;;;;GAOG;AACH,MAAqB,SAAS;
|
1
|
+
{"version":3,"file":"Navigator.js","sourceRoot":"","sources":["../../src/navigator/Navigator.ts"],"names":[],"mappings":";;;;;AAAA,oEAA4C;AAC5C,gEAAwC;AAExC;;;;;;;GAOG;AACH,MAAq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QACrB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QACnB,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;OAIG;IACH,IAAW,UAAU;QACpB,OAAO,aAAa,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAW,SAAS;QACnB,OAAO,IAAI,uBAAa,CAAC,EAAE,CAAC,CAAC;IAC9B,CAAC;IAED;;OAEG;IACH,IAAW,OAAO;QACjB,OAAO,IAAI,qBAAW,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;;OAIG;IACI,QAAQ;QACd,OAAO,oBAAoB,CAAC;IAC7B,CAAC;CACD;AA9KD,4BA8KC"}
|
package/package.json
CHANGED
@@ -10,77 +10,170 @@ import PluginArray from './PluginArray';
|
|
10
10
|
* https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator.
|
11
11
|
*/
|
12
12
|
export default class Navigator {
|
13
|
-
|
14
|
-
|
13
|
+
/**
|
14
|
+
* False if setting a cookie will be ignored and true otherwise.
|
15
|
+
*/
|
16
|
+
public get cookieEnabled(): boolean {
|
17
|
+
return true;
|
18
|
+
}
|
15
19
|
|
16
|
-
|
17
|
-
|
20
|
+
/**
|
21
|
+
* TODO: Not implemented.
|
22
|
+
*/
|
23
|
+
public get credentials(): string {
|
24
|
+
return null;
|
25
|
+
}
|
18
26
|
|
19
|
-
|
20
|
-
|
27
|
+
/**
|
28
|
+
* TODO: Not implemented.
|
29
|
+
*/
|
30
|
+
public get geolocation(): string {
|
31
|
+
return null;
|
32
|
+
}
|
21
33
|
|
22
|
-
|
23
|
-
|
34
|
+
/**
|
35
|
+
* String representing the preferred language of the user, usually the language of the browser UI.
|
36
|
+
*/
|
37
|
+
public get language(): string {
|
38
|
+
return 'en-US';
|
39
|
+
}
|
24
40
|
|
25
|
-
|
26
|
-
|
41
|
+
/**
|
42
|
+
* Array of string representing the user's preferred languages.
|
43
|
+
*/
|
44
|
+
public get languages(): string[] {
|
45
|
+
return ['en-US', 'en'];
|
46
|
+
}
|
27
47
|
|
28
|
-
|
29
|
-
|
48
|
+
/**
|
49
|
+
* TODO: Not implemented.
|
50
|
+
*/
|
51
|
+
public get locks(): string {
|
52
|
+
return null;
|
53
|
+
}
|
30
54
|
|
31
|
-
|
32
|
-
|
55
|
+
/**
|
56
|
+
* Maximum number of simultaneous touch contact points are supported by the current device.
|
57
|
+
*/
|
58
|
+
public get maxTouchPoints(): number {
|
59
|
+
return 0;
|
60
|
+
}
|
33
61
|
|
34
|
-
|
35
|
-
|
62
|
+
/**
|
63
|
+
* Number of logical processors available to run threads on the user's computer.
|
64
|
+
*/
|
65
|
+
public get hardwareConcurrency(): number {
|
66
|
+
return 8;
|
67
|
+
}
|
36
68
|
|
37
|
-
|
38
|
-
|
69
|
+
/**
|
70
|
+
* Browser app code name.
|
71
|
+
*/
|
72
|
+
public get appCodeName(): string {
|
73
|
+
return 'Mozilla';
|
74
|
+
}
|
39
75
|
|
40
|
-
|
41
|
-
|
76
|
+
/**
|
77
|
+
* Browser app name.
|
78
|
+
*/
|
79
|
+
public get appName(): string {
|
80
|
+
return 'Netscape';
|
81
|
+
}
|
42
82
|
|
43
|
-
|
44
|
-
|
83
|
+
/**
|
84
|
+
* Browser app version.
|
85
|
+
*/
|
86
|
+
public get appVersion(): string {
|
87
|
+
return '5.0 (Windows)';
|
88
|
+
}
|
45
89
|
|
46
|
-
|
47
|
-
|
90
|
+
/**
|
91
|
+
* Browser platform.
|
92
|
+
*/
|
93
|
+
public get platform(): string {
|
94
|
+
return 'Win32';
|
95
|
+
}
|
48
96
|
|
49
|
-
|
50
|
-
|
97
|
+
/**
|
98
|
+
* Browser product.
|
99
|
+
*/
|
100
|
+
public get product(): string {
|
101
|
+
return 'Gecko';
|
102
|
+
}
|
51
103
|
|
52
|
-
|
53
|
-
|
104
|
+
/**
|
105
|
+
* Browser product sub.
|
106
|
+
*/
|
107
|
+
public get productSub(): string {
|
108
|
+
return '20100101';
|
109
|
+
}
|
54
110
|
|
55
|
-
|
56
|
-
|
111
|
+
/**
|
112
|
+
* Browser vendor.
|
113
|
+
*/
|
114
|
+
public get vendor(): string {
|
115
|
+
return '';
|
116
|
+
}
|
57
117
|
|
58
|
-
|
59
|
-
|
118
|
+
/**
|
119
|
+
* Browser vendor sub.
|
120
|
+
*/
|
121
|
+
public get vendorSub(): string {
|
122
|
+
return '';
|
123
|
+
}
|
60
124
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
125
|
+
/**
|
126
|
+
* Browser user agent.
|
127
|
+
*
|
128
|
+
* "appCodeName/appVersion number (Platform; Security; OS-or-CPU; Localization; rv: revision-version-number) product/productSub Application-Name Application-Name-version".
|
129
|
+
*/
|
130
|
+
public get userAgent(): string {
|
131
|
+
return 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0';
|
132
|
+
}
|
65
133
|
|
66
|
-
|
67
|
-
|
134
|
+
/**
|
135
|
+
* Boolean value indicating whether the browser is working online.
|
136
|
+
*/
|
137
|
+
public get onLine(): boolean {
|
138
|
+
return true;
|
139
|
+
}
|
68
140
|
|
69
|
-
|
70
|
-
|
141
|
+
/**
|
142
|
+
* TODO: Not implemented.
|
143
|
+
*/
|
144
|
+
public get permissions(): string {
|
145
|
+
return null;
|
146
|
+
}
|
71
147
|
|
72
|
-
|
73
|
-
|
148
|
+
/**
|
149
|
+
* Boolean Indicates whether the user agent is controlled by automation.
|
150
|
+
*/
|
151
|
+
public get webdriver(): boolean {
|
152
|
+
return true;
|
153
|
+
}
|
74
154
|
|
75
|
-
|
76
|
-
|
77
|
-
|
155
|
+
/**
|
156
|
+
* The user's Do Not Track setting, which indicates whether the user is requesting web sites and advertisers to not track them.
|
157
|
+
*
|
158
|
+
* The value of the property reflects that of the DNT HTTP header, i.e. Values of "1", "0", or "unspecified".
|
159
|
+
*/
|
160
|
+
public get doNotTrack(): string {
|
161
|
+
return 'unspecified';
|
162
|
+
}
|
78
163
|
|
79
|
-
|
80
|
-
|
164
|
+
/**
|
165
|
+
* Browser mime-types.
|
166
|
+
*/
|
167
|
+
public get mimeTypes(): MimeTypeArray {
|
168
|
+
return new MimeTypeArray([]);
|
169
|
+
}
|
81
170
|
|
82
|
-
|
83
|
-
|
171
|
+
/**
|
172
|
+
* Browser plugins.
|
173
|
+
*/
|
174
|
+
public get plugins(): PluginArray {
|
175
|
+
return new PluginArray([]);
|
176
|
+
}
|
84
177
|
|
85
178
|
/**
|
86
179
|
* Returns the object as a string.
|