mirror of
https://github.com/gorhill/uBlock.git
synced 2024-11-20 01:12:38 +01:00
Safari: minor scoping tweaks
This commit is contained in:
parent
83975124a4
commit
91c7648212
@ -27,6 +27,13 @@
|
|||||||
if(vAPI.vapiClientInjected) {
|
if(vAPI.vapiClientInjected) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var safari;
|
||||||
|
if(typeof self.safari === "undefined") {
|
||||||
|
safari = self.top.safari;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
safari = self.safari;
|
||||||
|
}
|
||||||
vAPI.vapiClientInjected = true;
|
vAPI.vapiClientInjected = true;
|
||||||
vAPI.safari = true;
|
vAPI.safari = true;
|
||||||
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
|
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
|
||||||
@ -71,9 +78,6 @@
|
|||||||
listeners: {},
|
listeners: {},
|
||||||
requestId: 1,
|
requestId: 1,
|
||||||
setup: function() {
|
setup: function() {
|
||||||
if(typeof safari === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.connector = function(msg) {
|
this.connector = function(msg) {
|
||||||
// messages from the background script are sent to every frame,
|
// messages from the background script are sent to every frame,
|
||||||
// so we need to check the vAPI.sessionId to accept only
|
// so we need to check the vAPI.sessionId to accept only
|
||||||
@ -107,9 +111,6 @@
|
|||||||
channelName: channelName,
|
channelName: channelName,
|
||||||
listener: typeof callback === 'function' ? callback : null,
|
listener: typeof callback === 'function' ? callback : null,
|
||||||
send: function(message, callback) {
|
send: function(message, callback) {
|
||||||
if(typeof safari === "undefined") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(!vAPI.messaging.connector) {
|
if(!vAPI.messaging.connector) {
|
||||||
vAPI.messaging.setup();
|
vAPI.messaging.setup();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user