Skip to content

Commit

Permalink
New definition of 'M', new feature MOZILLA (#51)
Browse files Browse the repository at this point in the history
* Update definitions.js

* Update features.js

* Update feature-emulation.helpers.js

* Update features.js

* Update features.js

* Update definitions.js

* Update definitions.js

* Update definitions.js

* Update definitions.js

* Update features.js

* Update src/lib/definitions.js

Co-authored-by: Francesco Trotta <[email protected]>

* Update src/lib/features.js

Co-authored-by: Francesco Trotta <[email protected]>

* Update test/helpers/feature-emulation.helpers.js

Co-authored-by: Francesco Trotta <[email protected]>

---------

Co-authored-by: Francesco Trotta <[email protected]>
  • Loading branch information
Clayblockunova and fasttime committed Aug 9, 2024
1 parent c1a6eb9 commit 43b51b9
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/lib/definitions.js
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,7 @@ function getFHPaddingEntries(index)
var LOCALE_NUMERALS = Feature.LOCALE_NUMERALS;
var LOCALE_NUMERALS_EXT = Feature.LOCALE_NUMERALS_EXT;
var LOCATION = Feature.LOCATION;
var MOZILLA = Feature.MOZILLA;
var NAME = Feature.NAME;
var NODECONSTRUCTOR = Feature.NODECONSTRUCTOR;
var NO_FF_SRC = Feature.NO_FF_SRC;
Expand Down Expand Up @@ -975,6 +976,7 @@ function getFHPaddingEntries(index)
define('(RP_0_S + self)[10]', DOMWINDOW),
define('(RP_4_A + Date())[30]', GMT),
define('(RP_0_S + Audio)[11]', HTMLAUDIOELEMENT),
define('USER_AGENT[0]', MOZILLA),
],
'N': '"NaN"[0]',
'O':
Expand Down Expand Up @@ -1587,6 +1589,17 @@ function getFHPaddingEntries(index)
define
({ expr: '"toUpperCase"', optimize: true, solutionType: SolutionType.COMBINED_STRING }),
],
USER_AGENT:
[
define
(
{
expr: 'Function("return navigator")().userAgent',
solutionType: SolutionType.STRING,
},
MOZILLA
),
],

// Function body extra padding blocks: prepended to a function to align the function's body
// at the same position in different engines, assuming that the function header is aligned.
Expand Down
22 changes: 20 additions & 2 deletions src/lib/features.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* global Audio, Iterator, Node, console, document, history, location, self, statusbar */
/* global Audio, Iterator, Node, console, document, history, location, navigator, self, statusbar */

import { _Object_defineProperty, _Object_keys, assignNoEnum, createEmpty } from './obj-utils';
import { createFeatureClass, featuresToMask } from '~feature-hub';
Expand Down Expand Up @@ -567,6 +567,18 @@ var featureInfos =
return available;
},
},
MOZILLA:
{
description:
'Existence of user agent string navigator.userAgent that starts with "Mozilla".',
check:
function ()
{
var available =
typeof navigator === 'object' && /^Mozilla/.test(navigator.userAgent);
return available;
},
},
NAME:
{
description: 'Existence of the name property for functions.',
Expand Down Expand Up @@ -816,7 +828,7 @@ var featureInfos =
description:
'Features available in all browsers.\n' +
'No support for Node.js.',
includes: ['ANY_DOCUMENT', 'ANY_WINDOW', 'HISTORY', 'INCR_CHAR', 'STATUS'],
includes: ['ANY_DOCUMENT', 'ANY_WINDOW', 'HISTORY', 'INCR_CHAR', 'MOZILLA', 'STATUS'],
attributes:
{
'char-increment-restriction': null,
Expand Down Expand Up @@ -855,6 +867,7 @@ var featureInfos =
'LOCALE_INFINITY',
'LOCALE_NUMERALS_EXT',
'LOCATION',
'MOZILLA',
'NAME',
'NO_IE_SRC',
'NO_OLD_SAFARI_ARRAY_ITERATOR',
Expand Down Expand Up @@ -885,6 +898,7 @@ var featureInfos =
'HISTORY',
'INCR_CHAR',
'LOCATION',
'MOZILLA',
'NAME',
'STATUS',
'V8_SRC',
Expand Down Expand Up @@ -959,6 +973,7 @@ var featureInfos =
'LOCALE_INFINITY',
'LOCALE_NUMERALS_EXT',
'LOCATION',
'MOZILLA',
'NAME',
'NO_OLD_SAFARI_ARRAY_ITERATOR',
'REGEXP_STRING_ITERATOR',
Expand Down Expand Up @@ -1019,6 +1034,7 @@ var featureInfos =
'LOCALE_INFINITY',
'LOCALE_NUMERALS_EXT',
'LOCATION',
'MOZILLA',
'NAME',
'NO_OLD_SAFARI_ARRAY_ITERATOR',
'OBJECT_ARRAY_ENTRIES_CTOR',
Expand Down Expand Up @@ -1050,6 +1066,7 @@ var featureInfos =
'HISTORY',
'IE_SRC',
'INCR_CHAR',
'MOZILLA',
'OBJECT_L_LOCATION_CTOR',
'STATUS',
'UNDEFINED',
Expand Down Expand Up @@ -1204,6 +1221,7 @@ var featureInfos =
'HISTORY',
'INCR_CHAR',
'LOCATION',
'MOZILLA',
'NAME',
'NODECONSTRUCTOR',
'OBJECT_L_LOCATION_CTOR',
Expand Down
6 changes: 6 additions & 0 deletions test/helpers/feature-emulation.helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,6 +1079,12 @@
registerDefaultToStringAdapter(this, location, '[object Location]');
patchGlobalToString(this);
},
MOZILLA:
function ()
{
var navigator = { userAgent: 'Mozilla/5.0' };
override(this, 'navigator', { value: navigator });
},
NAME:
function ()
{
Expand Down

0 comments on commit 43b51b9

Please sign in to comment.