diff --git a/src/lib/definitions.js b/src/lib/definitions.js index 8c1ef0b3..52a546f5 100644 --- a/src/lib/definitions.js +++ b/src/lib/definitions.js @@ -355,6 +355,7 @@ function getFHPaddingEntries(index) var AT = Feature.AT; var ATOB = Feature.ATOB; var BARPROP = Feature.BARPROP; + var CALL_ON_GLOBAL = Feature.CALL_ON_GLOBAL; var CAPITAL_HTML = Feature.CAPITAL_HTML; var CONSOLE = Feature.CONSOLE; var DOCUMENT = Feature.DOCUMENT; @@ -909,6 +910,7 @@ function getFHPaddingEntries(index) ({ expr: '(RP_3_WA + Function("return history")())[11]', optimize: true }, HISTORY), define('(RP_1_WA + Audio)[10]', HTMLAUDIOELEMENT), define('(RP_4_A + [].entries().filter(ANY_FUNCTION))[21]', ITERATOR_HELPER), + define({ expr: '(RP_3_WA + self.history)[11]', optimize: true }, HISTORY, SELF_OBJ), ], 'I': '"Infinity"[0]', 'J': @@ -961,12 +963,15 @@ function getFHPaddingEntries(index) LOCATION ), define + ('self[TO_STRING].call(location)[SLICE_OR_SUBSTR]("-10")[1]', LOCATION, SELF_OBJ), + define ( '([][TO_STRING].call(location) + RP_1_WA).at("-10")', AT, GENERIC_ARRAY_TO_STRING, LOCATION ), + define('(self[TO_STRING].call(location) + RP_1_WA).at("-10")', AT, LOCATION, SELF_OBJ), ], 'M': [ @@ -996,6 +1001,7 @@ function getFHPaddingEntries(index) define('btoa("".italics())[0]', ATOB), define('(RP_0_S + Function("return statusbar")())[11]', BARPROP), define('"0".sup()[10]', CAPITAL_HTML), + define('(RP_0_S + self.statusbar)[11]', BARPROP, SELF_OBJ), defineCharDefault({ atob: false, charCode: false }), ], 'Q': @@ -1329,6 +1335,7 @@ function getFHPaddingEntries(index) Audio: [ define('Function("return Audio")()', HTMLAUDIOELEMENT), + define('self.Audio', HTMLAUDIOELEMENT, SELF_OBJ), ], Boolean: [ @@ -1337,6 +1344,7 @@ function getFHPaddingEntries(index) Date: [ define('Function("return Date")()'), + define('self.Date', SELF_OBJ), ], Function: [ @@ -1345,10 +1353,12 @@ function getFHPaddingEntries(index) Intl: [ define('Function("return Intl")()', INTL), + define('self.Intl', INTL, SELF_OBJ), ], Node: [ define('Function("return Node")()', NODECONSTRUCTOR), + define('self.Node', NODECONSTRUCTOR, SELF_OBJ), ], Number: [ @@ -1371,30 +1381,37 @@ function getFHPaddingEntries(index) atob: [ define('Function("return atob")()', ATOB), + define('self.atob', ATOB, SELF_OBJ), ], btoa: [ define('Function("return btoa")()', ATOB), + define('self.btoa', ATOB, SELF_OBJ), ], document: [ define({ expr: 'Function("return document")()', optimize: true }, ANY_DOCUMENT), + define({ expr: 'self.document', optimize: true }, ANY_DOCUMENT, SELF_OBJ), ], escape: [ define({ expr: 'Function("return escape")()', optimize: true }), + define({ expr: 'self.escape', optimize: true }, SELF_OBJ), ], location: [ define('Function("return location")()', LOCATION), + define('self.location', LOCATION, SELF_OBJ), ], self: [ define('Function("return self")()', SELF_OBJ), + define('[].concat.call()[0]', CALL_ON_GLOBAL, SELF_OBJ), ], unescape: [ define({ expr: 'Function("return unescape")()', optimize: true }), + define({ expr: 'self.unescape', optimize: true }, SELF_OBJ), ], // Custom definitions @@ -1543,6 +1560,8 @@ function getFHPaddingEntries(index) [ define('Function("return location")().constructor', OBJECT_L_LOCATION_CTOR), define('Function("return location")().constructor', OLD_SAFARI_LOCATION_CTOR), + define('self.location.constructor', OBJECT_L_LOCATION_CTOR, SELF_OBJ), + define('self.location.constructor', OLD_SAFARI_LOCATION_CTOR, SELF_OBJ), ], PLAIN_OBJECT: [ @@ -1599,6 +1618,12 @@ function getFHPaddingEntries(index) }, MOZILLA ), + define + ( + { expr: 'self.navigator.userAgent', solutionType: SolutionType.STRING }, + MOZILLA, + SELF_OBJ + ), ], // Function body extra padding blocks: prepended to a function to align the function's body diff --git a/src/lib/features.js b/src/lib/features.js index a336de8a..00a8186d 100644 --- a/src/lib/features.js +++ b/src/lib/features.js @@ -190,6 +190,23 @@ var featureInfos = }, attributes: { 'web-worker': 'web-worker-restriction' }, }, + CALL_ON_GLOBAL: + { + description: + 'The ability to call a function on the global object when invoking ' + + 'Function.prototype.call without binding.', + check: + function () + { + try + { + if ([].concat.call()[0]) + return true; + } + catch (error) + { } + }, + }, CAPITAL_HTML: { description: @@ -890,6 +907,7 @@ var featureInfos = [ 'ANY_DOCUMENT', 'ATOB', + 'CALL_ON_GLOBAL', 'CONSOLE', 'DOMWINDOW', 'ESC_HTML_ALL', @@ -908,7 +926,7 @@ var featureInfos = { inherits: 'ANDRO_4_0', versions: [['4.1',, '4.3']], - includes: { GENERIC_ARRAY_TO_STRING: true, OBJECT_UNDEFINED: true }, + includes: { CALL_ON_GLOBAL: false, GENERIC_ARRAY_TO_STRING: true, OBJECT_UNDEFINED: true }, }, ANDRO_4_4: {