diff options
author | Chris <chris@chrismatic.io> | 2015-03-01 21:39:15 -0700 |
---|---|---|
committer | Chris <chris@chrismatic.io> | 2015-03-01 21:39:15 -0700 |
commit | 91c764821267e17b02a09a26ac2130db500e744f (patch) | |
tree | 07248bd22758ab41a364b1094c9a49134c314941 /platform/safari | |
parent | 83975124a41e135374f1555f241525b12b5b53a6 (diff) | |
download | uBlock-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.js | 13 |
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(); } |