1
0
mirror of https://github.com/webrecorder/pywb.git synced 2025-03-15 08:04:49 +01:00
ajax: always explicitly add X-Requested-With: XMLHttpRequest to ajax requests
mutation obs: don't rewrite <link rel=canonical> with node added observer
This commit is contained in:
Ilya Kreymer 2015-05-14 11:32:44 -07:00
parent 97df6300eb
commit 6a9c54c79b

View File

@ -533,7 +533,8 @@ _WBWombat = (function() {
async = true;
}
return orig.call(this, method, url, async, user, password);
result = orig.call(this, method, url, async, user, password);
this.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
}
window.XMLHttpRequest.prototype.open = open_rewritten;
@ -741,6 +742,11 @@ _WBWombat = (function() {
var r = records[i];
if (r.type == "childList") {
for (var j = 0; j < r.addedNodes.length; j++) {
// skip canonical link tag, should have been handled by server-side rewrite
// (maybe skip all links?)
if (r.addedNodes[j].tagName == "LINK" && r.addedNodes[j].rel == "canonical") {
continue;
}
rewrite_attr(r.addedNodes[j], "href", rewrite_url);
rewrite_attr(r.addedNodes[j], "src", rewrite_url);
}
@ -871,7 +877,6 @@ _WBWombat = (function() {
created.contentWindow.WB_wombat_location = created.contentWindow.location;
}
override_attr(created, "src");
} else if (created.tagName && equals_any(created.tagName, SRC_TAGS)) {
override_attr(created, "src");