mirror of
https://github.com/gorhill/uBlock.git
synced 2024-09-04 18:19:38 +02:00
Safari: fixes #741. Now only HTTP/S requests are captured
This commit is contained in:
parent
0acb14c5a0
commit
fe28a9edbf
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user