Skip to content

Commit 54e568d

Browse files
committed
Bug 1862450 - Made installer changes for dual browser extension to MacOS r=mhughes
Depends on D192478 Differential Revision: https://phabricator.services.mozilla.com/D192897
1 parent b87aa19 commit 54e568d

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

browser/app/macbuild/Contents/Info.plist.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,22 @@
232232
<string>file</string>
233233
</array>
234234
</dict>
235+
<dict>
236+
<key>CFBundleURLName</key>
237+
<string>Firefox Protocol</string>
238+
<key>CFBundleURLSchemes</key>
239+
<array>
240+
<string>firefox</string>
241+
</array>
242+
</dict>
243+
<dict>
244+
<key>CFBundleURLName</key>
245+
<string>Firefox Private Browsing Protocol</string>
246+
<key>CFBundleURLSchemes</key>
247+
<array>
248+
<string>firefox-private</string>
249+
</array>
250+
</dict>
235251
</array>
236252
<key>CFBundleVersion</key>
237253
<string>@MAC_BUNDLE_VERSION@</string>

browser/components/BrowserContentHandler.sys.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,14 +543,26 @@ nsBrowserContentHandler.prototype = {
543543
"private-window",
544544
false
545545
);
546-
if (privateWindowParam) {
546+
// Check for Firefox private browsing protocol handler here.
547+
let privateProtocolFound = false;
548+
let urlFlagIdx = cmdLine.findFlag("url", false);
549+
if (urlFlagIdx > -1 && cmdLine.length > 1) {
550+
privateProtocolFound = cmdLine
551+
.getArgument(urlFlagIdx + 1)
552+
.startsWith("firefox-private:");
553+
}
554+
if (privateWindowParam || privateProtocolFound) {
547555
let forcePrivate = true;
548556
let resolvedURI;
549557
if (!lazy.PrivateBrowsingUtils.enabled) {
550558
// Load about:privatebrowsing in a normal tab, which will display an error indicating
551559
// access to private browsing has been disabled.
552560
forcePrivate = false;
553561
resolvedURI = Services.io.newURI("about:privatebrowsing");
562+
} else if (privateProtocolFound) {
563+
// We can safely remove the flag and parameter now.
564+
const privateProtocolURI = cmdLine.handleFlagWithParam("url", false);
565+
resolvedURI = resolveURIInternal(cmdLine, privateProtocolURI);
554566
} else {
555567
resolvedURI = resolveURIInternal(cmdLine, privateWindowParam);
556568
}

0 commit comments

Comments
 (0)