From 4901b11faeac7c11d69a21b5d2ae83bf28a6f127 Mon Sep 17 00:00:00 2001 From: Chris Date: Tue, 20 Jan 2015 00:44:04 -0700 Subject: [PATCH] Doh --- platform/safari/vapi-background.js | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/platform/safari/vapi-background.js b/platform/safari/vapi-background.js index cec28f415..1032af7e2 100644 --- a/platform/safari/vapi-background.js +++ b/platform/safari/vapi-background.js @@ -189,23 +189,20 @@ vAPI.tabs = { vAPI.tabs.registerListeners = function() { safari.application.addEventListener('beforeNavigate', function(e) { - if ( !e.target || e.url === 'about:blank' ) { + if ( !vAPI.tabs.popupCandidate || !e.target || e.url === 'about:blank' ) { return; } var url = e.url, tabId = vAPI.tabs.getTabId(e.target); - if ( vAPI.tabs.popupCandidate ) { - var details = { - url: url, - tabId: tabId, - sourceTabId: vAPI.tabs.popupCandidate - }; - vAPI.tabs.popupCandidate = false; - if ( vAPI.tabs.onPopup(details) ) { - e.preventDefault(); - if ( vAPI.tabs.stack[details.sourceTabId] ) { - vAPI.tabs.stack[details.sourceTabId].activate(); - } - return; + var details = { + url: url, + tabId: tabId, + sourceTabId: vAPI.tabs.popupCandidate + }; + vAPI.tabs.popupCandidate = false; + if ( vAPI.tabs.onPopup(details) ) { + e.preventDefault(); + if ( vAPI.tabs.stack[details.sourceTabId] ) { + vAPI.tabs.stack[details.sourceTabId].activate(); } } }, true);