@webrecorder/wombat 3.8.14 → 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);
@@ -3032,7 +3086,11 @@ Wombat.prototype.overrideAttr = function(obj, attr, mod) {
3032
3086
  wombat.removeWBOSRC(this);
3033
3087
  }
3034
3088
  }
3035
- var val = wombat.rewriteUrl(orig, false, this.type === 'module' ? 'esm_' : mod);
3089
+ var val = wombat.rewriteUrl(
3090
+ orig,
3091
+ false,
3092
+ this.type === 'module' ? 'esm_' : mod
3093
+ );
3036
3094
  if (orig_setter) {
3037
3095
  return orig_setter.call(this, val);
3038
3096
  } else if (wombat.wb_setAttribute) {
@@ -3067,7 +3125,7 @@ Wombat.prototype.overridePropExtract = function(proto, prop) {
3067
3125
  var orig_getter = this.getOrigGetter(proto, prop);
3068
3126
  var wombat = this;
3069
3127
  if (orig_getter) {
3070
- var new_getter = function () {
3128
+ var new_getter = function() {
3071
3129
  var obj = wombat.proxyToObj(this);
3072
3130
  var res = orig_getter.call(obj);
3073
3131
  if (obj.__WB_no_unrewrite) {
@@ -3090,16 +3148,16 @@ Wombat.prototype.overrideDeProxyPropAssign = function(proto, prop) {
3090
3148
  var orig_getter = this.getOrigGetter(proto, prop);
3091
3149
  var wombat = this;
3092
3150
  if (orig_setter) {
3093
- var new_setter = function (value) {
3094
- 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
+ );
3095
3156
  };
3096
3157
  this.defProp(proto, prop, new_setter, orig_getter);
3097
3158
  }
3098
3159
  };
3099
3160
 
3100
-
3101
-
3102
-
3103
3161
  /**
3104
3162
  * Overrides referrer -- if top-replay frame, referrer should be "", otherwise extractOriginURL
3105
3163
  * @param {Object} proto
@@ -3128,7 +3186,6 @@ Wombat.prototype.overrideReferrer = function($document) {
3128
3186
  }
3129
3187
  };
3130
3188
 
3131
-
3132
3189
  /**
3133
3190
  * Applies an attribute getter override IFF an original getter exists that
3134
3191
  * ensures that the results of retrieving the attributes value is not a
@@ -3239,7 +3296,7 @@ Wombat.prototype.overrideStyleAttr = function(obj, attr, propName) {
3239
3296
 
3240
3297
  var getter = orig_getter;
3241
3298
 
3242
- var extractUrl = function (_, p1, p2, p3, p4) {
3299
+ var extractUrl = function(_, p1, p2, p3, p4) {
3243
3300
  return p1 + (p2 || '') + wombat.extractOriginalURL(p3) + p4;
3244
3301
  };
3245
3302
 
@@ -3379,7 +3436,6 @@ Wombat.prototype.overrideHtmlAssignSrcDoc = function(elem, prop) {
3379
3436
  this.defProp(obj, prop, setter, getter);
3380
3437
  };
3381
3438
 
3382
-
3383
3439
  /**
3384
3440
  * Override .dataset attribute on element and wraps in a proxy that unrewrites URLs
3385
3441
  */
@@ -3394,10 +3450,12 @@ Wombat.prototype.overrideDataSet = function() {
3394
3450
 
3395
3451
  var proxy = new Proxy(dataset, {
3396
3452
  get(target, prop, receiver) {
3397
-
3398
3453
  var result = target[prop];
3399
3454
 
3400
- if (typeof(result) === 'string' && wombat.startsWithOneOf(result, wombat.wb_prefixes)) {
3455
+ if (
3456
+ typeof result === 'string' &&
3457
+ wombat.startsWithOneOf(result, wombat.wb_prefixes)
3458
+ ) {
3401
3459
  return wombat.extractOriginalURL(result);
3402
3460
  }
3403
3461
 
@@ -3411,7 +3469,6 @@ Wombat.prototype.overrideDataSet = function() {
3411
3469
  this.defProp(obj, 'dataset', null, getter);
3412
3470
  };
3413
3471
 
3414
-
3415
3472
  /**
3416
3473
  * Override .style attribute on element and wraps in a proxy that unrewrites URLs
3417
3474
  */
@@ -3440,7 +3497,10 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3440
3497
  get(target, prop, receiver) {
3441
3498
  var value = target[prop];
3442
3499
 
3443
- if (typeof value === 'function' && (prop === 'setProperty' || wombat.isNativeFunction(value))) {
3500
+ if (
3501
+ typeof value === 'function' &&
3502
+ (prop === 'setProperty' || wombat.isNativeFunction(value))
3503
+ ) {
3444
3504
  if (!fnCache[prop]) {
3445
3505
  fnCache[prop] = value.bind(style);
3446
3506
  }
@@ -3448,7 +3508,7 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3448
3508
  }
3449
3509
 
3450
3510
  return value;
3451
- },
3511
+ }
3452
3512
  });
3453
3513
 
3454
3514
  return proxy;
@@ -3457,8 +3517,6 @@ Wombat.prototype.overrideStyleProxy = function(overrideProps) {
3457
3517
  this.defProp(obj, 'style', orig_setter, getter);
3458
3518
  };
3459
3519
 
3460
-
3461
-
3462
3520
  /**
3463
3521
  * Overrides the getter and setter functions for the supplied property
3464
3522
  * on the HTMLIFrameElement
@@ -3488,33 +3546,40 @@ Wombat.prototype.overrideIframeContentAccess = function(prop) {
3488
3546
  obj['_get_' + prop] = orig_getter;
3489
3547
  };
3490
3548
 
3491
-
3492
3549
  Wombat.prototype.overrideSWAccess = function($wbwindow) {
3493
- if (!$wbwindow.navigator.serviceWorker || !$wbwindow.navigator.serviceWorker.controller) {
3550
+ if (
3551
+ !$wbwindow.navigator.serviceWorker ||
3552
+ !$wbwindow.navigator.serviceWorker.controller
3553
+ ) {
3494
3554
  return;
3495
3555
  }
3496
3556
 
3497
3557
  $wbwindow._WB_wombat_sw = $wbwindow.navigator.serviceWorker;
3498
3558
 
3499
-
3500
3559
  var overrideSW = {
3501
- 'controller': null,
3502
- 'ready': Promise.resolve({'unregister': function() {} }),
3503
- 'register': function() { return Promise.reject(); },
3504
- 'addEventListener': function() {},
3505
- 'removeEventListener': function() {},
3506
- 'onmessage': null,
3507
- 'oncontrollerchange': null,
3508
- 'getRegistrations': function() { return Promise.resolve([]); },
3509
- 'getRegistration': function() { return Promise.resolve(undefined); },
3510
- 'startMessages': function() {}
3511
- };
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
+ };
3512
3577
 
3513
- this.defGetterProp($wbwindow.navigator, 'serviceWorker', function() { return overrideSW; });
3578
+ this.defGetterProp($wbwindow.navigator, 'serviceWorker', function() {
3579
+ return overrideSW;
3580
+ });
3514
3581
  };
3515
3582
 
3516
-
3517
-
3518
3583
  /**
3519
3584
  * Overrides the supplied method in order to ensure that the `this` argument
3520
3585
  * of the function is not one of the JS Proxy objects used by wombat.
@@ -3585,7 +3650,10 @@ Wombat.prototype.overrideFunctionApply = function($wbwindow) {
3585
3650
  return;
3586
3651
  }
3587
3652
  var orig_apply = $wbwindow.Function.prototype.apply;
3588
- $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
+ });
3589
3657
  var wombat = this;
3590
3658
  $wbwindow.Function.prototype.apply = function apply(obj, args) {
3591
3659
  // if native function, de-proxy
@@ -3600,7 +3668,6 @@ Wombat.prototype.overrideFunctionApply = function($wbwindow) {
3600
3668
  this.wb_funToString.apply = orig_apply;
3601
3669
  };
3602
3670
 
3603
-
3604
3671
  /**
3605
3672
  * Overrides Function.prototype.call in order to ensure that none of the
3606
3673
  * arguments of `native` functions are one of the JS Proxy objects used by wombat.
@@ -3611,7 +3678,10 @@ Wombat.prototype.overrideFunctionCall = function($wbwindow) {
3611
3678
  return;
3612
3679
  }
3613
3680
  var orig_call = $wbwindow.Function.prototype.call;
3614
- $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
+ });
3615
3685
  var wombat = this;
3616
3686
  $wbwindow.Function.prototype.call = function call(obj, ...args) {
3617
3687
  // if native function, de-proxy
@@ -3635,19 +3705,21 @@ Wombat.prototype.overrideFunctionBind = function($wbwindow) {
3635
3705
  return;
3636
3706
  }
3637
3707
  var orig_bind = $wbwindow.Function.prototype.bind;
3638
- $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
+ });
3639
3712
  var wombat = this;
3640
3713
  $wbwindow.Function.prototype.bind = function bind(obj) {
3641
3714
  var isNative = wombat.isNativeFunction(this);
3642
- 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);
3643
3718
  result.__WB_is_native_func__ = isNative;
3644
3719
  return result;
3645
3720
  };
3646
3721
  };
3647
3722
 
3648
-
3649
-
3650
-
3651
3723
  /**
3652
3724
  * Overrides the getter and setter functions for the `srcset` property
3653
3725
  * of the supplied Object in order to rewrite accesses and retrievals
@@ -4017,15 +4089,15 @@ Wombat.prototype.initAttrOverrides = function() {
4017
4089
  var style_proto = this.$wbwindow.CSSStyleDeclaration.prototype;
4018
4090
 
4019
4091
  var cssAttrToProps = {
4020
- 'background': 'background',
4021
- 'backgroundImage': 'background-image',
4022
- 'cursor': 'cursor',
4023
- 'listStyle': 'list-style',
4024
- 'listStyleImage': 'list-style-image',
4025
- 'border': 'border',
4026
- 'borderImage': 'border-image',
4027
- 'borderImageSource': 'border-image-source',
4028
- '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'
4029
4101
  };
4030
4102
 
4031
4103
  this.overrideStyleProxy(Object.values(cssAttrToProps));
@@ -4294,7 +4366,6 @@ Wombat.prototype.initDateOverride = function(timestamp) {
4294
4366
  });
4295
4367
  };
4296
4368
 
4297
-
4298
4369
  Wombat.prototype.initBlobOverride = function() {
4299
4370
  // don't use for SW replay as blob: iframes won't have access to SW
4300
4371
  if (!this.$wbwindow.Blob || this.wb_info.isSW) {
@@ -4307,10 +4378,17 @@ Wombat.prototype.initBlobOverride = function() {
4307
4378
 
4308
4379
  this.$wbwindow.Blob = (function(Blob_) {
4309
4380
  return function Blob(array, options) {
4310
-
4311
- 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
+ ) {
4312
4386
  // for now, just handle single string case
4313
- 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
+ ) {
4314
4392
  array[0] = wombat.rewriteHtml(array[0]);
4315
4393
  options.type = 'text/html';
4316
4394
  }
@@ -4336,14 +4414,17 @@ Wombat.prototype.initIntersectionObsOverride = function() {
4336
4414
 
4337
4415
  return new IObs(callback, options);
4338
4416
  };
4339
-
4340
4417
  })(this.$wbwindow.IntersectionObserver);
4341
4418
 
4342
4419
  this.$wbwindow.IntersectionObserver.prototype = orig_iobs.prototype;
4343
4420
 
4344
- Object.defineProperty(this.$wbwindow.IntersectionObserver.prototype, 'constructor', {
4345
- value: this.$wbwindow.IntersectionObserver
4346
- });
4421
+ Object.defineProperty(
4422
+ this.$wbwindow.IntersectionObserver.prototype,
4423
+ 'constructor',
4424
+ {
4425
+ value: this.$wbwindow.IntersectionObserver
4426
+ }
4427
+ );
4347
4428
  };
4348
4429
 
4349
4430
  Wombat.prototype.initWSOverride = function() {
@@ -4396,7 +4477,7 @@ Wombat.prototype.initWSOverride = function() {
4396
4477
 
4397
4478
  addToStringTagToClass(this.$wbwindow.WebSocket, 'WebSocket');
4398
4479
  };
4399
-
4480
+
4400
4481
  /**
4401
4482
  * Applies an override to the document.title property in order to ensure
4402
4483
  * that actual top (archive top frame containing the replay iframe) receives
@@ -4541,7 +4622,8 @@ Wombat.prototype.initCookiePreset = function() {
4541
4622
  if (this.wb_info.presetCookie) {
4542
4623
  var splitCookies = this.wb_info.presetCookie.split(';');
4543
4624
  for (var i = 0; i < splitCookies.length; i++) {
4544
- this.$wbwindow.document.cookie = splitCookies[i].trim() + '; Path=' + this.rewriteUrl('./', true);
4625
+ this.$wbwindow.document.cookie =
4626
+ splitCookies[i].trim() + '; Path=' + this.rewriteUrl('./', true);
4545
4627
  }
4546
4628
  }
4547
4629
  };
@@ -4564,8 +4646,11 @@ Wombat.prototype.initCookiePreset = function() {
4564
4646
  Wombat.prototype.initHTTPOverrides = function() {
4565
4647
  var wombat = this;
4566
4648
 
4567
- // responseURL override
4568
- this.overridePropExtract(this.$wbwindow.XMLHttpRequest.prototype, 'responseURL');
4649
+ // responseURL override
4650
+ this.overridePropExtract(
4651
+ this.$wbwindow.XMLHttpRequest.prototype,
4652
+ 'responseURL'
4653
+ );
4569
4654
 
4570
4655
  var convertToGet = !!this.wb_info.convert_post_to_get;
4571
4656
 
@@ -4592,7 +4677,8 @@ Wombat.prototype.initHTTPOverrides = function() {
4592
4677
  }
4593
4678
  } else {
4594
4679
  var origOpen = this.$wbwindow.XMLHttpRequest.prototype.open;
4595
- var origSetRequestHeader = this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader;
4680
+ var origSetRequestHeader = this.$wbwindow.XMLHttpRequest.prototype
4681
+ .setRequestHeader;
4596
4682
  var origSend = this.$wbwindow.XMLHttpRequest.prototype.send;
4597
4683
  this.utilFns.XHRopen = origOpen;
4598
4684
  this.utilFns.XHRsend = origSend;
@@ -4604,18 +4690,24 @@ Wombat.prototype.initHTTPOverrides = function() {
4604
4690
 
4605
4691
  this.$wbwindow.XMLHttpRequest.prototype.setAttributionReporting = function() {};
4606
4692
 
4607
- this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader = function(name, value) {
4693
+ this.$wbwindow.XMLHttpRequest.prototype.setRequestHeader = function(
4694
+ name,
4695
+ value
4696
+ ) {
4608
4697
  this.__WB_xhr_headers.set(name, value);
4609
4698
  };
4610
4699
 
4611
4700
  this.$wbwindow.XMLHttpRequest.prototype.send = async function(value) {
4612
- if (convertToGet && (this.__WB_xhr_open_arguments[0] === 'POST' || this.__WB_xhr_open_arguments[0] === 'PUT')) {
4613
-
4701
+ if (
4702
+ convertToGet &&
4703
+ (this.__WB_xhr_open_arguments[0] === 'POST' ||
4704
+ this.__WB_xhr_open_arguments[0] === 'PUT')
4705
+ ) {
4614
4706
  var request = {
4615
- 'url': this.__WB_xhr_open_arguments[1],
4616
- 'method': this.__WB_xhr_open_arguments[0],
4617
- 'headers': this.__WB_xhr_headers,
4618
- '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
4619
4711
  };
4620
4712
 
4621
4713
  if (postToGetUrl(request)) {
@@ -4628,13 +4720,21 @@ Wombat.prototype.initHTTPOverrides = function() {
4628
4720
  // sync mode: disable unless Firefox
4629
4721
  // sync xhr with service workers supported only in FF at the moment
4630
4722
  // https://wpt.fyi/results/service-workers/service-worker/fetch-request-xhr-sync.https.html
4631
- 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
+ ) {
4632
4728
  this.__WB_xhr_open_arguments[2] = true;
4633
- 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
+ );
4634
4732
  }
4635
4733
 
4636
4734
  if (!this._no_rewrite) {
4637
- 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
+ );
4638
4738
  }
4639
4739
 
4640
4740
  origOpen.apply(this, this.__WB_xhr_open_arguments);
@@ -4644,7 +4744,11 @@ Wombat.prototype.initHTTPOverrides = function() {
4644
4744
  origSetRequestHeader.call(this, name, value);
4645
4745
  }
4646
4746
 
4647
- origSetRequestHeader.call(this, 'X-Pywb-Requested-With', 'XMLHttpRequest');
4747
+ origSetRequestHeader.call(
4748
+ this,
4749
+ 'X-Pywb-Requested-With',
4750
+ 'XMLHttpRequest'
4751
+ );
4648
4752
  }
4649
4753
 
4650
4754
  return origSend.call(this, value);
@@ -4801,7 +4905,10 @@ Wombat.prototype.initElementGetSetAttributeOverride = function() {
4801
4905
  rwValue = wombat.rewriteInlineStyle(value);
4802
4906
  } else if (lowername === 'style') {
4803
4907
  rwValue = wombat.rewriteStyle(value);
4804
- } else if (lowername === 'srcset' || (lowername === 'imagesrcset' && this.tagName === 'LINK')) {
4908
+ } else if (
4909
+ lowername === 'srcset' ||
4910
+ (lowername === 'imagesrcset' && this.tagName === 'LINK')
4911
+ ) {
4805
4912
  rwValue = wombat.rewriteSrcset(value, this);
4806
4913
  } else {
4807
4914
  var shouldRW = wombat.shouldRewriteAttr(this.tagName, lowername);
@@ -4938,9 +5045,12 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4938
5045
  }
4939
5046
 
4940
5047
  function rewriteQuery(query) {
4941
- if (typeof(query) === 'string') {
5048
+ if (typeof query === 'string') {
4942
5049
  try {
4943
- 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
+ );
4944
5054
  } catch (e) {
4945
5055
  // ignore
4946
5056
  }
@@ -4954,19 +5064,13 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4954
5064
  var orig_QS = this.$wbwindow.document.querySelector;
4955
5065
 
4956
5066
  var querySelector = function(query) {
4957
- return orig_QS.call(
4958
- wombat.proxyToObj(this),
4959
- rewriteQuery(query)
4960
- );
5067
+ return orig_QS.call(wombat.proxyToObj(this), rewriteQuery(query));
4961
5068
  };
4962
5069
 
4963
5070
  var orig_QSA = this.$wbwindow.document.querySelectorAll;
4964
5071
 
4965
5072
  var querySelectorAll = function(query) {
4966
- return orig_QSA.call(
4967
- wombat.proxyToObj(this),
4968
- rewriteQuery(query)
4969
- );
5073
+ return orig_QSA.call(wombat.proxyToObj(this), rewriteQuery(query));
4970
5074
  };
4971
5075
 
4972
5076
  this.$wbwindow.Document.prototype.querySelector = querySelector;
@@ -4976,8 +5080,6 @@ Wombat.prototype.initQuerySelectorOverride = function() {
4976
5080
  this.$wbwindow.document.querySelectorAll = querySelectorAll;
4977
5081
  };
4978
5082
 
4979
-
4980
-
4981
5083
  /**
4982
5084
  * Applies an override to Element.insertAdjacentHTML in order to ensure
4983
5085
  * that the strings of HTML to be inserted are rewritten and to
@@ -5162,12 +5264,19 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5162
5264
  var thisObj = wombat.proxyToObj(fnThis);
5163
5265
 
5164
5266
  if (fnThis.readyState === 'loading') {
5165
- if (string && string.startsWith('<!--') !== -1 && string.indexOf('-->') === -1) {
5267
+ if (
5268
+ string &&
5269
+ string.startsWith('<!--') !== -1 &&
5270
+ string.indexOf('-->') === -1
5271
+ ) {
5166
5272
  return originalFn.call(thisObj, string);
5167
5273
  }
5168
5274
  }
5169
5275
 
5170
- if (isSWLoad() || (fnThis.readyState === 'loading' && wombat.wb_info.injectDocClose)) {
5276
+ if (
5277
+ isSWLoad() ||
5278
+ (fnThis.readyState === 'loading' && wombat.wb_info.injectDocClose)
5279
+ ) {
5171
5280
  wombat._writeBuff += string;
5172
5281
  return;
5173
5282
  }
@@ -5177,7 +5286,7 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5177
5286
  var res = originalFn.call(thisObj, string);
5178
5287
  wombat.initNewWindowWombat(thisObj.defaultView);
5179
5288
  return res;
5180
- };
5289
+ }
5181
5290
 
5182
5291
  // Write
5183
5292
  var orig_doc_write = $wbDocument.write;
@@ -5227,10 +5336,16 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5227
5336
  if (wombat._writeBuff) {
5228
5337
  // if loading, apply as may be sync waiting for changes
5229
5338
  if (this.readyState === 'loading') {
5230
- orig_doc_write.call($wbDocument, wombat.rewriteHtml(wombat._writeBuff, true));
5339
+ orig_doc_write.call(
5340
+ $wbDocument,
5341
+ wombat.rewriteHtml(wombat._writeBuff, true)
5342
+ );
5231
5343
  }
5232
5344
  if (isSWLoad()) {
5233
- wombat.blobUrlForIframe(wombat.$wbwindow.frameElement, wombat._writeBuff);
5345
+ wombat.blobUrlForIframe(
5346
+ wombat.$wbwindow.frameElement,
5347
+ wombat._writeBuff
5348
+ );
5234
5349
 
5235
5350
  const doc = this;
5236
5351
 
@@ -5238,7 +5353,10 @@ Wombat.prototype.initDocWriteOpenCloseOverride = function() {
5238
5353
  // catch any sync changes to doc being replaced, and create updated blob
5239
5354
  if (doc.documentElement) {
5240
5355
  const m = new wombat.$wbwindow.MutationObserver((mut, obs) => {
5241
- wombat.blobUrlForIframe(wombat.$wbwindow.frameElement, doc.documentElement.outerHTML);
5356
+ wombat.blobUrlForIframe(
5357
+ wombat.$wbwindow.frameElement,
5358
+ doc.documentElement.outerHTML
5359
+ );
5242
5360
  });
5243
5361
  m.observe(doc.documentElement, { childList: true, subtree: true });
5244
5362
  }
@@ -5331,10 +5449,13 @@ Wombat.prototype.initNewWindowWombat = function(win, src) {
5331
5449
  fullWombat = true;
5332
5450
  }
5333
5451
 
5334
-
5335
5452
  if (!fullWombat && this.wb_info.isSW) {
5336
5453
  var origURL = this.extractOriginalURL(src);
5337
- 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
+ ) {
5338
5459
  fullWombat = true;
5339
5460
  }
5340
5461
  }
@@ -5459,8 +5580,10 @@ Wombat.prototype.initWorkerOverrides = function() {
5459
5580
  scriptURL,
5460
5581
  options
5461
5582
  ) {
5462
- var newScriptURL = new wombat.URL(scriptURL, wombat.$wbwindow.document.baseURI)
5463
- .href;
5583
+ var newScriptURL = new wombat.URL(
5584
+ scriptURL,
5585
+ wombat.$wbwindow.document.baseURI
5586
+ ).href;
5464
5587
  var mod = wombat.getPageUnderModifier();
5465
5588
  if (options && options.scope) {
5466
5589
  options.scope = wombat.rewriteUrl(options.scope, false, mod);
@@ -5626,17 +5749,18 @@ Wombat.prototype.initCheckThisFunc = function(win) {
5626
5749
  enumerable: false,
5627
5750
  value: function(thisObj) {
5628
5751
  try {
5629
- 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;
5630
5755
  } catch (e) {
5631
5756
  return thisObj;
5632
5757
  }
5633
- },
5758
+ }
5634
5759
  });
5635
5760
  }
5636
- } catch(e) {}
5761
+ } catch (e) {}
5637
5762
  };
5638
5763
 
5639
-
5640
5764
  Wombat.prototype.initImportWrapperFunc = function(win) {
5641
5765
  var wombat = this;
5642
5766
 
@@ -5673,7 +5797,9 @@ Wombat.prototype.initImportWrapperFunc = function(win) {
5673
5797
  } else if (base && url === undefined) {
5674
5798
  url = base;
5675
5799
  }
5676
- return import(/*webpackIgnore: true*/ wombat.rewriteUrl(url, false, 'esm_'));
5800
+ return import(
5801
+ /*webpackIgnore: true*/ wombat.rewriteUrl(url, false, 'esm_')
5802
+ );
5677
5803
  };
5678
5804
  };
5679
5805
 
@@ -5815,7 +5941,7 @@ Wombat.prototype.initPostMessageOverride = function($wbwindow) {
5815
5941
 
5816
5942
  var targetOrigin;
5817
5943
 
5818
- if (typeof(targetOrigin_or_options) === 'object') {
5944
+ if (typeof targetOrigin_or_options === 'object') {
5819
5945
  targetOrigin = targetOrigin_or_options.targetOrigin;
5820
5946
  transfer = targetOrigin_or_options.transfer;
5821
5947
  } else {
@@ -6130,21 +6256,23 @@ Wombat.prototype.initRegisterUnRegPHOverride = function() {
6130
6256
  }
6131
6257
  };
6132
6258
 
6133
-
6134
6259
  Wombat.prototype.initMiscNavigatorOverrides = function() {
6135
6260
  if (this.$wbwindow.navigator.sendBeacon) {
6136
- this.$wbwindow.navigator.sendBeacon = function() { return true; };
6261
+ this.$wbwindow.navigator.sendBeacon = function() {
6262
+ return true;
6263
+ };
6137
6264
  }
6138
- Object.defineProperty(navigator, 'onLine', {value: true});
6265
+ Object.defineProperty(navigator, 'onLine', { value: true });
6139
6266
  if (this.$wbwindow.navigator.mediaDevices) {
6140
6267
  this.$wbwindow.navigator.mediaDevices.setCaptureHandleConfig = function() {};
6141
6268
  }
6142
6269
  if (this.$wbwindow.navigator.getInstalledRelatedApps) {
6143
- this.$wbwindow.navigator.getInstalledRelatedApps = function() { return Promise.resolve([]); };
6270
+ this.$wbwindow.navigator.getInstalledRelatedApps = function() {
6271
+ return Promise.resolve([]);
6272
+ };
6144
6273
  }
6145
6274
  };
6146
6275
 
6147
-
6148
6276
  /**
6149
6277
  * Applies an override to the constructor of the PresentationRequest interface object
6150
6278
  * in order to rewrite its URL(s) arguments
@@ -6266,7 +6394,6 @@ Wombat.prototype.initStorageOverride = function() {
6266
6394
  ThrowExceptions.yes = true;
6267
6395
  };
6268
6396
 
6269
-
6270
6397
  Wombat.prototype.initIndexedDBOverride = function() {
6271
6398
  if (!this.$wbwindow.IDBFactory) {
6272
6399
  return;
@@ -6289,16 +6416,24 @@ Wombat.prototype.initIndexedDBOverride = function() {
6289
6416
  var orig_databases = proto.databases;
6290
6417
  proto.databases = function() {
6291
6418
  var func = this;
6292
- return new Promise(function (resolve, reject) {
6293
- orig_databases.call(func).then(function(dbList) {
6294
- var keys = [];
6295
- for (var i = 0; i < dbList.length; i++) {
6296
- if (dbList[i].name.indexOf(prefix) === 0) {
6297
- 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
+ }
6298
6431
  }
6299
- }
6300
- resolve(keys);
6301
- }).catch(function(err) { reject(err); });
6432
+ resolve(keys);
6433
+ })
6434
+ .catch(function(err) {
6435
+ reject(err);
6436
+ });
6302
6437
  });
6303
6438
  };
6304
6439
  };
@@ -6335,7 +6470,6 @@ Wombat.prototype.initCachesOverride = function() {
6335
6470
  };
6336
6471
  };
6337
6472
 
6338
-
6339
6473
  Wombat.prototype.initCacheStorageOverride = function() {
6340
6474
  if (!this.$wbwindow.CacheStorage) {
6341
6475
  return;
@@ -6368,16 +6502,21 @@ Wombat.prototype.initCacheStorageOverride = function() {
6368
6502
  var orig_keys = proto.keys;
6369
6503
  proto.keys = function() {
6370
6504
  var func = this;
6371
- return new Promise(function (resolve, reject) {
6372
- orig_keys.call(func).then(function(keyList) {
6373
- var keys = [];
6374
- for (var i = 0; i < keyList.length; i++) {
6375
- if (keyList[i].indexOf(prefix) === 0) {
6376
- 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
+ }
6377
6514
  }
6378
- }
6379
- resolve(keys);
6380
- }).catch(function(err) { reject(err); });
6515
+ resolve(keys);
6516
+ })
6517
+ .catch(function(err) {
6518
+ reject(err);
6519
+ });
6381
6520
  });
6382
6521
  };
6383
6522
 
@@ -6390,12 +6529,18 @@ Wombat.prototype.initCacheStorageOverride = function() {
6390
6529
 
6391
6530
  return cacheNames.reduce(function(chain, cacheName) {
6392
6531
  return chain.then(function() {
6393
- return match || caches.open(cacheName).then(function(cache) {
6394
- return cache.match(request, opts);
6395
- }).then(function(response) {
6396
- match = response;
6397
- return match;
6398
- });
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
+ );
6399
6544
  });
6400
6545
  }, Promise.resolve());
6401
6546
  });
@@ -6433,7 +6578,6 @@ Wombat.prototype.initWindowObjProxy = function($wbwindow) {
6433
6578
 
6434
6579
  // default to replay-top object proxy if all else fails
6435
6580
  return wombat.$wbwindow.WB_wombat_top._WB_wombat_obj_proxy;
6436
-
6437
6581
  }
6438
6582
  return wombat.defaultProxyGet($wbwindow, prop, ownProps, funCache);
6439
6583
  },
@@ -6501,7 +6645,11 @@ Wombat.prototype.initWindowObjProxy = function($wbwindow) {
6501
6645
  },
6502
6646
  defineProperty: function(target, prop, desc) {
6503
6647
  var ndesc = desc || {};
6504
- 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
+ ) {
6505
6653
  ndesc.value = $wbwindow[prop];
6506
6654
  }
6507
6655
  Reflect.defineProperty($wbwindow, prop, ndesc);
@@ -6638,7 +6786,7 @@ Wombat.prototype.initTopFrameNotify = function(wbinfo) {
6638
6786
 
6639
6787
  icons.push({
6640
6788
  rel: 'icon',
6641
- href: wombat.rewriteUrl('/favicon.ico'),
6789
+ href: wombat.rewriteUrl('/favicon.ico')
6642
6790
  });
6643
6791
 
6644
6792
  var message = {
@@ -6799,7 +6947,7 @@ Wombat.prototype.initEvalOverride = function() {
6799
6947
  var rewriteEvalArg = this.rewriteEvalArg;
6800
6948
  var setNoop = function() {};
6801
6949
 
6802
- this.wrappedEval = function (evalFunc) {
6950
+ this.wrappedEval = function(evalFunc) {
6803
6951
  return function(arg) {
6804
6952
  return rewriteEvalArg(evalFunc, arg);
6805
6953
  };
@@ -6840,7 +6988,7 @@ Wombat.prototype.initEvalOverride = function() {
6840
6988
  return {
6841
6989
  eval: function(thisObj, args, evalparam) {
6842
6990
  // ensure this === window
6843
- var isGlobal = (thisObj === wombat.proxyToObj(wombat.$wbwindow));
6991
+ var isGlobal = thisObj === wombat.proxyToObj(wombat.$wbwindow);
6844
6992
  // wrap in try/catch in the off chance case we're in strict mode, and then treat as non-global
6845
6993
  try {
6846
6994
  isGlobal = isGlobal && !args.callee.caller;
@@ -6904,14 +7052,12 @@ Wombat.prototype.wombatInit = function() {
6904
7052
  // proxy check this func
6905
7053
  this.initCheckThisFunc(this.$wbwindow);
6906
7054
 
6907
-
6908
7055
  // add __wb_import__ for modules
6909
7056
  this.initImportWrapperFunc(this.$wbwindow);
6910
7057
 
6911
7058
  // override getOwnPropertyNames
6912
7059
  this.overrideGetOwnPropertyNames(this.$wbwindow);
6913
7060
 
6914
-
6915
7061
  this.initUIEventsOverrides();
6916
7062
 
6917
7063
  // write
@@ -6941,7 +7087,11 @@ Wombat.prototype.wombatInit = function() {
6941
7087
  // can get into replay
6942
7088
  this.overrideHtmlAssign(this.$wbwindow.Element, 'innerHTML', true);
6943
7089
  this.overrideHtmlAssign(this.$wbwindow.Element, 'outerHTML', true);
6944
- this.overrideHtmlAssignSrcDoc(this.$wbwindow.HTMLIFrameElement, 'srcdoc', true);
7090
+ this.overrideHtmlAssignSrcDoc(
7091
+ this.$wbwindow.HTMLIFrameElement,
7092
+ 'srcdoc',
7093
+ true
7094
+ );
6945
7095
  this.overrideHtmlAssign(this.$wbwindow.HTMLStyleElement, 'textContent');
6946
7096
  this.overrideShadowDom();
6947
7097
 
@@ -6998,7 +7148,10 @@ Wombat.prototype.wombatInit = function() {
6998
7148
  'dispatchEvent'
6999
7149
  );
7000
7150
 
7001
- this.overrideDeProxyPropAssign(this.$wbwindow.TreeWalker.prototype, 'currentNode');
7151
+ this.overrideDeProxyPropAssign(
7152
+ this.$wbwindow.TreeWalker.prototype,
7153
+ 'currentNode'
7154
+ );
7002
7155
 
7003
7156
  this.initTimeoutIntervalOverrides();
7004
7157