From a76dbefec2fa8f9f5b446d6aeb6ffc732cb379aa Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 14 Mar 2017 11:42:06 -0700 Subject: [PATCH] regex rewrite: loosen rules for top & location rewrite, add tests .WB_wombat_location and .WB_wombat_top overrides should help with less strict rewriting --- pywb/rewrite/regex_rewriters.py | 4 +--- pywb/rewrite/test/test_regex_rewriters.py | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pywb/rewrite/regex_rewriters.py b/pywb/rewrite/regex_rewriters.py index f17b5f24..b0adc383 100644 --- a/pywb/rewrite/regex_rewriters.py +++ b/pywb/rewrite/regex_rewriters.py @@ -132,9 +132,7 @@ class JSLocationRewriterMixin(object): def __init__(self, rewriter, rules=[], prefix='WB_wombat_'): rules = rules + [ # (r'(?>> _test_js('cool_Location = "http://example.com/abc.html"') 'cool_Location = "/web/20131010/http://example.com/abc.html"' +>>> _test_js('$location = cond ? a.location: location; location$') +'$location = cond ? a.WB_wombat_location: WB_wombat_location; location$' + # not rewriting WB_wombat_domain #>>> _test_js('window.location = "http://example.com/abc.html" document.domain = "anotherdomain.com"') #'window.WB_wombat_location = "/web/20131010/http://example.com/abc.html" document.WB_wombat_domain = "anotherdomain.com"'