1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 00:03:28 +01:00

wombat: improved the fetch override to ensure that a live leak does not occur when input is an instance of WombatLocation or URL, will also handle any object that has href (#276)

This commit is contained in:
John Berlin 2018-01-08 19:08:21 -05:00 committed by Ilya Kreymer
parent 3c05f27829
commit 9c5673968c

View File

@ -907,13 +907,17 @@ var _WBWombat = function($wbwindow, wbinfo) {
var orig_fetch = $wbwindow.fetch;
$wbwindow.fetch = function(input, init_opts) {
if (typeof(input) === "string") {
var inputType = typeof(input);
if (inputType === "string") {
input = rewrite_url(input);
} else if (typeof(input) === "object" && input.url) {
} else if (inputType === "object" && input.url) {
var new_url = rewrite_url(input.url);
if (new_url != input.url) {
input = new Request(new_url, input);
}
} else if (inputType === "object" && input.href) {
// it is likely that input is either window.location or window.URL
input = rewrite_url(input.href);
}
init_opts = init_opts || {};