mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 08:04:49 +01:00
proxy obj regex: rewrite known window property (this.window, this.location, this.document, etc...) access to use proxy obj instead
This commit is contained in:
parent
e9fa167564
commit
496defda42
@ -181,6 +181,8 @@ if (!self.__WB_pmw) {{ self.__WB_pmw = function(obj) {{ return obj; }} }}\n\
|
||||
def __init__(self, rewriter, rules=[]):
|
||||
rules = rules + [
|
||||
(r'Function\(["\']return this["\']\)', RegexRewriter.format('Function("return this._WB_wombat_obj_proxy || this")'), 0),
|
||||
(r'(?<![$.])\bthis\b(?=(?:\.(?:{0})))'.format('|'.join(self.local_objs)),
|
||||
RegexRewriter.format('(this && this._WB_wombat_obj_proxy || this)'), 0),
|
||||
(r'(?<=\.)postMessage\b\(', RegexRewriter.add_prefix('__WB_pmw(self).'), 0),
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user