Skip to content

Commit

Permalink
wombat: improved the fetch override to ensure that a live leak does n…
Browse files Browse the repository at this point in the history
…ot occur when input is an instance of WombatLocation or URL, will also handle any object that has href (#276)
  • Loading branch information
N0taN3rd authored and ikreymer committed Jan 9, 2018
1 parent 3c05f27 commit 9c56739
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pywb/static/wombat.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 || {};
Expand Down

0 comments on commit 9c56739

Please sign in to comment.