From a3401b057209dc9f02687592c27b0a5458558b3e Mon Sep 17 00:00:00 2001 From: tophf Date: Fri, 24 Jul 2015 14:36:43 +0300 Subject: [PATCH] Simplify getActiveTabRealURL: main frame is always 0 --- messaging.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/messaging.js b/messaging.js index cfe9fbd8..ea30055b 100644 --- a/messaging.js +++ b/messaging.js @@ -76,14 +76,9 @@ function getActiveTabRealURL(callback) { function getTabRealURL(tab, callback) { if (tab.url != "chrome://newtab/") { callback(tab.url); - return; - } - chrome.webNavigation.getAllFrames({tabId: tab.id}, function(frames) { - frames.some(function(frame) { - if (frame.parentFrameId == -1) { // parentless frame is the main frame - callback(frame.url); - return true; - } + } else { + chrome.webNavigation.getFrame({tabId: tab.id, frameId: 0, processId: -1}, function(frame) { + frame && callback(frame.url); }); - }); + } }