From b2f3a580c2d4e7151ea62100de77d8df359df1c9 Mon Sep 17 00:00:00 2001 From: Ilya Kreymer Date: Tue, 22 Aug 2017 13:51:10 -0700 Subject: [PATCH] wombat work: - for prototype override, ensure object exists - for domain setter, ensure location exists, default to window rules: expand facebook rule to match fbid also --- pywb/rules.yaml | 3 ++- pywb/static/wombat.js | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/pywb/rules.yaml b/pywb/rules.yaml index 2266cb0d..a5be4dea 100644 --- a/pywb/rules.yaml +++ b/pywb/rules.yaml @@ -59,7 +59,8 @@ rules: #================================================================= - url_prefix: 'com,facebook)/ajax/pagelet/generic.php/' - fuzzy_lookup: 'com,facebook\)/.*[?&]data=(.*?(?:[&]|query_type[^,]+))' + #fuzzy_lookup: 'com,facebook\)/.*[?&]data=(.*?(?:[&]|query_type[^,]+))' + fuzzy_lookup: 'com,facebook\)/.*[?&]data=(.*?(?:[&]|(?:query_type|fbid)[^,]+))' - url_prefix: 'com,facebook)/ajax/ufi/' diff --git a/pywb/static/wombat.js b/pywb/static/wombat.js index 988a07cc..19ab534c 100644 --- a/pywb/static/wombat.js +++ b/pywb/static/wombat.js @@ -2138,6 +2138,9 @@ var _WBWombat = function($wbwindow, wbinfo) { //============================================ function override_func_this_proxy_to_obj(cls, method) { + if (!cls || !cls.prototype) { + return; + } var prototype = cls.prototype; var orig = prototype[method]; @@ -2150,6 +2153,9 @@ var _WBWombat = function($wbwindow, wbinfo) { //============================================ function override_func_first_arg_proxy_to_obj(cls, method) { + if (!cls || !cls.prototype) { + return; + } var prototype = cls.prototype; var orig = prototype[method]; @@ -2415,7 +2421,9 @@ var _WBWombat = function($wbwindow, wbinfo) { // domain var domain_setter = function(val) { - if (ends_with(this._WB_wombat_location.hostname, val)) { + var loc = this._WB_wombat_location || this.defaultView._WB_wombat_location; + + if (loc && ends_with(loc.hostname, val)) { this.__wb_domain = val; } }