aboutsummaryrefslogtreecommitdiffstats
path: root/platform/safari
diff options
context:
space:
mode:
authorChris <chris@chrismatic.io>2015-03-01 21:39:15 -0700
committerChris <chris@chrismatic.io>2015-03-01 21:39:15 -0700
commit91c764821267e17b02a09a26ac2130db500e744f (patch)
tree07248bd22758ab41a364b1094c9a49134c314941 /platform/safari
parent83975124a41e135374f1555f241525b12b5b53a6 (diff)
downloaduBlock-91c764821267e17b02a09a26ac2130db500e744f.zip
uBlock-91c764821267e17b02a09a26ac2130db500e744f.tar.gz
uBlock-91c764821267e17b02a09a26ac2130db500e744f.tar.bz2
Safari: minor scoping tweaks
Diffstat (limited to 'platform/safari')
-rw-r--r--platform/safari/vapi-client.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/platform/safari/vapi-client.js b/platform/safari/vapi-client.js
index 6e0eacf..59c08de 100644
--- a/platform/safari/vapi-client.js
+++ b/platform/safari/vapi-client.js
@@ -27,6 +27,13 @@
if(vAPI.vapiClientInjected) {
return;
}
+ var safari;
+ if(typeof self.safari === "undefined") {
+ safari = self.top.safari;
+ }
+ else {
+ safari = self.safari;
+ }
vAPI.vapiClientInjected = true;
vAPI.safari = true;
vAPI.sessionId = String.fromCharCode(Date.now() % 25 + 97) +
@@ -71,9 +78,6 @@
listeners: {},
requestId: 1,
setup: function() {
- if(typeof safari === "undefined") {
- return;
- }
this.connector = function(msg) {
// messages from the background script are sent to every frame,
// so we need to check the vAPI.sessionId to accept only
@@ -107,9 +111,6 @@
channelName: channelName,
listener: typeof callback === 'function' ? callback : null,
send: function(message, callback) {
- if(typeof safari === "undefined") {
- return;
- }
if(!vAPI.messaging.connector) {
vAPI.messaging.setup();
}