Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refining onBeforeRequest handler to minimize the number of requests without corresponding page url. #138

Merged
merged 10 commits into from Aug 2, 2018
Lint errors
  • Loading branch information
zarembsky committed Jul 16, 2018
commit 0a6568cd3f94d798e4b00e806b964499a7b2c71d
@@ -335,26 +335,26 @@ class EventHandlers {
return { cancel: false };
}

if(details.type === 'main_frame') {
if(!tabInfo.getTabInfo(tab_id)) {
if (details.type === 'main_frame') {
if (!tabInfo.getTabInfo(tab_id)) {
tabInfo.create(tab_id, details.url);
} else {
tabInfo.setTabInfo(tab_id, 'url', details.url);
}
}
}

if(!tabInfo.getTabInfo(tab_id)) {
if (!tabInfo.getTabInfo(tab_id)) {
utils.getTab(tab_id, (tab) => {
if(!tabInfo.getTabInfo(tab_id)) {
tabInfo.create(tab_id, tab.url);
} else {
tabInfo.setTabInfo(tab_id, 'url', tab.url);
}
tabInfo.setTabInfo(tab_id, 'incognito', tab.incognito);
},
error => {
log("TAB CANNOT BE QUERIED", error, tabInfo.getTabInfo(tab_id));
if (!tabInfo.getTabInfo(tab_id)) {
tabInfo.create(tab_id, tab.url);
} else {
tabInfo.setTabInfo(tab_id, 'url', tab.url);
}
tabInfo.setTabInfo(tab_id, 'incognito', tab.incognito);
},
(error) => {
log('TAB CANNOT BE QUERIED', error, tabInfo.getTabInfo(tab_id));
}
);
}

ProTip! Use n and p to navigate between commits in a pull request.