Simplify getActiveTabRealURL: main frame is always 0
This commit is contained in:
parent
7d25709a7d
commit
a3401b0572
13
messaging.js
13
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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user