@webrecorder/wombat 3.8.13 → 3.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/wombat.js CHANGED
@@ -12,7 +12,6 @@ import {
12
12
 
13
13
  import { postToGetUrl } from 'warcio/utils';
14
14
 
15
-
16
15
  /**
17
16
  * @param {Window} $wbwindow
18
17
  * @param {Object} wbinfo
@@ -62,7 +61,15 @@ function Wombat($wbwindow, wbinfo) {
62
61
  this.WB_CHECK_THIS_FUNC = '_____WB$wombat$check$this$function_____';
63
62
  this.WB_ASSIGN_FUNC = '_____WB$wombat$assign$function_____';
64
63
 
65
- this.SKIP_OWN_FUNC_PROPS = ['name', 'length', '__WB_is_native_func__', 'arguments', 'caller', 'callee', 'prototype'];
64
+ this.SKIP_OWN_FUNC_PROPS = [
65
+ 'name',
66
+ 'length',
67
+ '__WB_is_native_func__',
68
+ 'arguments',
69
+ 'caller',
70
+ 'callee',
71
+ 'prototype'
72
+ ];
66
73
 
67
74
  this.OVERRIDE_PROPS = [
68
75
  'window',
@@ -277,6 +284,9 @@ function Wombat($wbwindow, wbinfo) {
277
284
  /** @type {RegExp} */
278
285
  this.IP_RX = /^(\d)+\.(\d)+\.(\d)+\.(\d)+$/;
279
286
 
287
+ /** @type {RegExp} */
288
+ this.REPLACE_MOD = /(\/[\d]*)([\w]+_)(?=\/)/;
289
+
280
290
  /** @type {RegExp} */
281
291
  this.FullHTMLRegex = /^\s*<(?:html|head|body|frameset|frame|!doctype html)/i;
282
292
 
@@ -477,29 +487,33 @@ Wombat.prototype.isString = function(arg) {
477
487
  return arg != null && Object.getPrototypeOf(arg) === String.prototype;
478
488
  };
479
489
 
480
-
481
490
  /**
482
491
  * Create blob for content, convert to service-worker based blob URL
483
492
  * set iframe to remove blob URL on unload
484
493
  *
485
- */
494
+ */
486
495
 
487
496
  Wombat.prototype.blobUrlForIframe = function(iframe, string) {
488
- var blob = new Blob([string], {type: 'text/html'});
497
+ var blob = new Blob([string], { type: 'text/html' });
489
498
  var url = this.URL.createObjectURL(blob);
490
499
  var URL = this.URL;
491
500
 
492
501
  iframe.__wb_blobSrc = url;
493
- iframe.addEventListener('load', function() {
494
- if (iframe.__wb_blobSrc) {
495
- URL.revokeObjectURL(iframe.__wb_blobSrc);
496
- iframe.__wb_blobSrc = null;
497
- }
498
- }, {once: true});
502
+ iframe.addEventListener(
503
+ 'load',
504
+ function() {
505
+ if (iframe.__wb_blobSrc) {
506
+ URL.revokeObjectURL(iframe.__wb_blobSrc);
507
+ iframe.__wb_blobSrc = null;
508
+ }
509
+ },
510
+ { once: true }
511
+ );
499
512
 
500
513
  iframe.__wb_origSrc = iframe.src;
501
514
  var blobIdUrl = url.slice(url.lastIndexOf('/') + 1) + '/' + this.wb_info.url;
502
- iframe.src = this.wb_info.prefix + this.wb_info.request_ts + 'mp_/blob:' + blobIdUrl;
515
+ iframe.src =
516
+ this.wb_info.prefix + this.wb_info.request_ts + 'mp_/blob:' + blobIdUrl;
503
517
  };
504
518
 
505
519
  /**
@@ -697,7 +711,11 @@ Wombat.prototype.shouldRewriteAttr = function(tagName, attr) {
697
711
  */
698
712
  Wombat.prototype.skipWrapScriptBasedOnType = function(scriptType) {
699
713
  if (!scriptType) return false;
700
- if (scriptType.indexOf('javascript') >= 0 || scriptType.indexOf('ecmascript') >= 0) return false;
714
+ if (
715
+ scriptType.indexOf('javascript') >= 0 ||
716
+ scriptType.indexOf('ecmascript') >= 0
717
+ )
718
+ return false;
701
719
  if (scriptType.indexOf('json') >= 0) return true;
702
720
  if (scriptType.indexOf('text/') >= 0) return true;
703
721
  return false;
@@ -780,7 +798,7 @@ Wombat.prototype.rwModForElement = function(elem, attrName) {
780
798
  }
781
799
  }
782
800
  } else if (elem.tagName === 'SCRIPT') {
783
- return (elem.type === 'module' ? 'esm_' : 'js_');
801
+ return elem.type === 'module' ? 'esm_' : 'js_';
784
802
  } else {
785
803
  // check if this element has an rewrite modifiers and set mod to it if it does
786
804
  var maybeMod = this.tagToMod[elem.tagName];
@@ -840,7 +858,7 @@ Wombat.prototype.retrieveWBOSRC = function(elem) {
840
858
  * @return {string}
841
859
  */
842
860
  Wombat.prototype.wrapScriptTextJsProxy = function(scriptText, excludes = []) {
843
- let prefix =
861
+ let prefix =
844
862
  'var _____WB$wombat$assign$function_____ = function(name) {return ' +
845
863
  '(self._wb_wombat && self._wb_wombat.local_init && self._wb_wombat.local_init(name)) || self[name]; };\n' +
846
864
  'if (!self.__WB_pmw) { self.__WB_pmw = function(obj) { ' +
@@ -854,8 +872,13 @@ Wombat.prototype.wrapScriptTextJsProxy = function(scriptText, excludes = []) {
854
872
 
855
873
  prefix += '{\n';
856
874
 
857
- scriptText = scriptText.replace(this.IMPORT_JS_CALL, (x) => x.replace('import', '____wb_rewrite_import__'));
858
- scriptText = scriptText.replace(this.DotPostMessageRe, '.__WB_pmw(self.window)$1');
875
+ scriptText = scriptText.replace(this.IMPORT_JS_CALL, x =>
876
+ x.replace('import', '____wb_rewrite_import__')
877
+ );
878
+ scriptText = scriptText.replace(
879
+ this.DotPostMessageRe,
880
+ '.__WB_pmw(self.window)$1'
881
+ );
859
882
 
860
883
  return prefix + scriptText + '\n\n}}';
861
884
  };
@@ -949,7 +972,10 @@ Wombat.prototype.resolveRelUrl = function(url, doc) {
949
972
  if (!doc || !doc.baseURI) {
950
973
  return false;
951
974
  }
952
- return (doc.baseURI.startsWith(wombat.HTTPS_PREFIX) || doc.baseURI.startsWith(wombat.HTTP_PREFIX));
975
+ return (
976
+ doc.baseURI.startsWith(wombat.HTTPS_PREFIX) ||
977
+ doc.baseURI.startsWith(wombat.HTTP_PREFIX)
978
+ );
953
979
  }
954
980
 
955
981
  var baseURI = null;
@@ -1026,7 +1052,8 @@ Wombat.prototype.extractOriginalURL = function(rewrittenUrl) {
1026
1052
 
1027
1053
  if (
1028
1054
  url !== rwURLString &&
1029
- !this.startsWithOneOf(url, this.VALID_PREFIXES) && !this.startsWith(url, 'blob:')
1055
+ !this.startsWithOneOf(url, this.VALID_PREFIXES) &&
1056
+ !this.startsWith(url, 'blob:')
1030
1057
  ) {
1031
1058
  url = this.wb_orig_scheme + url;
1032
1059
  }
@@ -1071,7 +1098,6 @@ Wombat.prototype.makeParser = function(maybeRewrittenURL, doc) {
1071
1098
  }
1072
1099
 
1073
1100
  return this._makeURLParser(originalURL, docElem);
1074
-
1075
1101
  };
1076
1102
 
1077
1103
  Wombat.prototype._makeURLParser = function(url, docElem) {
@@ -1419,7 +1445,6 @@ Wombat.prototype.defaultProxyGet = function(obj, prop, ownProps, fnCache) {
1419
1445
  return retVal._WB_wombat_obj_proxy;
1420
1446
  } catch (e) {}
1421
1447
  }
1422
-
1423
1448
  } else if (type === 'function' && ownProps.indexOf(prop) !== -1) {
1424
1449
  // certain sites (e.g. facebook) are applying polyfills to native functions
1425
1450
  // treating the polyfill as a native function [fn.bind(obj)] causes incorrect execution of the polyfill
@@ -1461,7 +1486,6 @@ Wombat.prototype.defaultProxyGet = function(obj, prop, ownProps, fnCache) {
1461
1486
  return boundFn;
1462
1487
  }
1463
1488
  return cachedFN.boundFn;
1464
-
1465
1489
  } else if (type === 'object' && retVal && retVal._WB_wombat_obj_proxy) {
1466
1490
  if (retVal instanceof this.WBWindow) {
1467
1491
  this.initNewWindowWombat(retVal);
@@ -1627,7 +1651,6 @@ Wombat.prototype.styleReplacer = function(match, n1, n2, n3, offset, string) {
1627
1651
  return n1 + this.rewriteUrl(n2) + n3;
1628
1652
  };
1629
1653
 
1630
-
1631
1654
  /**
1632
1655
  * Due to the fact that we override specific DOM constructors, e.g. Worker,
1633
1656
  * the normal TypeErrors are not thrown if the pre-conditions for those
@@ -1859,10 +1882,7 @@ Wombat.prototype.rewriteUrl_ = function(originalURL, useRel, mod, doc) {
1859
1882
  // Check for this and add it back in, eg http://localhost/path/ -> http://localhost:8080/path/
1860
1883
  if (
1861
1884
  this.origHost !== this.origHostname &&
1862
- this.startsWith(
1863
- url,
1864
- this.origProtocol + '//' + this.origHostname + '/'
1865
- )
1885
+ this.startsWith(url, this.origProtocol + '//' + this.origHostname + '/')
1866
1886
  ) {
1867
1887
  return url.replace(
1868
1888
  '/' + this.origHostname + '/',
@@ -2029,7 +2049,8 @@ Wombat.prototype.performAttributeRewrite = function(
2029
2049
  return value;
2030
2050
  }
2031
2051
  var mod = this.rwModForElement(elem, name);
2032
- if (elem &&
2052
+ if (
2053
+ elem &&
2033
2054
  this.wbUseAFWorker &&
2034
2055
  this.WBAutoFetchWorker &&
2035
2056
  this.isSavedDataSrcSrcset(elem)
@@ -2039,7 +2060,7 @@ Wombat.prototype.performAttributeRewrite = function(
2039
2060
  var result = this.rewriteUrl(value, false, mod, ownerDoc);
2040
2061
  if (mod === 'esm_' && result && result.indexOf('esm_/') < 0) {
2041
2062
  // replace current modifier with esm_ if already rewritten
2042
- result = result.replace(/(\/[\d]*)([\w]+_)(?=\/)/, '$1esm_');
2063
+ result = result.replace(this.REPLACE_MOD, '$1esm_');
2043
2064
  }
2044
2065
  return result;
2045
2066
  };
@@ -2053,7 +2074,13 @@ Wombat.prototype.performAttributeRewrite = function(
2053
2074
  */
2054
2075
  Wombat.prototype.rewriteAttr = function(elem, name, absUrlOnly) {
2055
2076
  var changed = false;
2056
- if (!elem || !elem.getAttribute || elem._no_rewrite || elem['_' + name] || (elem.tagName && elem.tagName.indexOf('-') > 0)) {
2077
+ if (
2078
+ !elem ||
2079
+ !elem.getAttribute ||
2080
+ elem._no_rewrite ||
2081
+ elem['_' + name] ||
2082
+ (elem.tagName && elem.tagName.indexOf('-') > 0)
2083
+ ) {
2057
2084
  return changed;
2058
2085
  }
2059
2086
 
@@ -2061,7 +2088,13 @@ Wombat.prototype.rewriteAttr = function(elem, name, absUrlOnly) {
2061
2088
 
2062
2089
  if (!value || this.startsWith(value, 'javascript:')) return changed;
2063
2090
 
2064
- var new_value = this.performAttributeRewrite(elem, name, value, elem.ownerDocument, absUrlOnly);
2091
+ var new_value = this.performAttributeRewrite(
2092
+ elem,
2093
+ name,
2094
+ value,
2095
+ elem.ownerDocument,
2096
+ absUrlOnly
2097
+ );
2065
2098
 
2066
2099
  if (new_value !== value) {
2067
2100
  this.removeWBOSRC(elem);
@@ -2345,7 +2378,10 @@ Wombat.prototype.rewriteElem = function(elem) {
2345
2378
  if (!src) {
2346
2379
  elem.__WB_blank = true;
2347
2380
  }
2348
- elem.src = this.wb_info.prefix + this.wb_info.request_ts + 'mp_/about:blank';
2381
+ elem.src =
2382
+ this.wb_info.prefix +
2383
+ this.wb_info.request_ts +
2384
+ 'mp_/about:blank';
2349
2385
  }
2350
2386
  }
2351
2387
  }
@@ -2523,10 +2559,13 @@ Wombat.prototype.rewriteHtml = function(string, checkEndTag) {
2523
2559
  !this.endsWith(rwString.toLowerCase(), end_tag)
2524
2560
  ) {
2525
2561
  new_html = new_html.substring(0, new_html.length - end_tag.length);
2526
- // similarly, check if original had extra ending tags that rewritten did not
2527
- // eg. <a>...</a></div> rewritten to <a>...</a>, then we add the remaining </div>
2528
- // currently only works with different tags
2529
- } else if (new_html.trimEnd().endsWith(end_tag) && !rwString.trimEnd().endsWith(end_tag)) {
2562
+ // similarly, check if original had extra ending tags that rewritten did not
2563
+ // eg. <a>...</a></div> rewritten to <a>...</a>, then we add the remaining </div>
2564
+ // currently only works with different tags
2565
+ } else if (
2566
+ new_html.trimEnd().endsWith(end_tag) &&
2567
+ !rwString.trimEnd().endsWith(end_tag)
2568
+ ) {
2530
2569
  var lastInx = rwString.lastIndexOf(end_tag);
2531
2570
  if (lastInx > 0) {
2532
2571
  new_html += rwString.slice(lastInx + end_tag.length);
@@ -2683,8 +2722,12 @@ Wombat.prototype.rewriteWorker = function(workerUrl, opts) {
2683
2722
  workerUrl = workerUrl.toString();
2684
2723
  var isBlob = workerUrl.indexOf('blob:') === 0;
2685
2724
  var isJS = workerUrl.indexOf('javascript:') === 0;
2686
- var mod = (opts && opts.type === 'module') ? 'wkrm_' : 'wkr_';
2725
+ var isModule = opts && opts.type === 'module';
2726
+ var mod = isModule ? 'wkrm_' : 'wkr_';
2687
2727
  if (!isBlob && !isJS) {
2728
+ if (this.startsWithOneOf(workerUrl, this.wb_prefixes)) {
2729
+ return workerUrl.replace(this.REPLACE_MOD, '$1' + mod);
2730
+ }
2688
2731
  if (
2689
2732
  !this.startsWithOneOf(workerUrl, this.VALID_PREFIXES) &&
2690
2733
  !this.startsWith(workerUrl, '/') &&
@@ -2867,7 +2910,10 @@ Wombat.prototype.rewriteSetTimeoutInterval = function(
2867
2910
  Wombat.prototype.rewriteHTMLAssign = function(thisObj, oSetter, newValue) {
2868
2911
  var res = newValue;
2869
2912
  var tagName = thisObj.tagName;
2870
- if (!thisObj._no_rewrite && !(thisObj instanceof this.$wbwindow.HTMLTemplateElement)) {
2913
+ if (
2914
+ !thisObj._no_rewrite &&
2915
+ !(thisObj instanceof this.$wbwindow.HTMLTemplateElement)
2916
+ ) {
2871
2917
  if (tagName === 'STYLE') {
2872
2918
  res = this.rewriteStyle(newValue);
2873
2919
  } else if (tagName === 'SCRIPT') {
@@ -2911,13 +2957,21 @@ Wombat.prototype.rewriteHTMLAssign = function(thisObj, oSetter, newValue) {
2911
2957
  * @param {*} evalArg
2912
2958
  * @return {*}
2913
2959
  */
2914
- Wombat.prototype.rewriteEvalArg = function(rawEvalOrWrapper, evalArg, extraArg) {
2915
- if (this.$wbwindow.TrustedScript && (evalArg instanceof this.$wbwindow.TrustedScript)) {
2960
+ Wombat.prototype.rewriteEvalArg = function(
2961
+ rawEvalOrWrapper,
2962
+ evalArg,
2963
+ extraArg
2964
+ ) {
2965
+ if (
2966
+ this.$wbwindow.TrustedScript &&
2967
+ evalArg instanceof this.$wbwindow.TrustedScript
2968
+ ) {
2916
2969
  evalArg = evalArg.toString();
2917
2970
  }
2918
2971
  var excludes = [];
2919
2972
  var toBeEvald =
2920
- this.isString(evalArg) && !this.skipWrapScriptTextBasedOnText(evalArg, excludes)
2973
+ this.isString(evalArg) &&
2974
+ !this.skipWrapScriptTextBasedOnText(evalArg, excludes)
2921
2975
  ? this.wrapScriptTextJsProxy(evalArg, excludes)
2922
2976
  : this.otherEvalRewrite(evalArg);
2923
2977
  return rawEvalOrWrapper(toBeEvald, extraArg);
@@ -2930,7 +2984,7 @@ Wombat.prototype.rewriteEvalArg = function(rawEvalOrWrapper, evalArg, extraArg)
2930
2984
  */
2931
2985
 
2932
2986
  Wombat.prototype.otherEvalRewrite = function(value) {
2933
- if (typeof(value) !== 'string') {
2987
+ if (typeof value !== 'string') {
2934
2988
  return value;
2935
2989
  }
2936
2990
  return value.replace(this.IMPORT_JS_REGEX, this.styleReplacer);
@@ -3031,11 +3085,12 @@ Wombat.prototype.overrideAttr = function(obj, attr, mod) {
3031
3085
  if (!this.__$removedWBOSRC$__) {
3032
3086
  wombat.removeWBOSRC(this);
3033
3087
  }
3034
- if (this.type === 'module') {
3035
- mod = 'esm_';
3036
- }
3037
3088
  }
3038
- var val = wombat.rewriteUrl(orig, false, mod);
3089
+ var val = wombat.rewriteUrl(
3090
+ orig,
3091
+ false,
3092
+ this.type === 'module' ? 'esm_' : mod
3093
+ );
3039
3094
  if (orig_setter) {
3040
3095
  return orig_setter.call(this, val);
3041
3096
  } else if (wombat.wb_setAttribute) {
@@ -3070,7 +3125,7 @@ Wombat.prototype.overridePropExtract = function(proto, prop) {
3070
3125
  var orig_getter = this.getOrigGetter(proto, prop);
3071
3126
  var wombat = this;
3072
3127
  if (orig_getter) {
3073
- var new_getter = function () {
3128
+ var new_getter = function() {
3074
3129
  var obj = wombat.proxyToObj(this);
3075
3130
  var res = orig_getter.call(obj);
3076
3131
  if (obj.__WB_no_unrewrite) {
@@ -3093,16 +3148,16 @@ Wombat.prototype.overrideDeProxyPropAssign = function(proto, prop) {
3093
3148
  var orig_getter = this.getOrigGetter(proto, prop);
3094
3149
  var wombat = this;
3095
3150
  if (orig_setter) {
3096
- var new_setter = function (value) {
3097
- return orig_setter.call(wombat.proxyToObj(this), wombat.proxyToObj(value));
3151
+ var new_setter = function(value) {
3152
+ return orig_setter.call(
3153
+ wombat.proxyToObj(this),
3154
+ wombat.proxyToObj(value)
3155
+ );
3098
3156
  };
3099
3157
  this.defProp(proto, prop, new_setter, orig_getter);
3100
3158
  }
3101
3159
  };
3102
3160
 
3103
-
3104
-
3105
-
3106
3161
  /**
3107
3162
  * Overrides referrer -- if top-replay frame, referrer should be "", otherwise extractOriginURL
3108
3163
  * @param {Object} proto
@@ -3131,7 +3186,6 @@ Wombat.prototype.overrideReferrer = function($document) {
3131
3186
  }
3132
3187
  };
3133
3188
 
3134
-
3135
3189
  /**
3136
3190
  * Applies an attribute getter override IFF an original getter exists that
3137
3191
  * ensures that the results of retrieving the attributes value is not a
@@ -3242,7 +3296,7 @@ Wombat.prototype.overrideStyleAttr = function(obj, attr, propName) {
3242
3296
 
3243
3297
  var getter = orig_getter;
3244
3298
 
3245
- var extractUrl = function (_, p1, p2, p3, p4) {
3299
+ var extractUrl = function(_, p1, p2, p3, p4) {
3246
3300
  return p1 + (p2 || '') + wombat.extractOriginalURL(p3) + p4;
3247
3301
  };
3248
3302
 
@@ -3382,7 +3436,6 @@ Wombat.prototype.overrideHtmlAssignSrcDoc = function(elem, prop) {
3382
3436
  this.defProp(obj, prop, setter, getter);
3383
3437
  };
3384
3438
 
3385
-
3386
3439
  /**
3387
3440
  * Override .dataset attribute on element and wraps in a proxy that unrewrites URLs
3388
3441
  */
@@ -3397,10 +3450,12 @@ Wombat.prototype.overrideDataSet = function() {
3397
3450
 
3398
3451
  var proxy = new Proxy(dataset, {
3399
3452
  get(target, prop, receiver) {
3400
-
3401
3453
  var result = target[prop];
3402
3454
 
3403
- if (typeof(result) === 'string' && wombat.startsWithOneOf(result, wombat.wb_prefixes)) {
3455
+ if (
3456
+ typeof result === 'string' &&
3457
+ wombat.startsWithOneOf(result, wombat.wb_prefixes)
3458
+ ) {
3404
3459
  return wombat.extractOriginalURL(result);
3405
3460
  }
3406
3461
 
@@ -3414,7 +3469,6 @@ Wombat.prototype.overrideDataSet = function() {
3414
3469
  this.defProp(obj, 'dataset', null, getter);
3415
3470
  };
3416
3471
 
3417
-
3418
3472
  /**
3419
3473
  * Override .style attribute on element and wraps in a proxy that unrewrites URLs
3420
3474
  */
@@ -3443,7 +3497,10 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3443
3497
  get(target, prop, receiver) {
3444
3498
  var value = target[prop];
3445
3499
 
3446
- if (typeof value === 'function' && (prop === 'setProperty' || wombat.isNativeFunction(value))) {
3500
+ if (
3501
+ typeof value === 'function' &&
3502
+ (prop === 'setProperty' || wombat.isNativeFunction(value))
3503
+ ) {
3447
3504
  if (!fnCache[prop]) {
3448
3505
  fnCache[prop] = value.bind(style);
3449
3506
  }
@@ -3451,7 +3508,7 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3451
3508
  }
3452
3509
 
3453
3510
  return value;
3454
- },
3511
+ }
3455
3512
  });
3456
3513
 
3457
3514
  return proxy;
@@ -3460,8 +3517,6 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3460
3517
  this.defProp(obj, 'style', orig_setter, getter);
3461
3518
  };
3462
3519
 
3463
-
3464
-
3465
3520
  /**
3466
3521
  * Overrides the getter and setter functions for the supplied property
3467
3522
  * on the HTMLIFrameElement
@@ -3491,33 +3546,40 @@ Wombat.prototype.overrideIframeContentAccess = function(prop) {
3491
3546
  obj['_get_' + prop] = orig_getter;
3492
3547
  };
3493
3548
 
3494
-
3495
3549
  Wombat.prototype.overrideSWAccess = function($wbwindow) {
3496
- if (!$wbwindow.navigator.serviceWorker || !$wbwindow.navigator.serviceWorker.controller) {
3550
+ if (
3551
+ !$wbwindow.navigator.serviceWorker ||
3552
+ !$wbwindow.navigator.serviceWorker.controller
3553
+ ) {
3497
3554
  return;
3498
3555
  }
3499
3556
 
3500
3557
  $wbwindow._WB_wombat_sw = $wbwindow.navigator.serviceWorker;
3501
3558
 
3502
-
3503
3559
  var overrideSW = {
3504
- 'controller': null,
3505
- 'ready': Promise.resolve({'unregister': function() {} }),
3506
- 'register': function() { return Promise.reject(); },
3507
- 'addEventListener': function() {},
3508
- 'removeEventListener': function() {},
3509
- 'onmessage': null,
3510
- 'oncontrollerchange': null,
3511
- 'getRegistrations': function() { return Promise.resolve([]); },
3512
- 'getRegistration': function() { return Promise.resolve(undefined); },
3513
- 'startMessages': function() {}
3514
- };
3560
+ controller: null,
3561
+ ready: Promise.resolve({ unregister: function() {} }),
3562
+ register: function() {
3563
+ return Promise.reject();
3564
+ },
3565
+ addEventListener: function() {},
3566
+ removeEventListener: function() {},
3567
+ onmessage: null,
3568
+ oncontrollerchange: null,
3569
+ getRegistrations: function() {
3570
+ return Promise.resolve([]);
3571
+ },
3572
+ getRegistration: function() {
3573
+ return Promise.resolve(undefined);
3574
+ },
3575
+ startMessages: function() {}
3576
+ };
3515
3577
 
3516
- this.defGetterProp($wbwindow.navigator, 'serviceWorker', function() { return overrideSW; });
3578
+ this.defGetterProp($wbwindow.navigator, 'serviceWorker', function() {
3579
+ return overrideSW;
3580
+ });
3517
3581
  };
3518
3582
 
3519
-
3520
-
3521
3583
  /**
3522
3584
  * Overrides the supplied method in order to ensure that the `this` argument
3523
3585
  * of the function is not one of the JS Proxy objects used by wombat.
@@ -3588,7 +3650,10 @@ Wombat.prototype.overrideFunctionApply = function($wbwindow) {
3588
3650
  return;
3589
3651
  }
3590
3652
  var orig_apply = $wbwindow.Function.prototype.apply;
3591
- $wbwindow.Function.prototype.__WB_orig_apply = orig_apply;
3653
+ Object.defineProperty($wbwindow.Function.prototype, '__WB_orig_apply', {
3654
+ value: orig_apply,
3655
+ enumarable: false
3656
+ });
3592
3657
  var wombat = this;
3593
3658
  $wbwindow.Function.prototype.apply = function apply(obj, args) {
3594
3659
  // if native function, de-proxy
@@ -3603,7 +3668,6 @@ Wombat.prototype.overrideFunctionApply = function($wbwindow) {
3603
3668
  this.wb_funToString.apply = orig_apply;
3604
3669
  };
3605
3670
 
3606
-
3607
3671
  /**
3608
3672
  * Overrides Function.prototype.call in order to ensure that none of the
3609
3673
  * arguments of `native` functions are one of the JS Proxy objects used by wombat.
@@ -3614,7 +3678,10 @@ Wombat.prototype.overrideFunctionCall = function($wbwindow) {
3614
3678
  return;
3615
3679
  }
3616
3680
  var orig_call = $wbwindow.Function.prototype.call;
3617
- $wbwindow.Function.prototype.__WB_orig_call = orig_call;
3681
+ Object.defineProperty($wbwindow.Function.prototype, '__WB_orig_call', {
3682
+ value: orig_call,
3683
+ enumarable: false
3684
+ });
3618
3685
  var wombat = this;
3619
3686
  $wbwindow.Function.prototype.call = function call(obj, ...args) {
3620
3687
  // if native function, de-proxy
@@ -3638,19 +3705,21 @@ Wombat.prototype.overrideFunctionBind = function($wbwindow) {
3638
3705
  return;
3639
3706
  }
3640
3707
  var orig_bind = $wbwindow.Function.prototype.bind;
3641
- $wbwindow.Function.prototype.__WB_orig_bind = orig_bind;
3708
+ Object.defineProperty($wbwindow.Function.prototype, '__WB_orig_bind', {
3709
+ value: orig_bind,
3710
+ enumarable: false
3711
+ });
3642
3712
  var wombat = this;
3643
3713
  $wbwindow.Function.prototype.bind = function bind(obj) {
3644
3714
  var isNative = wombat.isNativeFunction(this);
3645
- var result = isNative ? this.__WB_orig_bind.apply(this, arguments) : this.__WB_orig_bind.__WB_orig_apply(this, arguments);
3715
+ var result = isNative
3716
+ ? this.__WB_orig_bind.apply(this, arguments)
3717
+ : this.__WB_orig_bind.__WB_orig_apply(this, arguments);
3646
3718
  result.__WB_is_native_func__ = isNative;
3647
3719
  return result;
3648
3720
  };
3649
3721
  };
3650
3722
 
3651
-
3652
-
3653
-
3654
3723
  /**
3655
3724
  * Overrides the getter and setter functions for the `srcset` property
3656
3725
  * of the supplied Object in order to rewrite accesses and retrievals
@@ -4020,15 +4089,15 @@ Wombat.prototype.initAttrOverrides = function() {
4020
4089
  var style_proto = this.$wbwindow.CSSStyleDeclaration.prototype;
4021
4090
 
4022
4091
  var cssAttrToProps = {
4023
- 'background': 'background',
4024
- 'backgroundImage': 'background-image',
4025
- 'cursor': 'cursor',
4026
- 'listStyle': 'list-style',
4027
- 'listStyleImage': 'list-style-image',
4028
- 'border': 'border',
4029
- 'borderImage': 'border-image',
4030
- 'borderImageSource': 'border-image-source',
4031
- 'maskImage': 'mask-image'
4092
+ background: 'background',
4093
+ backgroundImage: 'background-image',
4094
+ cursor: 'cursor',
4095
+ listStyle: 'list-style',
4096
+ listStyleImage: 'list-style-image',
4097
+ border: 'border',
4098
+ borderImage: 'border-image',
4099
+ borderImageSource: 'border-image-source',
4100
+ maskImage: 'mask-image'
4032
4101
  };
4033
4102
 
4034
4103
  this.overrideStyleProxy(Object.values(cssAttrToProps));
@@ -4297,7 +4366,6 @@ Wombat.prototype.initDateOverride = function(timestamp) {
4297
4366
  });
4298
4367
  };
4299
4368
 
4300
-
4301
4369
  Wombat.prototype.initBlobOverride = function() {
4302
4370
  // don't use for SW replay as blob: iframes won't have access to SW
4303
4371
  if (!this.$wbwindow.Blob || this.wb_info.isSW) {
@@ -4310,10 +4378,17 @@ Wombat.prototype.initBlobOverride = function() {
4310
4378
 
4311
4379
  this.$wbwindow.Blob = (function(Blob_) {
4312
4380
  return function Blob(array, options) {
4313
-
4314
- if (options && (options.type === 'application/xhtml+xml' || options.type === 'text/html')) {
4381
+ if (
4382
+ options &&
4383
+ (options.type === 'application/xhtml+xml' ||
4384
+ options.type === 'text/html')
4385
+ ) {
4315
4386
  // for now, just handle single string case
4316
- if (array.length === 1 && typeof(array[0]) === 'string' && wombat.startsWith(array[0], '<!DOCTYPE html>')) {
4387
+ if (
4388
+ array.length === 1 &&
4389
+ typeof array[0] === 'string' &&
4390
+ wombat.startsWith(array[0], '<!DOCTYPE html>')
4391
+ ) {
4317
4392
  array[0] = wombat.rewriteHtml(array[0]);
4318
4393
  options.type = 'text/html';
4319
4394
  }
@@ -4339,14 +4414,17 @@ Wombat.prototype.initIntersectionObsOverride = function() {
4339
4414
 
4340
4415
  return new IObs(callback, options);
4341
4416
  };
4342
-
4343
4417
  })(this.$wbwindow.IntersectionObserver);
4344
4418
 
4345
4419
  this.$wbwindow.IntersectionObserver.prototype = orig_iobs.prototype;
4346
4420
 
4347
- Object.defineProperty(this.$wbwindow.IntersectionObserver.prototype, 'constructor', {
4348
- value: this.$wbwindow.IntersectionObserver
4349
- });
4421
+ Object.defineProperty(
4422
+ this.$wbwindow.IntersectionObserver.prototype,
4423
+ 'constructor',
4424
+ {
4425
+ value: this.$wbwindow.IntersectionObserver
4426
+ }
4427
+ );
4350
4428
  };
4351
4429
 
4352
4430
  Wombat.prototype.initWSOverride = function() {
@@ -4357,10 +4435,11 @@ Wombat.prototype.initWSOverride = function() {
4357
4435
  this.$wbwindow.WebSocket = (function(WebSocket_) {
4358
4436
  function WebSocket(url, protocols) {
4359
4437
  this.openCallbacks = [];
4438
+ var ws = this;
4360
4439
 
4361
4440
  this.addEventListener = function(type, callback) {
4362
4441
  if (type === 'open') {
4363
- WebSocket.openCallbacks.push(callback);
4442
+ ws.openCallbacks.push(callback);
4364
4443
  }
4365
4444
  };
4366
4445
  this.removeEventListener = function() {};
@@ -4373,7 +4452,6 @@ Wombat.prototype.initWSOverride = function() {
4373
4452
  this.url = url;
4374
4453
  this.readyState = 1;
4375
4454
 
4376
- var ws = this;
4377
4455
  function simOpen() {
4378
4456
  var ev = new CustomEvent('open');
4379
4457
  if (ws.onopen) {
@@ -4399,7 +4477,7 @@ Wombat.prototype.initWSOverride = function() {
4399
4477
 
4400
4478
  addToStringTagToClass(this.$wbwindow.WebSocket, 'WebSocket');
4401
4479
  };
4402
-
4480
+
4403
4481
  /**
4404
4482
  * Applies an override to the document.title property in order to ensure
4405
4483
  * that actual top (archive top frame containing the replay iframe) receives
@@ -4544,7 +4622,8 @@ Wombat.prototype.initCookiePreset = function() {
4544
4622
  if (this.wb_info.presetCookie) {
4545
4623
  var splitCookies = this.wb_info.presetCookie.split(';');
4546
4624
  for (var i = 0; i < splitCookies.length; i++) {
4547
- this.$wbwindow.document.cookie = splitCookies[i].trim() + '; Path=' + this.rewriteUrl('./', true);
4625
+ this.$wbwindow.document.cookie =
4626
+ splitCookies[i].trim() + '; Path=' + this.rewriteUrl('./', true);
4548
4627
  }
4549
4628
  }
4550
4629
  };
@@ -4567,8 +4646,11 @@ Wombat.prototype.initCookiePreset = function() {
4567
4646
  Wombat.prototype.initHTTPOverrides = function() {
4568
4647
  var wombat = this;
4569
4648
 
4570
- // responseURL override
4571
- this.overridePropExtract(this.$wbwindow.XMLHttpRequest.prototype, 'responseURL');
4649
+ // responseURL override
4650
+ this.overridePropExtract(
4651
+ this.$wbwindow.XMLHttpRequest.prototype,
4652
+ 'responseURL'
4653
+ );
4572
4654
 
4573
4655
  var convertToGet = !!this.wb_info.convert_post_to_get;
4574
4656
 
@@ -4595,7 +4677,8 @@ Wombat.prototype.initHTTPOverrides = function() {
4595
4677
  }
4596
4678
  } else {
4597
4679
  var origOpen = this.$wbwindow.XMLHttpRequest.prototype.open;
4598
- var origSetRequestHeader = this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader;
4680
+ var origSetRequestHeader = this.$wbwindow.XMLHttpRequest.prototype
4681
+ .setRequestHeader;
4599
4682
  var origSend = this.$wbwindow.XMLHttpRequest.prototype.send;
4600
4683
  this.utilFns.XHRopen = origOpen;
4601
4684
  this.utilFns.XHRsend = origSend;
@@ -4607,18 +4690,24 @@ Wombat.prototype.initHTTPOverrides = function() {
4607
4690
 
4608
4691
  this.$wbwindow.XMLHttpRequest.prototype.setAttributionReporting = function() {};
4609
4692
 
4610
- this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader = function(name, value) {
4693
+ this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader = function(
4694
+ name,
4695
+ value
4696
+ ) {
4611
4697
  this.__WB_xhr_headers.set(name, value);
4612
4698
  };
4613
4699
 
4614
4700
  this.$wbwindow.XMLHttpRequest.prototype.send = async function(value) {
4615
- if (convertToGet && (this.__WB_xhr_open_arguments[0] === 'POST' || this.__WB_xhr_open_arguments[0] === 'PUT')) {
4616
-
4701
+ if (
4702
+ convertToGet &&
4703
+ (this.__WB_xhr_open_arguments[0] === 'POST' ||
4704
+ this.__WB_xhr_open_arguments[0] === 'PUT')
4705
+ ) {
4617
4706
  var request = {
4618
- 'url': this.__WB_xhr_open_arguments[1],
4619
- 'method': this.__WB_xhr_open_arguments[0],
4620
- 'headers': this.__WB_xhr_headers,
4621
- 'postData': value
4707
+ url: this.__WB_xhr_open_arguments[1],
4708
+ method: this.__WB_xhr_open_arguments[0],
4709
+ headers: this.__WB_xhr_headers,
4710
+ postData: value
4622
4711
  };
4623
4712
 
4624
4713
  if (postToGetUrl(request)) {
@@ -4631,13 +4720,21 @@ Wombat.prototype.initHTTPOverrides = function() {
4631
4720
  // sync mode: disable unless Firefox
4632
4721
  // sync xhr with service workers supported only in FF at the moment
4633
4722
  // https://wpt.fyi/results/service-workers/service-worker/fetch-request-xhr-sync.https.html
4634
- if (this.__WB_xhr_open_arguments.length > 2 && !this.__WB_xhr_open_arguments[2] && navigator.userAgent.indexOf('Firefox') === -1) {
4723
+ if (
4724
+ this.__WB_xhr_open_arguments.length > 2 &&
4725
+ !this.__WB_xhr_open_arguments[2] &&
4726
+ navigator.userAgent.indexOf('Firefox') === -1
4727
+ ) {
4635
4728
  this.__WB_xhr_open_arguments[2] = true;
4636
- console.warn('wombat.js: Sync XHR not supported in SW-based replay in this browser, converted to async');
4729
+ console.warn(
4730
+ 'wombat.js: Sync XHR not supported in SW-based replay in this browser, converted to async'
4731
+ );
4637
4732
  }
4638
4733
 
4639
4734
  if (!this._no_rewrite) {
4640
- this.__WB_xhr_open_arguments[1] = wombat.rewriteUrl(this.__WB_xhr_open_arguments[1]);
4735
+ this.__WB_xhr_open_arguments[1] = wombat.rewriteUrl(
4736
+ this.__WB_xhr_open_arguments[1]
4737
+ );
4641
4738
  }
4642
4739
 
4643
4740
  origOpen.apply(this, this.__WB_xhr_open_arguments);
@@ -4647,7 +4744,11 @@ Wombat.prototype.initHTTPOverrides = function() {
4647
4744
  origSetRequestHeader.call(this, name, value);
4648
4745
  }
4649
4746
 
4650
- origSetRequestHeader.call(this, 'X-Pywb-Requested-With', 'XMLHttpRequest');
4747
+ origSetRequestHeader.call(
4748
+ this,
4749
+ 'X-Pywb-Requested-With',
4750
+ 'XMLHttpRequest'
4751
+ );
4651
4752
  }
4652
4753
 
4653
4754
  return origSend.call(this, value);
@@ -4804,7 +4905,10 @@ Wombat.prototype.initElementGetSetAttributeOverride = function() {
4804
4905
  rwValue = wombat.rewriteInlineStyle(value);
4805
4906
  } else if (lowername === 'style') {
4806
4907
  rwValue = wombat.rewriteStyle(value);
4807
- } else if (lowername === 'srcset' || (lowername === 'imagesrcset' && this.tagName === 'LINK')) {
4908
+ } else if (
4909
+ lowername === 'srcset' ||
4910
+ (lowername === 'imagesrcset' && this.tagName === 'LINK')
4911
+ ) {
4808
4912
  rwValue = wombat.rewriteSrcset(value, this);
4809
4913
  } else {
4810
4914
  var shouldRW = wombat.shouldRewriteAttr(this.tagName, lowername);
@@ -4941,9 +5045,12 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4941
5045
  }
4942
5046
 
4943
5047
  function rewriteQuery(query) {
4944
- if (typeof(query) === 'string') {
5048
+ if (typeof query === 'string') {
4945
5049
  try {
4946
- query = query.replace(/((?:^|\s)\b\w+\[(?:src|href|data-href))[\^]?(=['"]?(?:https?[:])?\/\/)/, '$1*$2');
5050
+ query = query.replace(
5051
+ /((?:^|\s)\b\w+\[(?:src|href|data-href))[\^]?(=['"]?(?:https?[:])?\/\/)/,
5052
+ '$1*$2'
5053
+ );
4947
5054
  } catch (e) {
4948
5055
  // ignore
4949
5056
  }
@@ -4957,19 +5064,13 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4957
5064
  var orig_QS = this.$wbwindow.document.querySelector;
4958
5065
 
4959
5066
  var querySelector = function(query) {
4960
- return orig_QS.call(
4961
- wombat.proxyToObj(this),
4962
- rewriteQuery(query)
4963
- );
5067
+ return orig_QS.call(wombat.proxyToObj(this), rewriteQuery(query));
4964
5068
  };
4965
5069
 
4966
5070
  var orig_QSA = this.$wbwindow.document.querySelectorAll;
4967
5071
 
4968
5072
  var querySelectorAll = function(query) {
4969
- return orig_QSA.call(
4970
- wombat.proxyToObj(this),
4971
- rewriteQuery(query)
4972
- );
5073
+ return orig_QSA.call(wombat.proxyToObj(this), rewriteQuery(query));
4973
5074
  };
4974
5075
 
4975
5076
  this.$wbwindow.Document.prototype.querySelector = querySelector;
@@ -4979,8 +5080,6 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4979
5080
  this.$wbwindow.document.querySelectorAll = querySelectorAll;
4980
5081
  };
4981
5082
 
4982
-
4983
-
4984
5083
  /**
4985
5084
  * Applies an override to Element.insertAdjacentHTML in order to ensure
4986
5085
  * that the strings of HTML to be inserted are rewritten and to
@@ -5165,12 +5264,19 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5165
5264
  var thisObj = wombat.proxyToObj(fnThis);
5166
5265
 
5167
5266
  if (fnThis.readyState === 'loading') {
5168
- if (string && string.startsWith('<!--') !== -1 && string.indexOf('-->') === -1) {
5267
+ if (
5268
+ string &&
5269
+ string.startsWith('<!--') !== -1 &&
5270
+ string.indexOf('-->') === -1
5271
+ ) {
5169
5272
  return originalFn.call(thisObj, string);
5170
5273
  }
5171
5274
  }
5172
5275
 
5173
- if (isSWLoad() || (fnThis.readyState === 'loading' && wombat.wb_info.injectDocClose)) {
5276
+ if (
5277
+ isSWLoad() ||
5278
+ (fnThis.readyState === 'loading' && wombat.wb_info.injectDocClose)
5279
+ ) {
5174
5280
  wombat._writeBuff += string;
5175
5281
  return;
5176
5282
  }
@@ -5180,7 +5286,7 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5180
5286
  var res = originalFn.call(thisObj, string);
5181
5287
  wombat.initNewWindowWombat(thisObj.defaultView);
5182
5288
  return res;
5183
- };
5289
+ }
5184
5290
 
5185
5291
  // Write
5186
5292
  var orig_doc_write = $wbDocument.write;
@@ -5230,10 +5336,16 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5230
5336
  if (wombat._writeBuff) {
5231
5337
  // if loading, apply as may be sync waiting for changes
5232
5338
  if (this.readyState === 'loading') {
5233
- orig_doc_write.call($wbDocument, wombat.rewriteHtml(wombat._writeBuff, true));
5339
+ orig_doc_write.call(
5340
+ $wbDocument,
5341
+ wombat.rewriteHtml(wombat._writeBuff, true)
5342
+ );
5234
5343
  }
5235
5344
  if (isSWLoad()) {
5236
- wombat.blobUrlForIframe(wombat.$wbwindow.frameElement, wombat._writeBuff);
5345
+ wombat.blobUrlForIframe(
5346
+ wombat.$wbwindow.frameElement,
5347
+ wombat._writeBuff
5348
+ );
5237
5349
 
5238
5350
  const doc = this;
5239
5351
 
@@ -5241,7 +5353,10 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5241
5353
  // catch any sync changes to doc being replaced, and create updated blob
5242
5354
  if (doc.documentElement) {
5243
5355
  const m = new wombat.$wbwindow.MutationObserver((mut, obs) => {
5244
- wombat.blobUrlForIframe(wombat.$wbwindow.frameElement, doc.documentElement.outerHTML);
5356
+ wombat.blobUrlForIframe(
5357
+ wombat.$wbwindow.frameElement,
5358
+ doc.documentElement.outerHTML
5359
+ );
5245
5360
  });
5246
5361
  m.observe(doc.documentElement, { childList: true, subtree: true });
5247
5362
  }
@@ -5334,10 +5449,13 @@ Wombat.prototype.initNewWindowWombat = function(win, src) {
5334
5449
  fullWombat = true;
5335
5450
  }
5336
5451
 
5337
-
5338
5452
  if (!fullWombat && this.wb_info.isSW) {
5339
5453
  var origURL = this.extractOriginalURL(src);
5340
- if (origURL === 'about:blank' || origURL.startsWith('srcdoc:') || origURL.startsWith('blob:')) {
5454
+ if (
5455
+ origURL === 'about:blank' ||
5456
+ origURL.startsWith('srcdoc:') ||
5457
+ origURL.startsWith('blob:')
5458
+ ) {
5341
5459
  fullWombat = true;
5342
5460
  }
5343
5461
  }
@@ -5462,8 +5580,10 @@ Wombat.prototype.initWorkerOverrides = function() {
5462
5580
  scriptURL,
5463
5581
  options
5464
5582
  ) {
5465
- var newScriptURL = new wombat.URL(scriptURL, wombat.$wbwindow.document.baseURI)
5466
- .href;
5583
+ var newScriptURL = new wombat.URL(
5584
+ scriptURL,
5585
+ wombat.$wbwindow.document.baseURI
5586
+ ).href;
5467
5587
  var mod = wombat.getPageUnderModifier();
5468
5588
  if (options && options.scope) {
5469
5589
  options.scope = wombat.rewriteUrl(options.scope, false, mod);
@@ -5629,17 +5749,18 @@ Wombat.prototype.initCheckThisFunc = function(win) {
5629
5749
  enumerable: false,
5630
5750
  value: function(thisObj) {
5631
5751
  try {
5632
- return (thisObj && thisObj._WB_wombat_obj_proxy ? thisObj._WB_wombat_obj_proxy : thisObj);
5752
+ return thisObj && thisObj._WB_wombat_obj_proxy
5753
+ ? thisObj._WB_wombat_obj_proxy
5754
+ : thisObj;
5633
5755
  } catch (e) {
5634
5756
  return thisObj;
5635
5757
  }
5636
- },
5758
+ }
5637
5759
  });
5638
5760
  }
5639
- } catch(e) {}
5761
+ } catch (e) {}
5640
5762
  };
5641
5763
 
5642
-
5643
5764
  Wombat.prototype.initImportWrapperFunc = function(win) {
5644
5765
  var wombat = this;
5645
5766
 
@@ -5676,7 +5797,9 @@ Wombat.prototype.initImportWrapperFunc = function(win) {
5676
5797
  } else if (base && url === undefined) {
5677
5798
  url = base;
5678
5799
  }
5679
- return import(/*webpackIgnore: true*/ wombat.rewriteUrl(url, false, 'esm_'));
5800
+ return import(
5801
+ /*webpackIgnore: true*/ wombat.rewriteUrl(url, false, 'esm_')
5802
+ );
5680
5803
  };
5681
5804
  };
5682
5805
 
@@ -5818,7 +5941,7 @@ Wombat.prototype.initPostMessageOverride = function($wbwindow) {
5818
5941
 
5819
5942
  var targetOrigin;
5820
5943
 
5821
- if (typeof(targetOrigin_or_options) === 'object') {
5944
+ if (typeof targetOrigin_or_options === 'object') {
5822
5945
  targetOrigin = targetOrigin_or_options.targetOrigin;
5823
5946
  transfer = targetOrigin_or_options.transfer;
5824
5947
  } else {
@@ -6133,21 +6256,23 @@ Wombat.prototype.initRegisterUnRegPHOverride = function() {
6133
6256
  }
6134
6257
  };
6135
6258
 
6136
-
6137
6259
  Wombat.prototype.initMiscNavigatorOverrides = function() {
6138
6260
  if (this.$wbwindow.navigator.sendBeacon) {
6139
- this.$wbwindow.navigator.sendBeacon = function() { return true; };
6261
+ this.$wbwindow.navigator.sendBeacon = function() {
6262
+ return true;
6263
+ };
6140
6264
  }
6141
- Object.defineProperty(navigator, 'onLine', {value: true});
6265
+ Object.defineProperty(navigator, 'onLine', { value: true });
6142
6266
  if (this.$wbwindow.navigator.mediaDevices) {
6143
6267
  this.$wbwindow.navigator.mediaDevices.setCaptureHandleConfig = function() {};
6144
6268
  }
6145
6269
  if (this.$wbwindow.navigator.getInstalledRelatedApps) {
6146
- this.$wbwindow.navigator.getInstalledRelatedApps = function() { return Promise.resolve([]); };
6270
+ this.$wbwindow.navigator.getInstalledRelatedApps = function() {
6271
+ return Promise.resolve([]);
6272
+ };
6147
6273
  }
6148
6274
  };
6149
6275
 
6150
-
6151
6276
  /**
6152
6277
  * Applies an override to the constructor of the PresentationRequest interface object
6153
6278
  * in order to rewrite its URL(s) arguments
@@ -6269,7 +6394,6 @@ Wombat.prototype.initStorageOverride = function() {
6269
6394
  ThrowExceptions.yes = true;
6270
6395
  };
6271
6396
 
6272
-
6273
6397
  Wombat.prototype.initIndexedDBOverride = function() {
6274
6398
  if (!this.$wbwindow.IDBFactory) {
6275
6399
  return;
@@ -6292,16 +6416,24 @@ Wombat.prototype.initIndexedDBOverride = function() {
6292
6416
  var orig_databases = proto.databases;
6293
6417
  proto.databases = function() {
6294
6418
  var func = this;
6295
- return new Promise(function (resolve, reject) {
6296
- orig_databases.call(func).then(function(dbList) {
6297
- var keys = [];
6298
- for (var i = 0; i < dbList.length; i++) {
6299
- if (dbList[i].name.indexOf(prefix) === 0) {
6300
- keys.push({name: dbList[i].name.substring(prefix.length), version: dbList[i].version});
6419
+ return new Promise(function(resolve, reject) {
6420
+ orig_databases
6421
+ .call(func)
6422
+ .then(function(dbList) {
6423
+ var keys = [];
6424
+ for (var i = 0; i < dbList.length; i++) {
6425
+ if (dbList[i].name.indexOf(prefix) === 0) {
6426
+ keys.push({
6427
+ name: dbList[i].name.substring(prefix.length),
6428
+ version: dbList[i].version
6429
+ });
6430
+ }
6301
6431
  }
6302
- }
6303
- resolve(keys);
6304
- }).catch(function(err) { reject(err); });
6432
+ resolve(keys);
6433
+ })
6434
+ .catch(function(err) {
6435
+ reject(err);
6436
+ });
6305
6437
  });
6306
6438
  };
6307
6439
  };
@@ -6338,7 +6470,6 @@ Wombat.prototype.initCachesOverride = function() {
6338
6470
  };
6339
6471
  };
6340
6472
 
6341
-
6342
6473
  Wombat.prototype.initCacheStorageOverride = function() {
6343
6474
  if (!this.$wbwindow.CacheStorage) {
6344
6475
  return;
@@ -6371,16 +6502,21 @@ Wombat.prototype.initCacheStorageOverride = function() {
6371
6502
  var orig_keys = proto.keys;
6372
6503
  proto.keys = function() {
6373
6504
  var func = this;
6374
- return new Promise(function (resolve, reject) {
6375
- orig_keys.call(func).then(function(keyList) {
6376
- var keys = [];
6377
- for (var i = 0; i < keyList.length; i++) {
6378
- if (keyList[i].indexOf(prefix) === 0) {
6379
- keys.push(keyList[i].substring(prefix.length));
6505
+ return new Promise(function(resolve, reject) {
6506
+ orig_keys
6507
+ .call(func)
6508
+ .then(function(keyList) {
6509
+ var keys = [];
6510
+ for (var i = 0; i < keyList.length; i++) {
6511
+ if (keyList[i].indexOf(prefix) === 0) {
6512
+ keys.push(keyList[i].substring(prefix.length));
6513
+ }
6380
6514
  }
6381
- }
6382
- resolve(keys);
6383
- }).catch(function(err) { reject(err); });
6515
+ resolve(keys);
6516
+ })
6517
+ .catch(function(err) {
6518
+ reject(err);
6519
+ });
6384
6520
  });
6385
6521
  };
6386
6522
 
@@ -6393,12 +6529,18 @@ Wombat.prototype.initCacheStorageOverride = function() {
6393
6529
 
6394
6530
  return cacheNames.reduce(function(chain, cacheName) {
6395
6531
  return chain.then(function() {
6396
- return match || caches.open(cacheName).then(function(cache) {
6397
- return cache.match(request, opts);
6398
- }).then(function(response) {
6399
- match = response;
6400
- return match;
6401
- });
6532
+ return (
6533
+ match ||
6534
+ caches
6535
+ .open(cacheName)
6536
+ .then(function(cache) {
6537
+ return cache.match(request, opts);
6538
+ })
6539
+ .then(function(response) {
6540
+ match = response;
6541
+ return match;
6542
+ })
6543
+ );
6402
6544
  });
6403
6545
  }, Promise.resolve());
6404
6546
  });
@@ -6436,7 +6578,6 @@ Wombat.prototype.initWindowObjProxy = function($wbwindow) {
6436
6578
 
6437
6579
  // default to replay-top object proxy if all else fails
6438
6580
  return wombat.$wbwindow.WB_wombat_top._WB_wombat_obj_proxy;
6439
-
6440
6581
  }
6441
6582
  return wombat.defaultProxyGet($wbwindow, prop, ownProps, funCache);
6442
6583
  },
@@ -6504,7 +6645,11 @@ Wombat.prototype.initWindowObjProxy = function($wbwindow) {
6504
6645
  },
6505
6646
  defineProperty: function(target, prop, desc) {
6506
6647
  var ndesc = desc || {};
6507
- if (!ndesc.hasOwnProperty('value') && !ndesc.hasOwnProperty('get') && !ndesc.hasOwnProperty('set')) {
6648
+ if (
6649
+ !ndesc.hasOwnProperty('value') &&
6650
+ !ndesc.hasOwnProperty('get') &&
6651
+ !ndesc.hasOwnProperty('set')
6652
+ ) {
6508
6653
  ndesc.value = $wbwindow[prop];
6509
6654
  }
6510
6655
  Reflect.defineProperty($wbwindow, prop, ndesc);
@@ -6641,7 +6786,7 @@ Wombat.prototype.initTopFrameNotify = function(wbinfo) {
6641
6786
 
6642
6787
  icons.push({
6643
6788
  rel: 'icon',
6644
- href: wombat.rewriteUrl('/favicon.ico'),
6789
+ href: wombat.rewriteUrl('/favicon.ico')
6645
6790
  });
6646
6791
 
6647
6792
  var message = {
@@ -6802,7 +6947,7 @@ Wombat.prototype.initEvalOverride = function() {
6802
6947
  var rewriteEvalArg = this.rewriteEvalArg;
6803
6948
  var setNoop = function() {};
6804
6949
 
6805
- this.wrappedEval = function (evalFunc) {
6950
+ this.wrappedEval = function(evalFunc) {
6806
6951
  return function(arg) {
6807
6952
  return rewriteEvalArg(evalFunc, arg);
6808
6953
  };
@@ -6843,7 +6988,7 @@ Wombat.prototype.initEvalOverride = function() {
6843
6988
  return {
6844
6989
  eval: function(thisObj, args, evalparam) {
6845
6990
  // ensure this === window
6846
- var isGlobal = (thisObj === wombat.proxyToObj(wombat.$wbwindow));
6991
+ var isGlobal = thisObj === wombat.proxyToObj(wombat.$wbwindow);
6847
6992
  // wrap in try/catch in the off chance case we're in strict mode, and then treat as non-global
6848
6993
  try {
6849
6994
  isGlobal = isGlobal && !args.callee.caller;
@@ -6907,14 +7052,12 @@ Wombat.prototype.wombatInit = function() {
6907
7052
  // proxy check this func
6908
7053
  this.initCheckThisFunc(this.$wbwindow);
6909
7054
 
6910
-
6911
7055
  // add __wb_import__ for modules
6912
7056
  this.initImportWrapperFunc(this.$wbwindow);
6913
7057
 
6914
7058
  // override getOwnPropertyNames
6915
7059
  this.overrideGetOwnPropertyNames(this.$wbwindow);
6916
7060
 
6917
-
6918
7061
  this.initUIEventsOverrides();
6919
7062
 
6920
7063
  // write
@@ -6944,7 +7087,11 @@ Wombat.prototype.wombatInit = function() {
6944
7087
  // can get into replay
6945
7088
  this.overrideHtmlAssign(this.$wbwindow.Element, 'innerHTML', true);
6946
7089
  this.overrideHtmlAssign(this.$wbwindow.Element, 'outerHTML', true);
6947
- this.overrideHtmlAssignSrcDoc(this.$wbwindow.HTMLIFrameElement, 'srcdoc', true);
7090
+ this.overrideHtmlAssignSrcDoc(
7091
+ this.$wbwindow.HTMLIFrameElement,
7092
+ 'srcdoc',
7093
+ true
7094
+ );
6948
7095
  this.overrideHtmlAssign(this.$wbwindow.HTMLStyleElement, 'textContent');
6949
7096
  this.overrideShadowDom();
6950
7097
 
@@ -7001,7 +7148,10 @@ Wombat.prototype.wombatInit = function() {
7001
7148
  'dispatchEvent'
7002
7149
  );
7003
7150
 
7004
- this.overrideDeProxyPropAssign(this.$wbwindow.TreeWalker.prototype, 'currentNode');
7151
+ this.overrideDeProxyPropAssign(
7152
+ this.$wbwindow.TreeWalker.prototype,
7153
+ 'currentNode'
7154
+ );
7005
7155
 
7006
7156
  this.initTimeoutIntervalOverrides();
7007
7157