Skip to content

Commit

Permalink
That should cover most of the MAC handling now
Browse files Browse the repository at this point in the history
Part of #29
  • Loading branch information
stoically committed Feb 24, 2018
1 parent be57438 commit 355c537
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 4 additions & 0 deletions src/background/request.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,10 @@ class Request {
}

if (macAssignment) {
if (tab && tab.cookieStoreId && this.storage.local.tempContainers[tab.cookieStoreId]) {
debug('[handleNotClickedLink] mac assigned but we are already in a tmp container, we do nothing', request, tab, macAssignment);
return;
}
debug('[handleNotClickedLink] decided to reopen but mac assigned, maybe reopen confirmpage', request, tab, macAssignment);
// we dont know here whether to cancel or not, just let it fall through
return this.mac.maybeReopenConfirmPage(macAssignment, request, tab, deletesHistoryContainer);
Expand Down
18 changes: 8 additions & 10 deletions test/background.mac.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ preferencesTestSet.map(preferences => { describe(`preferences: ${JSON.stringify(
});

it('should sometimes reopen the confirm page', async () => {
if (preferences.automaticModeNewTab === 'navigation') {
switch (preferences.automaticModeNewTab) {
case 'navigation':
if (confirmPage !== 'last' && confirmPage !== 'first') {
browser.tabs.remove.should.not.have.been.called;
browser.tabs.create.should.not.have.been.called;
Expand All @@ -76,15 +77,12 @@ preferencesTestSet.map(preferences => { describe(`preferences: ${JSON.stringify(
browser.tabs.remove.should.have.been.called;
browser.tabs.create.should.have.been.called;
}
} else {
if (confirmPage !== 'last') {
browser.tabs.remove.should.not.have.been.called;
browser.tabs.create.should.not.have.been.called;
} else {
// TODO dont reopen clean/created containers
browser.tabs.remove.should.have.been.called;
browser.tabs.create.should.have.been.called;
}
break;

case 'created':
browser.tabs.remove.should.not.have.been.called;
browser.tabs.create.should.not.have.been.called;
break;
}
});

Expand Down

0 comments on commit 355c537

Please sign in to comment.