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

Add WebAuthn support in entitlements and fix provisioning profile cop… #4247

Closed
wants to merge 16 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
1351d02
Add WebAuthn support in entitlements and fix provisioning profile cop…
mauro-balades Jan 9, 2025
859ff6c
Update @zen-browser/surfer dependency to version 1.9.8 in package.jso…
mauro-balades Jan 9, 2025
ed7735e
Update build.yml
mauro-balades Jan 10, 2025
18f8447
Update zen.desktop
mauro-balades Jan 10, 2025
a035b6f
Fixed urlbar being below the tabs visually (closes https://github.com…
mauro-balades Jan 11, 2025
a5d1537
Add TODO comment to handle user preferences for tab opening behavior
mauro-balades Jan 11, 2025
e01af2f
Fixed closing the last tab of a workspace not opening a new tab when …
mauro-balades Jan 11, 2025
8981160
Implement logic to close window when last tab is closed based on user…
mauro-balades Jan 11, 2025
70cd0f9
Fixed weird margins on the browser view when having right sided tabs
mauro-balades Jan 11, 2025
8562cfb
Refactor tab closing logic to handle new tab creation when closing th…
mauro-balades Jan 11, 2025
097404b
Refactor tab animation logic to improve workspace transitions and rem…
mauro-balades Jan 11, 2025
1f43997
Workspace switching animations are now context aware
mauro-balades Jan 11, 2025
997384e
Merge pull request #4282 from zen-browser/new-workspace-functionality
mauro-balades Jan 11, 2025
50a48cd
Add conditional check for branch verification in build workflow
mauro-balades Jan 11, 2025
2838af2
Add WebAuthn support in entitlements and fix provisioning profile cop…
mauro-balades Jan 9, 2025
8a5aade
Merge branch 'macos-entitlement-fix' of https://github.com/zen-browse…
mauro-balades Jan 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
token: ${{ secrets.DEPLOY_KEY }}

- name: Check if correct branch
if: ${{ inputs.create_release }}
run: |
echo "Checking if we are on the correct branch"
git branch
Expand Down Expand Up @@ -386,7 +387,7 @@ jobs:

if [ "${{ inputs.update_branch }}" = "twilight" ]; then
sed -i -e 's/Name=Zen Browser/Name=Zen Twilight/g' AppDir/zen.desktop
sed -i -e 's/StartupWMClass=zen-release/StartupWMClass=zen-twilight/g' AppDir/zen.desktop
sed -i -e 's/StartupWMClass=zen/StartupWMClass=zen-twilight/g' AppDir/zen.desktop
fi

APPDIR=AppDir
Expand Down
2 changes: 1 addition & 1 deletion AppDir/zen.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Exec=zen %u
Icon=zen
Type=Application
MimeType=text/html;text/xml;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;application/x-xpinstall;application/pdf;application/json;
StartupWMClass=zen-release
StartupWMClass=zen
Categories=Network;WebBrowser;
StartupNotify=true
Terminal=false
Expand Down
3 changes: 3 additions & 0 deletions build/codesign/browser.developer.entitlements.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,8 @@
<!-- Required for com.apple.developer.web-browser.public-key-credential -->
<key>com.apple.application-identifier</key>
<string>H36NPCN86W.app.zen-browser.zen</string>

<!-- For platform passkey (webauthn) support -->
<key>com.apple.developer.web-browser.public-key-credential</key><true/>
</dict>
</plist>
2 changes: 1 addition & 1 deletion build/codesign/codesign.bash
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ echo "-------------------------------------------------------------------------"
set -x

# move Zen_Browser.provisionprofile to the Contents directory
#cp Zen_Browser.provisionprofile "${BUNDLE}"/Contents/embedded.provisionprofile
cp Zen_Browser.provisionprofile "${BUNDLE}"/Contents/embedded.provisionprofile

# Clear extended attributes which cause codesign to fail
xattr -cr "${BUNDLE}"
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"homepage": "https://github.com/zen-browser/core#readme",
"dependencies": {
"@zen-browser/surfer": "^1.9.7"
"@zen-browser/surfer": "^1.9.8"
},
"devDependencies": {
"husky": "^9.1.7",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions src/browser/base/content/zen-styles/zen-animations.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,28 +100,6 @@
}
}

