From fe28a9edbf3d910fce64e85a1b0c1dc8747401bf Mon Sep 17 00:00:00 2001 From: Chris Date: Mon, 9 Feb 2015 18:14:27 -0700 Subject: [PATCH] Safari: fixes #741. Now only HTTP/S requests are captured --- platform/safari/vapi-client.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/platform/safari/vapi-client.js b/platform/safari/vapi-client.js index 1d27e694d..f38f615cd 100644 --- a/platform/safari/vapi-client.js +++ b/platform/safari/vapi-client.js @@ -157,7 +157,8 @@ // Helper event to message background, // and helper anchor element var beforeLoadEvent = new Event("beforeload"), - linkHelper = document.createElement("a"); + linkHelper = document.createElement("a"), + isHttp_s = /^https?:/; // Inform that we've navigated if(frameId === 0) { @@ -183,9 +184,9 @@ details.parentFrameId = parentFrameId; details.timeStamp = Date.now(); return !(safari.self.tab.canLoad(beforeLoadEvent, details)); - } + }; 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; } linkHelper.href = e.url;