Safari: fixes #741. Now only HTTP/S requests are captured

This commit is contained in:
Chris 2015-02-09 18:14:27 -07:00
parent 0acb14c5a0
commit fe28a9edbf
1 changed files with 4 additions and 3 deletions

View File

@ -157,7 +157,8 @@
// Helper event to message background, // Helper event to message background,
// and helper anchor element // and helper anchor element
var beforeLoadEvent = new Event("beforeload"), var beforeLoadEvent = new Event("beforeload"),
linkHelper = document.createElement("a"); linkHelper = document.createElement("a"),
isHttp_s = /^https?:/;
// Inform that we've navigated // Inform that we've navigated
if(frameId === 0) { if(frameId === 0) {
@ -183,9 +184,9 @@
details.parentFrameId = parentFrameId; details.parentFrameId = parentFrameId;
details.timeStamp = Date.now(); details.timeStamp = Date.now();
return !(safari.self.tab.canLoad(beforeLoadEvent, details)); return !(safari.self.tab.canLoad(beforeLoadEvent, details));
} };
var onBeforeLoad = function(e) { var onBeforeLoad = function(e) {
if(e.url.lastIndexOf("data:", 0) === 0) { if(e.url.charCodeAt(0) !== 104 && !isHttp_s.test(e.url)) { // h = 104
return; return;
} }
linkHelper.href = e.url; linkHelper.href = e.url;