Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Fix #4183, make onboarding behaviour consistent (#4342)
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz Brunner authored and jaredhirsch committed May 4, 2018
1 parent e0add41 commit 236e16d
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions addon/webextension/background/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,25 @@ this.main = (function() {
}

exports.onClickedContextMenu = catcher.watchFunction((info, tab) => {
if (!tab) {
// Not in a page/tab context, ignore
return;
}
if (!urlEnabled(tab.url)) {
senderror.showError({
popupMessage: "UNSHOOTABLE_PAGE"
});
return;
}
catcher.watchPromise(
toggleSelector(tab)
.then(() => sendEvent("start-shot", "context-menu", {incognito: tab.incognito})));
catcher.watchPromise(hasSeenOnboarding.then(onboarded => {
if (!tab) {
// Not in a page/tab context, ignore
return;
}
if (!urlEnabled(tab.url)) {
if (!onboarded) {
sendEvent("goto-onboarding", "selection-button", {incognito: tab.incognito});
forceOnboarding();
return;
}
senderror.showError({
popupMessage: "UNSHOOTABLE_PAGE"
});
return;
}
return toggleSelector(tab)
.then(() => sendEvent("start-shot", "context-menu", {incognito: tab.incognito}));
}));
});

function urlEnabled(url) {
Expand Down

0 comments on commit 236e16d

Please sign in to comment.