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) {
|
function getTabRealURL(tab, callback) {
|
||||||
if (tab.url != "chrome://newtab/") {
|
if (tab.url != "chrome://newtab/") {
|
||||||
callback(tab.url);
|
callback(tab.url);
|
||||||
return;
|
} else {
|
||||||
}
|
chrome.webNavigation.getFrame({tabId: tab.id, frameId: 0, processId: -1}, function(frame) {
|
||||||
chrome.webNavigation.getAllFrames({tabId: tab.id}, function(frames) {
|
frame && callback(frame.url);
|
||||||
frames.some(function(frame) {
|
|
||||||
if (frame.parentFrameId == -1) { // parentless frame is the main frame
|
|
||||||
callback(frame.url);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user