@keyframes zen-slide-in {
from {
transform: translateX(-150%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}

@keyframes zen-slide-in-reverse {
from {
transform: translateX(150%);
opacity: 0;
}
to {
transform: translateX(0);
opacity: 1;
}
}

@keyframes zen-deck-fadeIn {
0% {
transform: scale(0.9);
Expand Down
2 changes: 1 addition & 1 deletion src/browser/base/content/zen-styles/zen-browser-ui.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions src/browser/base/content/zen-styles/zen-tabs/vertical-tabs.css
Original file line number Diff line number Diff line change
Expand Up @@ -242,23 +242,6 @@
& .tabbrowser-tab {
transition: scale 0.07s ease;
#tabbrowser-tabs &:not([zen-essential='true']) {
#tabbrowser-tabs[zen-workspace-animation='previous'] & {
animation: zen-slide-in;
}

#tabbrowser-tabs[zen-workspace-animation='next'] & {
animation: zen-slide-in-reverse;
}

#tabbrowser-tabs[zen-workspace-animation] & {
opacity: 0;
transform: translateX(-100%);
animation-delay: 0.2s;
animation-fill-mode: forwards;
animation-duration: 0.2s;
animation-timing-function: ease;
}

#tabbrowser-tabs[dont-animate-tabs] & {
opacity: 0;
}
Expand Down
1 change: 1 addition & 0 deletions src/browser/base/content/zen-styles/zen-urlbar.css
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ button.popup-notification-dropmarker {
}

#urlbar[open] {
z-index: 2;
--urlbar-margin-inline: 5px !important;

& #identity-box {
Expand Down
2 changes: 1 addition & 1 deletion src/browser/base/zen-components/ZenGradientGenerator.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@
setTimeout(() => {
// Reactivate the transition after the animation
appWrapper.removeAttribute('post-animating');
});
}, 100);
}, 700);
});
}
Expand Down
112 changes: 83 additions & 29 deletions src/browser/base/zen-components/ZenWorkspaces.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
activeWorkspace = workspaces.workspaces[0];
this.activeWorkspace = activeWorkspace?.uuid;
}
await this.changeWorkspace(activeWorkspace, true);
await this.changeWorkspace(activeWorkspace, { onInit: true });
}
try {
if (activeWorkspace) {
Expand All @@ -415,6 +415,10 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
indicator.addEventListener('click', th);
}

shouldCloseWindow() {
return !window.toolbar.visible || Services.prefs.getBoolPref('browser.tabs.closeWindowWithLastTab');
}

handleTabBeforeClose(tab) {
if (!this.workspaceEnabled || this.__contextIsDelete) {
return null;
Expand All @@ -425,17 +429,33 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
return null;
}

const shouldOpenNewTabIfLastUnpinnedTabIsClosed = this.shouldOpenNewTabIfLastUnpinnedTabIsClosed;

let tabs = gBrowser.tabs.filter(
(t) =>
t.getAttribute('zen-workspace-id') === workspaceID &&
(!shouldOpenNewTabIfLastUnpinnedTabIsClosed || !t.pinned || t.getAttribute('pending') !== 'true')
);
let tabs = gBrowser.visibleTabs;
let tabsPinned = tabs.filter((t) => !this.shouldOpenNewTabIfLastUnpinnedTabIsClosed || !t.pinned);

const shouldCloseWindow = this.shouldCloseWindow();
if (tabs.length === 1 && tabs[0] === tab) {
let newTab = this._createNewTabForWorkspace({ uuid: workspaceID });
return newTab;
if (shouldCloseWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
// so avoid calling it again:
window.skipNextCanClose = true;

// Closing the tab and replacing it with a blank one is notably slower
// than closing the window right away. If the caller opts in, take
// the fast path.
if (!gBrowser._removingTabs.size) {
// This call actually closes the window, unless the user
// cancels the operation. We are finished here in both cases.
this._isClosingWindow = true;
// Inside a setTimeout to avoid reentrancy issues.
setTimeout(() => {
document.getElementById('cmd_closeWindow').doCommand();
}, 100);
return this._createNewTabForWorkspace({ uuid: workspaceID });
}
return null;
}
} else if (tabsPinned.length === 1 && tabsPinned[0] === tab) {
return this._createNewTabForWorkspace({ uuid: workspaceID });
}

return null;
Expand Down Expand Up @@ -1247,22 +1267,22 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
this._changeListeners.push(func);
}

async changeWorkspace(window, onInit = false) {
async changeWorkspace(window, ...args) {
if (!this.workspaceEnabled || this._inChangingWorkspace) {
return;
}

await SessionStore.promiseInitialized;
this._inChangingWorkspace = true;
try {
await this._performWorkspaceChange(window, onInit);
await this._performWorkspaceChange(window, ...args);
} finally {
this._inChangingWorkspace = false;
this.tabContainer.removeAttribute('dont-animate-tabs');
}
}

async _performWorkspaceChange(window, onInit) {
async _performWorkspaceChange(window, { onInit = false, explicitAnimationDirection = undefined } = {}) {
const previousWorkspace = await this.getActiveWorkspace();

this.activeWorkspace = window.uuid;
Expand All @@ -1272,6 +1292,21 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
// Refresh tab cache
this.tabContainer._invalidateCachedTabs();

let animationDirection;
if (previousWorkspace && !onInit && !this._animatingChange) {
animationDirection =
explicitAnimationDirection ??
(workspaces.workspaces.findIndex((w) => w.uuid === previousWorkspace.uuid) <
workspaces.workspaces.findIndex((w) => w.uuid === window.uuid)
? 'right'
: 'left');
}
if (animationDirection) {
// Animate tabs out of view before changing workspace, therefor we
// need to animate in the opposite direction
await this._animateTabs(animationDirection === 'left' ? 'right' : 'left', true);
}

// First pass: Handle tab visibility and workspace ID assignment
const visibleTabs = this._processTabVisibility(window.uuid, containerId, workspaces);

Expand All @@ -1281,23 +1316,42 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
// Update UI and state
await this._updateWorkspaceState(window, onInit);

// Animate acordingly
if (previousWorkspace && !this._animatingChange) {
// we want to know if we are moving forward or backward in sense of animation
let isNextWorkspace =
onInit ||
workspaces.workspaces.findIndex((w) => w.uuid === previousWorkspace.uuid) <
workspaces.workspaces.findIndex((w) => w.uuid === window.uuid);
gBrowser.tabContainer.setAttribute('zen-workspace-animation', isNextWorkspace ? 'next' : 'previous');
this.tabContainer.removeAttribute('dont-animate-tabs');
this._animatingChange = true;
setTimeout(() => {
this._animatingChange = false;
gBrowser.tabContainer.removeAttribute('zen-workspace-animation');
}, 600);
if (animationDirection) {
await this._animateTabs(animationDirection);
}
}

async _animateTabs(direction, out = false) {
const tabs = gBrowser.visibleTabs.filter((tab) => !tab.hasAttribute('zen-essential'));
return new Promise((resolve) => {
let count = 0;
const onAnimationEnd = () => {
count++;
if (count >= tabs.length) {
resolve();
}
};
this.tabContainer.removeAttribute('dont-animate-tabs');
if (out) {
for (let tab of tabs) {
tab.animate([{ transform: 'translateX(0)' }, { transform: `translateX(${direction === 'left' ? '-' : ''}100%)` }], {
duration: 150,
easing: 'ease',
fill: 'both',
}).onfinish = onAnimationEnd;
}
return;
}
for (let tab of tabs) {
tab.animate([{ transform: `translateX(${direction === 'left' ? '-' : ''}100%)` }, { transform: 'translateX(0)' }], {
duration: 150,
easing: 'ease',
fill: 'both',
}).onfinish = onAnimationEnd;
}
});
}

_processTabVisibility(workspaceUuid, containerId, workspaces) {
const visibleTabs = new Set();
const lastSelectedTab = this._lastSelectedWorkspaceTabs[workspaceUuid];
Expand Down Expand Up @@ -1524,7 +1578,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}

async onLocationChange(browser) {
if (!this.workspaceEnabled || this._inChangingWorkspace) {
if (!this.workspaceEnabled || this._inChangingWorkspace || this._isClosingWindow) {
return;
}

Expand Down Expand Up @@ -1663,7 +1717,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
}

let nextWorkspace = workspaces.workspaces[targetIndex];
await this.changeWorkspace(nextWorkspace);
await this.changeWorkspace(nextWorkspace, { explicitAnimationDirection: offset > 0 ? 'right' : 'left' });
}

_initializeWorkspaceTabContextMenus() {
Expand Down
12 changes: 10 additions & 2 deletions src/browser/components/tabbrowser/content/tabbrowser-js.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/browser/components/tabbrowser/content/tabbrowser.js b/browser/components/tabbrowser/content/tabbrowser.js
index ce68c339f35416574b7bc7ebf8c93378f653242b..46d25e4381eaae71f3aec1025788684c593a60c7 100644
index ce68c339f35416574b7bc7ebf8c93378f653242b..07e3f7fcdb3e219c523201929cf07b6878d4d394 100644
--- a/browser/components/tabbrowser/content/tabbrowser.js
+++ b/browser/components/tabbrowser/content/tabbrowser.js
@@ -409,11 +409,39 @@
Expand Down Expand Up @@ -237,7 +237,7 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..46d25e4381eaae71f3aec1025788684c
if (
!this._beginRemoveTab(aTab, {
closeWindowFastpath: true,
@@ -4556,7 +4657,7 @@
@@ -4556,14 +4657,14 @@
!!this.tabsInCollapsedTabGroups.length;
if (
aTab.visible &&
Expand All @@ -246,6 +246,14 @@ index ce68c339f35416574b7bc7ebf8c93378f653242b..46d25e4381eaae71f3aec1025788684c
!anyRemainingTabsInCollapsedTabGroups
) {
closeWindow =
closeWindowWithLastTab != null
? closeWindowWithLastTab
: !window.toolbar.visible ||
- Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab");
+ Services.prefs.getBoolPref("browser.tabs.closeWindowWithLastTab") && !ZenWorkspaces._isClosingWindow;

if (closeWindow) {
// We've already called beforeunload on all the relevant tabs if we get here,
@@ -5411,10 +5512,10 @@
SessionStore.deleteCustomTabValue(aTab, "hiddenBy");
}
Expand Down
Loading