Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Tor Browser
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
The Tor Project
Applications
Tor Browser
Commits
9e05ca8c
Verified
Commit
9e05ca8c
authored
9 months ago
by
henry
Committed by
ma1
2 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Bug 42583: Modify moz-support-link for Base Browser.
parent
942b3f1d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1326
Bug 43383: Rebased legacy onto 115.19.0esr
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
toolkit/content/widgets/moz-support-link/moz-support-link.mjs
+28
-19
28 additions, 19 deletions
...kit/content/widgets/moz-support-link/moz-support-link.mjs
with
28 additions
and
19 deletions
toolkit/content/widgets/moz-support-link/moz-support-link.mjs
+
28
−
19
View file @
9e05ca8c
...
...
@@ -17,7 +17,9 @@ MozXULElement.insertFTLIfNeeded("browser/components/mozSupportLink.ftl");
export
default
class
MozSupportLink
extends
HTMLAnchorElement
{
static
SUPPORT_URL
=
"
https://www.mozilla.org/
"
;
static
get
observedAttributes
()
{
return
[
"
support-page
"
,
"
utm-content
"
];
// We add tor-manual-page for pages hosted at tor project. Also shared with
// base-browser/mullvad-browser. See tor-browser#42583.
return
[
"
support-page
"
,
"
utm-content
"
,
"
tor-manual-page
"
];
}
/**
...
...
@@ -96,12 +98,33 @@ export default class MozSupportLink extends HTMLAnchorElement {
}
attributeChangedCallback
(
attrName
,
oldVal
,
newVal
)
{
if
(
attrName
===
"
support-page
"
||
attrName
===
"
utm-content
"
)
{
if
(
attrName
===
"
support-page
"
||
attrName
===
"
utm-content
"
||
attrName
===
"
tor-manual-page
"
)
{
this
.
#setHref
();
}
}
#setHref
()
{
let
torManualPage
=
this
.
getAttribute
(
"
tor-manual-page
"
);
if
(
torManualPage
)
{
const
[
page
,
anchor
]
=
torManualPage
.
split
(
"
_
"
,
2
);
let
locale
=
Services
.
locale
.
appLocaleAsBCP47
;
if
(
locale
===
"
ja-JP-macos
"
)
{
// Convert quirk-locale to the locale used for tor project.
locale
=
"
ja
"
;
}
let
href
=
`https://tb-manual.torproject.org/
${
locale
}
/
${
page
}
/`
;
if
(
anchor
)
{
href
=
`
${
href
}
#
${
anchor
}
`
;
}
this
.
href
=
href
;
return
;
}
let
supportPage
=
this
.
getAttribute
(
"
support-page
"
)
??
""
;
let
base
=
MozSupportLink
.
SUPPORT_URL
+
supportPage
;
this
.
href
=
this
.
hasAttribute
(
"
utm-content
"
)
...
...
@@ -122,21 +145,7 @@ customElements.define("moz-support-link", MozSupportLink, { extends: "a" });
* Otherwise the url in unmodified form.
*/
export
function
formatUTMParams
(
contentAttribute
,
url
)
{
if
(
!
contentAttribute
)
{
return
url
;
}
let
parsedUrl
=
new
URL
(
url
);
let
domain
=
`.
${
parsedUrl
.
hostname
}
`
;
if
(
!
domain
.
endsWith
(
"
.mozilla.org
"
)
&&
// For testing: addons-dev.allizom.org and addons.allizom.org
!
domain
.
endsWith
(
"
.allizom.org
"
)
)
{
return
url
;
}
parsedUrl
.
searchParams
.
set
(
"
utm_source
"
,
"
firefox-browser
"
);
parsedUrl
.
searchParams
.
set
(
"
utm_medium
"
,
"
firefox-browser
"
);
parsedUrl
.
searchParams
.
set
(
"
utm_content
"
,
contentAttribute
);
return
parsedUrl
.
href
;
// Do not add utm parameters. See tor-browser#42583.
// NOTE: This method is also present in about:addons.
return
url
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment