WombatRewriter
The base Wombat Class, responsible for rewrites
Member Summary
Public Members | ||
public |
The window object associated with iframe[id="replay_iframe"] |
|
public |
BAD_PREFIXES: string[] | undefined An array of bad prefixes, use WombatRewriter#init_bad_prefixes to initialize it |
|
public |
Array of HTML tag names that have the src attribute
|
|
public |
https:// |
|
public |
http:// |
|
public |
Array of prefixes to be ignored
|
|
public |
The regular expression to rewrite a cookies IP address |
|
public |
// |
|
public |
Array of HTML tag names that have contain attributes to be rewritten
|
|
public |
Array of HTML tag names that have the src attribute
|
|
public |
The style parsing regular expression used when rewriting style attributes |
|
public |
Array of URL property names
|
|
public |
Array of valid prefixes |
|
public |
The regular expression to rewrite a cookies domain |
|
public |
The regular expression to rewrite a cookies expires |
|
public |
The regular expression to rewrite a cookies path |
|
public |
|
|
public |
|
|
public |
|
|
public |
wb_getAttribute: Element.prototype.function |
|
public |
Wombat information concerning replay |
|
public |
|
|
public |
Custom options |
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
|
|
public |
wb_setAttribute: Element.prototype.function |
|
public |
Is wb_wombat updating |
|
public |
buffered used by {WombatRewriter#rewrite_html} |
Method Summary
Public Methods | ||
public |
extract_orig(href: string): string Extract the origin from a given href |
|
public |
get_final_url(prefix: string, mod: string, url: string): string Apply the wb_info.mod and appropriate prefix to the url |
|
public |
init_bad_prefixes(prefix: string) Initialize the BAD_PREFIXES array with the given prefix |
|
public |
init_paths(wbinfo: {?wombat_opts: Object, prefix: string, wombat_scheme: string, top_host: string, ?proxy_magic: string|boolean, wombat_host: string, is_live: boolean, wombat_ts: string, is_framed: boolean}) Initialize Wombat metadata about replay or proxy |
|
public |
make_parser(href: string): Element Create a parser element |
|
public |
resolve_rel_url(url: string): string Resolve the given relative url |
|
public |
rewrite_attr(elem: DomElement, name: string, abs_url_only: boolean): boolean | undefined Rewrite the attribute of a given element |
|
public |
rewrite_blob(url: string): string Request a blob and remove __WB_pmw rewrites that may have been made to the blobs contents |
|
public |
rewrite_cookie(cookie: string): string Rewrite a cookie
|
|
public |
rewrite_elem(elem: DomElement): boolean Rewrite a DOM Element WombatRewriter#rewrite_style WombatRewriter#rewrite_frame_src WombatRewriter#rewrite_attr |
|
public |
rewrite_frame_src(elem: DomElement, name: string): boolean Rewrite a frames src attribute |
|
public |
rewrite_html(string: string, check_end_tag: boolean): string Rewrite a string containing HTML markup |
|
public |
rewrite_srcset(value: string): string Rewrite a srcset value |
|
public |
rewrite_style(value: string): string rewrite the value of a style tag |
|
public |
rewrite_url_debug(url: string, use_rel: boolean, mod: string): string debug version of WombatRewriter#rewriteurl |
Private Methods | ||
private |
_rewriteCookieDomain(cookie: string, m: string, m1: string): string Rewrites the cookies domain |
|
private |
_rewriteCookiePath(m: string, m1: string): string Rewrite a cookies path |
|
private |
_setCookieExpiresRewrite(m: string, d1: string): string Rewrite the expires datetime of cookie when set |
|
private |
rewrite_url_(url: string, use_rel: boolean, mod: string): string Rewrite the given url |
Public Members
public BAD_PREFIXES: string[] | undefined source
An array of bad prefixes, use WombatRewriter#init_bad_prefixes to initialize it
public IGNORE_PREFIXES: string[] source
Array of prefixes to be ignored
["#", "about:", "data:", "mailto:", "javascript:", "{", "*"]
public REWRITE_ATTRS: string[] source
Array of HTML tag names that have contain attributes to be rewritten
["src", "href", "poster"]
public SRC_TAGS: string[] source
Array of HTML tag names that have the src attribute
["IFRAME", "IMG", "SCRIPT", "VIDEO", "AUDIO", "SOURCE", "EMBED", "INPUT"]
public STYLE_REGEX: RegExp source
The style parsing regular expression used when rewriting style attributes
public URL_PROPS: string[] source
Array of URL property names
["href", "hash", "pathname", "host", "hostname", "protocol", "origin", "search", "port"]
public wb_getAttribute: Element.prototype.function source
public wb_info: {is_live: boolean, wombat_ts: string, mod: string} source
Wombat information concerning replay
public wb_setAttribute: Element.prototype.function source
Public Methods
public extract_orig(href: string): string source
Extract the origin from a given href
Params:
Name | Type | Attribute | Description |
href | string | the href to extract the origin from |
public get_final_url(prefix: string, mod: string, url: string): string source
Apply the wb_info.mod and appropriate prefix to the url
public init_bad_prefixes(prefix: string) source
Initialize the BAD_PREFIXES array with the given prefix
Params:
Name | Type | Attribute | Description |
prefix | string | the bad prefix |
public init_paths(wbinfo: {?wombat_opts: Object, prefix: string, wombat_scheme: string, top_host: string, ?proxy_magic: string|boolean, wombat_host: string, is_live: boolean, wombat_ts: string, is_framed: boolean}) source
Initialize Wombat metadata about replay or proxy
public make_parser(href: string): Element source
Create a parser element
Params:
Name | Type | Attribute | Description |
href | string | the href of the parser element |
public resolve_rel_url(url: string): string source
Resolve the given relative url
Params:
Name | Type | Attribute | Description |
url | string | the relative url to resolve |
public rewrite_attr(elem: DomElement, name: string, abs_url_only: boolean): boolean | undefined source
Rewrite the attribute of a given element
Params:
Name | Type | Attribute | Description |
elem | DomElement | the element who's attribute is to be rewritten |
|
name | string | the name of the attribute to be rewritten |
|
abs_url_only | boolean | if the attribute of the element tobe rewritten is for instance href set to true if the rewrite is to be made if the original value of the attribute is an absolute url |
public rewrite_blob(url: string): string source
Request a blob and remove __WB_pmw rewrites that may have been made to the blobs contents
Params:
Name | Type | Attribute | Description |
url | string | the URL of the blob |
public rewrite_cookie(cookie: string): string source
Rewrite a cookie
- the path to the original path not the replay path
- the domain to the original domain not the replay domain
Params:
Name | Type | Attribute | Description |
cookie | string | the cookie to be rewritten |
public rewrite_elem(elem: DomElement): boolean source
Rewrite a DOM Element WombatRewriter#rewrite_style WombatRewriter#rewrite_frame_src WombatRewriter#rewrite_attr
Params:
Name | Type | Attribute | Description |
elem | DomElement | the element to rewrite |
Return:
boolean (nullable: true) | returns true or false depending on if the element being rewritten changed returns undefined if the element is null or undefined |
public rewrite_frame_src(elem: DomElement, name: string): boolean source
Rewrite a frames src attribute
Params:
Name | Type | Attribute | Description |
elem | DomElement | the frame element whoes src attribute to rewrite |
|
name | string | the name of the property to rewrite |
public rewrite_html(string: string, check_end_tag: boolean): string source
Rewrite a string containing HTML markup
public rewrite_srcset(value: string): string source
Rewrite a srcset value
Params:
Name | Type | Attribute | Description |
value | string |
public rewrite_style(value: string): string source
rewrite the value of a style tag
Params:
Name | Type | Attribute | Description |
value | string |
public rewrite_url_debug(url: string, use_rel: boolean, mod: string): string source
debug version of WombatRewriter#rewriteurl
Private Methods
private _rewriteCookieDomain(cookie: string, m: string, m1: string): string source
Rewrites the cookies domain
private _setCookieExpiresRewrite(m: string, d1: string): string source
Rewrite the expires datetime of cookie when set
private rewrite_url_(url: string, use_rel: boolean, mod: string): string source
Rewrite the given url
Return:
string (nullable: true) | if the url to be rewritten is undefined or null returns the original value
|