Home Reference Source
public class | source

WombatInit

Extends:

WombatRewriter → WombatInit

The Wombat class responsible for setting up the overrides

Constructor Summary

Public Constructor
public

constructor($wbwindow: Window, wbinfo: Object)

Member Summary

Public Members
public

top: *

public
public
Private Members
private
private
private

Method Summary

Public Methods
public

Override navigator.sendBeacon so that the url argument to the original function can be rewritten

public

Override document.cookie by adding getter and setter methods in order to rewrite the cookie such that it is valid for replay.

public

Override document.createElementNS to rewrite namespaceURI argument provided to the function to be the original namespaceURI not replay affected namespaceURI

public

Override Crypto.getRandomValues to produce pseudo-random numbers that would imitate the ones produced at preservation time

public

Override the Date constructor and Date.now to return Date objects that are at the DateTime of the replaying page

public

disable Notifications and the ability to set or watch the current position via geoloaction

public

Override eval and ensure that if the string being evaluated contains location it is rewritten to WB_wombat_location

public

Override fetch to rewrite the URL

public

Adds WB_wombat_frameElement to Object.prototype

  • if this.$wbwindow.__WB_replay_top === this.$wbwindow then define the property frameElement on $wbwindow with {value: undefined, configurable: false}
public

Override Element.getAttribute.

public

Add event listeners for message and hashchange so that Wombat can inform __WB_top_frame about hash changes

public

Override the window.Element.insertAdjacentHTML to rewrite the text argument of the original function

public

Add getters for MessageEvent attributes target,srcElement,currentTarget,eventPhase,path and marks the MessageEvents prototype as __extended

public

Override window.{postMessage,addEventListener,removeEventListener}

  • postMessage: override adds replay routing handling so that page being replayed in the iframe can communicate with its own (i)frames not the actual top or Wombat can make requests to the actual top if the message being sent requires it
  • addEventListener: if the type is message wrap the original listener in WrappedListener and add it to an internal mapping of wrapped listeners otherwise add the original listener
  • removeEventListener: if the listener to be removed was wrapped remove the wrapped listener otherwise remove the original listener
public

init_proto_pm_origin(win: window)

Add __WB_pmw to the given windows Object prototype

public

Overrides the navigator.registerProtocolHandler so that the URI argument to the original function is rewritten

public

Seed Math.random with a number that would imitate the pseudo-random numbers generated at preservation time

public

Override ServiceWorkerContainer.register in order to

  • rewrite the URL of the ServiceWorker being registered
  • if the scope of the service worker is being set rewrite it as well
public

Overrider Element.setAttribute.

public

Override the Web Worker constructor to

  • remove postMessage rewrites that are invalid given a worker context if the URL is a Blob URL
  • request the Workers JS file from the archive
public

Add WB_wombat_top property getter/setter to Object.prototype getter:

  • if the __WB_replay_top property is on the Object return __WB_replay_top
  • if the __WB_replay_top property is on the Window object return the Window object
  • otherwise return the original top setter: set the top property to value
Private Methods
private

Add an MessageEvent getter for the supplied attribute

  • if the attribute does not have an original getter does not add a new one

Public Constructors

public constructor($wbwindow: Window, wbinfo: Object) source

Params:

NameTypeAttributeDescription
$wbwindow Window
wbinfo Object

Public Members

public top: * source

public wb_getAttribute: * source

public wb_setAttribute: * source

Private Members

private __WB_counter: number source

private __WB_source: * source

private __WB_win_id: {} source

Public Methods

public init_beacon_override() source

Override navigator.sendBeacon so that the url argument to the original function can be rewritten

public init_cookies_override() source

Override document.cookie by adding getter and setter methods in order to rewrite the cookie such that it is valid for replay. Ensures

  • the path is the original path not the replay path
  • the domain is the original domain not the replay domain
  • the expires datetime is the replay expires datetime

public init_createElementNS_fix() source

Override document.createElementNS to rewrite namespaceURI argument provided to the function to be the original namespaceURI not replay affected namespaceURI

public init_crypto_random() source

Override Crypto.getRandomValues to produce pseudo-random numbers that would imitate the ones produced at preservation time

public init_date_override(timestamp: string) source

Override the Date constructor and Date.now to return Date objects that are at the DateTime of the replaying page

Params:

NameTypeAttributeDescription
timestamp string

public init_disable_notifications() source

disable Notifications and the ability to set or watch the current position via geoloaction

public init_eval_override() source

Override eval and ensure that if the string being evaluated contains location it is rewritten to WB_wombat_location

public init_fetch_rewrite() source

Override fetch to rewrite the URL

public init_frameElement_override() source

Adds WB_wombat_frameElement to Object.prototype

  • if this.$wbwindow.__WB_replay_top === this.$wbwindow then define the property frameElement on $wbwindow with {value: undefined, configurable: false}

public init_getAttribute_override() source

Override Element.getAttribute.

  • if the attribute being gotten is one of the rewritten attributes for a particular element extract the original value and return it.
  • otherwise return the value of the attribute as is.

public init_hash_change() source

Add event listeners for message and hashchange so that Wombat can inform __WB_top_frame about hash changes

public init_insertAdjacentHTML_override() source

Override the window.Element.insertAdjacentHTML to rewrite the text argument of the original function

public init_messageevent_override() source

Add getters for MessageEvent attributes target,srcElement,currentTarget,eventPhase,path and marks the MessageEvents prototype as __extended

public init_postmessage_override() source

Override window.{postMessage,addEventListener,removeEventListener}

  • postMessage: override adds replay routing handling so that page being replayed in the iframe can communicate with its own (i)frames not the actual top or Wombat can make requests to the actual top if the message being sent requires it
  • addEventListener: if the type is message wrap the original listener in WrappedListener and add it to an internal mapping of wrapped listeners otherwise add the original listener
  • removeEventListener: if the listener to be removed was wrapped remove the wrapped listener otherwise remove the original listener

public init_proto_pm_origin(win: window) source

Add __WB_pmw to the given windows Object prototype

Params:

NameTypeAttributeDescription
win window
  • nullable: false

public init_registerPH_override() source

Overrides the navigator.registerProtocolHandler so that the URI argument to the original function is rewritten

public init_seeded_random(seed: string) source

Seed Math.random with a number that would imitate the pseudo-random numbers generated at preservation time

Params:

NameTypeAttributeDescription
seed string

public init_service_worker_override() source

Override ServiceWorkerContainer.register in order to

  • rewrite the URL of the ServiceWorker being registered
  • if the scope of the service worker is being set rewrite it as well

public init_setAttribute_override() source

Overrider Element.setAttribute.

  • if the attribute being set equals one of the attributes to be rewritten, rewrite it
  • otherwise the Elements attribute is set to the original value

public init_web_worker_override() source

Override the Web Worker constructor to

  • remove postMessage rewrites that are invalid given a worker context if the URL is a Blob URL
  • request the Workers JS file from the archive

public init_wombat_top() source

Add WB_wombat_top property getter/setter to Object.prototype getter:

  • if the __WB_replay_top property is on the Object return __WB_replay_top
  • if the __WB_replay_top property is on the Window object return the Window object
  • otherwise return the original top setter: set the top property to value

Private Methods

private _addMEOverride(attr: string) source

Add an MessageEvent getter for the supplied attribute

  • if the attribute does not have an original getter does not add a new one

Params:

NameTypeAttributeDescription
attr string

the attribute to add the getter for