lists.torproject.org
Sign In Sign Up
Manage this list Sign In Sign Up

Keyboard Shortcuts

Thread View

  • j: Next unread message
  • k: Previous unread message
  • j a: Jump to all threads
  • j l: Jump to MailingList overview

tbb-commits

Thread Start a new thread
Download
Threads by month
  • ----- 2025 -----
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2024 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2023 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2022 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2021 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2020 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2019 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2018 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2017 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2016 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2015 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
  • January
  • ----- 2014 -----
  • December
  • November
  • October
  • September
  • August
  • July
  • June
  • May
  • April
  • March
  • February
tbb-commits@lists.torproject.org

  • 1 participants
  • 18605 discussions
[Git][tpo/applications/tor-browser][base-browser-128.2.0esr-14.0-1] 2 commits: fixup! Firefox preference overrides.
by morgan (@morgan) 18 Sep '24

18 Sep '24
morgan pushed to branch base-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: 1de422d9 by Henry Wilkes at 2024-09-18T18:16:06+00:00 fixup! Firefox preference overrides. Bug 42718: Drop unused browser.tabs.firefox-view preference. - - - - - 9507b27a by Henry Wilkes at 2024-09-18T18:16:06+00:00 fixup! Bug 42037: Disable about:firefoxview page Bug 42718: Always hide the firefox view button. Also, ensure that `FirefoxViewHandler.openTab` returns early rather than throwing. - - - - - 3 changed files: - browser/app/profile/001-base-profile.js - browser/base/content/browser.js - browser/themes/shared/tabbrowser/tabs.css Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -17,9 +17,6 @@ pref("startup.homepage_welcome_url.additional", ""); // Disable Firefox Welcome Dialog pref("browser.aboutwelcome.enabled", false); -// Disable the Firefox View tab (tor-browser#41876) -pref("browser.tabs.firefox-view", false, locked); - #if MOZ_UPDATE_CHANNEL == release // tor-browser#42640: Disable Firefox Flame buttond due to unknown interactions with New Identity pref("browser.privatebrowsing.resetPBM.enabled", false, locked); ===================================== browser/base/content/browser.js ===================================== @@ -8077,6 +8077,11 @@ var FirefoxViewHandler = { } }, openTab(section) { + if (AppConstants.BASE_BROWSER_VERSION) { + // about:firefoxview is disabled. tor-browser#42037. + return; + } + if (!CustomizableUI.getPlacementOfWidget(this.BUTTON_ID)) { CustomizableUI.addWidgetToArea( this.BUTTON_ID, ===================================== browser/themes/shared/tabbrowser/tabs.css ===================================== @@ -747,17 +747,28 @@ /* Firefox View button and menu item */ -:root:not([privatebrowsingmode], [firefoxviewhidden]) :is(toolbarbutton, toolbarpaletteitem) + #tabbrowser-tabs, -:root[privatebrowsingmode]:not([firefoxviewhidden]) :is( +/* about:firefoxview is disabled in Base Browser. See tor-browser#42037. + * Therefore we always hide #firefox-view-button, regardless of private + * browsing. Here we only want to draw the border if there is a non-hidden + * toolbar item before the tabs. + * NOTE: Expect merge conflict from bugzilla bug 1917595 and bug 1917599. In + * these cases we want to keep our selector as-is. */ +:root :is( toolbarbutton:not(#firefox-view-button), toolbarpaletteitem:not(#wrapper-firefox-view-button) -) + #tabbrowser-tabs { +) ~ #tabbrowser-tabs { border-inline-start: 1px solid color-mix(in srgb, currentColor 25%, transparent); padding-inline-start: calc(var(--tab-overflow-pinned-tabs-width) + 2px); margin-inline-start: 2px; } -:root[privatebrowsingmode] :is(#firefox-view-button, #menu_openFirefoxView) { +/* about:firefoxview is disabled in Base Browser. Always hide the toolbar button + * and menu item regardless of private browsing. See tor-browser#42037. + * NOTE: We also hide #wrapper-firefox-view-button, which is used during + * customization. + * NOTE: Expect merge conflict from bugzilla bug 1903812 and bug 1917599. In + * these cases we want to keep our selector as-is. */ +#firefox-view-button, #wrapper-firefox-view-button, #menu_openFirefoxView { display: none; } View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d72c29… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/d72c29… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-128.2.0esr-14.0-1] 2 commits: fixup! Firefox preference overrides.
by morgan (@morgan) 18 Sep '24

18 Sep '24
morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: c28ee632 by Henry Wilkes at 2024-09-18T18:05:17+00:00 fixup! Firefox preference overrides. Bug 42718: Drop unused browser.tabs.firefox-view preference. - - - - - 4869b835 by Henry Wilkes at 2024-09-18T18:05:17+00:00 fixup! Bug 42037: Disable about:firefoxview page Bug 42718: Always hide the firefox view button. Also, ensure that `FirefoxViewHandler.openTab` returns early rather than throwing. - - - - - 3 changed files: - browser/app/profile/001-base-profile.js - browser/base/content/browser.js - browser/themes/shared/tabbrowser/tabs.css Changes: ===================================== browser/app/profile/001-base-profile.js ===================================== @@ -17,9 +17,6 @@ pref("startup.homepage_welcome_url.additional", ""); // Disable Firefox Welcome Dialog pref("browser.aboutwelcome.enabled", false); -// Disable the Firefox View tab (tor-browser#41876) -pref("browser.tabs.firefox-view", false, locked); - #if MOZ_UPDATE_CHANNEL == release // tor-browser#42640: Disable Firefox Flame buttond due to unknown interactions with New Identity pref("browser.privatebrowsing.resetPBM.enabled", false, locked); ===================================== browser/base/content/browser.js ===================================== @@ -8121,6 +8121,11 @@ var FirefoxViewHandler = { } }, openTab(section) { + if (AppConstants.BASE_BROWSER_VERSION) { + // about:firefoxview is disabled. tor-browser#42037. + return; + } + if (!CustomizableUI.getPlacementOfWidget(this.BUTTON_ID)) { CustomizableUI.addWidgetToArea( this.BUTTON_ID, ===================================== browser/themes/shared/tabbrowser/tabs.css ===================================== @@ -747,17 +747,28 @@ /* Firefox View button and menu item */ -:root:not([privatebrowsingmode], [firefoxviewhidden]) :is(toolbarbutton, toolbarpaletteitem) + #tabbrowser-tabs, -:root[privatebrowsingmode]:not([firefoxviewhidden]) :is( +/* about:firefoxview is disabled in Base Browser. See tor-browser#42037. + * Therefore we always hide #firefox-view-button, regardless of private + * browsing. Here we only want to draw the border if there is a non-hidden + * toolbar item before the tabs. + * NOTE: Expect merge conflict from bugzilla bug 1917595 and bug 1917599. In + * these cases we want to keep our selector as-is. */ +:root :is( toolbarbutton:not(#firefox-view-button), toolbarpaletteitem:not(#wrapper-firefox-view-button) -) + #tabbrowser-tabs { +) ~ #tabbrowser-tabs { border-inline-start: 1px solid color-mix(in srgb, currentColor 25%, transparent); padding-inline-start: calc(var(--tab-overflow-pinned-tabs-width) + 2px); margin-inline-start: 2px; } -:root[privatebrowsingmode] :is(#firefox-view-button, #menu_openFirefoxView) { +/* about:firefoxview is disabled in Base Browser. Always hide the toolbar button + * and menu item regardless of private browsing. See tor-browser#42037. + * NOTE: We also hide #wrapper-firefox-view-button, which is used during + * customization. + * NOTE: Expect merge conflict from bugzilla bug 1903812 and bug 1917599. In + * these cases we want to keep our selector as-is. */ +#firefox-view-button, #wrapper-firefox-view-button, #menu_openFirefoxView { display: none; } View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/06801c… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/compare/06801c… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-128.2.0esr-14.0-1] Bug 42220: Allow for more file types to be forced-inline.
by Pier Angelo Vendrame (@pierov) 18 Sep '24

18 Sep '24
Pier Angelo Vendrame pushed to branch mullvad-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Mullvad Browser Commits: a64e84bc by Pier Angelo Vendrame at 2024-09-18T15:37:35+02:00 Bug 42220: Allow for more file types to be forced-inline. Firefox allows to open some files in the browser without any confirmation, but this will result in a disk leak, because the file will be downloaded to the temporary directory first (and not deleted, in some cases). A preference allows PDFs to be opened without being downloaded to disk. So, we introduce a similar one to do the same for all the files that are set to be opened automatically in the browser. - - - - - 2 changed files: - modules/libpref/init/StaticPrefList.yaml - uriloader/base/nsURILoader.cpp Changes: ===================================== modules/libpref/init/StaticPrefList.yaml ===================================== @@ -1446,6 +1446,12 @@ value: false mirror: always +# tor-browser#42220 +- name: browser.download.ignore_content_disposition + type: bool + value: true + mirror: always + # See bug 1811830 - name: browser.download.force_save_internally_handled_attachments type: bool ===================================== uriloader/base/nsURILoader.cpp ===================================== @@ -292,34 +292,42 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { LOG((" forceExternalHandling: %s", forceExternalHandling ? "yes" : "no")); if (forceExternalHandling && - mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline()) { + (mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline() || + mozilla::StaticPrefs::browser_download_ignore_content_disposition())) { // Check if this is a PDF which should be opened internally. We also handle // octet-streams that look like they might be PDFs based on their extension. bool isPDF = mContentType.LowerCaseEqualsASCII(APPLICATION_PDF); - if (!isPDF && - (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || - mContentType.IsEmpty())) { + nsAutoCString ext; + if (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || + mContentType.IsEmpty()) { nsAutoString flname; aChannel->GetContentDispositionFilename(flname); - isPDF = StringEndsWith(flname, u".pdf"_ns); - if (!isPDF) { + if (!flname.IsEmpty()) { + int32_t extStart = flname.RFindChar(u'.'); + if (extStart != kNotFound) { + CopyUTF16toUTF8(Substring(flname, extStart + 1), ext); + } + } + if (ext.IsEmpty() || (!mozilla::StaticPrefs:: + browser_download_ignore_content_disposition() && + !ext.EqualsLiteral("pdf"))) { nsCOMPtr<nsIURI> uri; aChannel->GetURI(getter_AddRefs(uri)); nsCOMPtr<nsIURL> url(do_QueryInterface(uri)); if (url) { - nsAutoCString ext; url->GetFileExtension(ext); - isPDF = ext.EqualsLiteral("pdf"); } } + isPDF = ext.EqualsLiteral("pdf"); } - // For a PDF, check if the preference is set that forces attachments to be - // opened inline. If so, treat it as a non-attachment by clearing - // 'forceExternalHandling' again. This allows it open a PDF directly - // instead of downloading it first. It may still end up being handled by - // a helper app depending anyway on the later checks. - if (isPDF) { + // One of the preferences to forces attachments to be opened inline is set. + // If so, treat it as a non-attachment by clearing 'forceExternalHandling' + // again. This allows it open a file directly instead of downloading it + // first. It may still end up being handled by a helper app depending anyway + // on the later checks. + if (mozilla::StaticPrefs::browser_download_ignore_content_disposition() || + isPDF) { nsCOMPtr<nsILoadInfo> loadInfo; aChannel->GetLoadInfo(getter_AddRefs(loadInfo)); @@ -328,8 +336,13 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { nsCOMPtr<nsIMIMEService> mimeSvc( do_GetService(NS_MIMESERVICE_CONTRACTID)); NS_ENSURE_TRUE(mimeSvc, NS_ERROR_FAILURE); - mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), ""_ns, - getter_AddRefs(mimeInfo)); + if (isPDF) { + mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), + ""_ns, getter_AddRefs(mimeInfo)); + } else { + mimeSvc->GetFromTypeAndExtension(mContentType, ext, + getter_AddRefs(mimeInfo)); + } if (mimeInfo) { int32_t action = nsIMIMEInfo::saveToDisk; View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/a64… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/a64… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-128.2.0esr-14.0-1] Bug 42220: Allow for more file types to be forced-inline.
by Pier Angelo Vendrame (@pierov) 18 Sep '24

18 Sep '24
Pier Angelo Vendrame pushed to branch base-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: d72c2984 by Pier Angelo Vendrame at 2024-09-18T15:36:07+02:00 Bug 42220: Allow for more file types to be forced-inline. Firefox allows to open some files in the browser without any confirmation, but this will result in a disk leak, because the file will be downloaded to the temporary directory first (and not deleted, in some cases). A preference allows PDFs to be opened without being downloaded to disk. So, we introduce a similar one to do the same for all the files that are set to be opened automatically in the browser. - - - - - 2 changed files: - modules/libpref/init/StaticPrefList.yaml - uriloader/base/nsURILoader.cpp Changes: ===================================== modules/libpref/init/StaticPrefList.yaml ===================================== @@ -1446,6 +1446,12 @@ value: false mirror: always +# tor-browser#42220 +- name: browser.download.ignore_content_disposition + type: bool + value: true + mirror: always + # See bug 1811830 - name: browser.download.force_save_internally_handled_attachments type: bool ===================================== uriloader/base/nsURILoader.cpp ===================================== @@ -292,34 +292,42 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { LOG((" forceExternalHandling: %s", forceExternalHandling ? "yes" : "no")); if (forceExternalHandling && - mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline()) { + (mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline() || + mozilla::StaticPrefs::browser_download_ignore_content_disposition())) { // Check if this is a PDF which should be opened internally. We also handle // octet-streams that look like they might be PDFs based on their extension. bool isPDF = mContentType.LowerCaseEqualsASCII(APPLICATION_PDF); - if (!isPDF && - (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || - mContentType.IsEmpty())) { + nsAutoCString ext; + if (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || + mContentType.IsEmpty()) { nsAutoString flname; aChannel->GetContentDispositionFilename(flname); - isPDF = StringEndsWith(flname, u".pdf"_ns); - if (!isPDF) { + if (!flname.IsEmpty()) { + int32_t extStart = flname.RFindChar(u'.'); + if (extStart != kNotFound) { + CopyUTF16toUTF8(Substring(flname, extStart + 1), ext); + } + } + if (ext.IsEmpty() || (!mozilla::StaticPrefs:: + browser_download_ignore_content_disposition() && + !ext.EqualsLiteral("pdf"))) { nsCOMPtr<nsIURI> uri; aChannel->GetURI(getter_AddRefs(uri)); nsCOMPtr<nsIURL> url(do_QueryInterface(uri)); if (url) { - nsAutoCString ext; url->GetFileExtension(ext); - isPDF = ext.EqualsLiteral("pdf"); } } + isPDF = ext.EqualsLiteral("pdf"); } - // For a PDF, check if the preference is set that forces attachments to be - // opened inline. If so, treat it as a non-attachment by clearing - // 'forceExternalHandling' again. This allows it open a PDF directly - // instead of downloading it first. It may still end up being handled by - // a helper app depending anyway on the later checks. - if (isPDF) { + // One of the preferences to forces attachments to be opened inline is set. + // If so, treat it as a non-attachment by clearing 'forceExternalHandling' + // again. This allows it open a file directly instead of downloading it + // first. It may still end up being handled by a helper app depending anyway + // on the later checks. + if (mozilla::StaticPrefs::browser_download_ignore_content_disposition() || + isPDF) { nsCOMPtr<nsILoadInfo> loadInfo; aChannel->GetLoadInfo(getter_AddRefs(loadInfo)); @@ -328,8 +336,13 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { nsCOMPtr<nsIMIMEService> mimeSvc( do_GetService(NS_MIMESERVICE_CONTRACTID)); NS_ENSURE_TRUE(mimeSvc, NS_ERROR_FAILURE); - mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), ""_ns, - getter_AddRefs(mimeInfo)); + if (isPDF) { + mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), + ""_ns, getter_AddRefs(mimeInfo)); + } else { + mimeSvc->GetFromTypeAndExtension(mContentType, ext, + getter_AddRefs(mimeInfo)); + } if (mimeInfo) { int32_t action = nsIMIMEInfo::saveToDisk; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d72c298… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d72c298… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-128.2.0esr-14.0-1] Bug 42220: Allow for more file types to be forced-inline.
by Pier Angelo Vendrame (@pierov) 18 Sep '24

18 Sep '24
Pier Angelo Vendrame pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: 06801c8d by Pier Angelo Vendrame at 2024-09-18T15:21:28+02:00 Bug 42220: Allow for more file types to be forced-inline. Firefox allows to open some files in the browser without any confirmation, but this will result in a disk leak, because the file will be downloaded to the temporary directory first (and not deleted, in some cases). A preference allows PDFs to be opened without being downloaded to disk. So, we introduce a similar one to do the same for all the files that are set to be opened automatically in the browser. - - - - - 2 changed files: - modules/libpref/init/StaticPrefList.yaml - uriloader/base/nsURILoader.cpp Changes: ===================================== modules/libpref/init/StaticPrefList.yaml ===================================== @@ -1446,6 +1446,12 @@ value: false mirror: always +# tor-browser#42220 +- name: browser.download.ignore_content_disposition + type: bool + value: true + mirror: always + # See bug 1811830 - name: browser.download.force_save_internally_handled_attachments type: bool ===================================== uriloader/base/nsURILoader.cpp ===================================== @@ -292,34 +292,42 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { LOG((" forceExternalHandling: %s", forceExternalHandling ? "yes" : "no")); if (forceExternalHandling && - mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline()) { + (mozilla::StaticPrefs::browser_download_open_pdf_attachments_inline() || + mozilla::StaticPrefs::browser_download_ignore_content_disposition())) { // Check if this is a PDF which should be opened internally. We also handle // octet-streams that look like they might be PDFs based on their extension. bool isPDF = mContentType.LowerCaseEqualsASCII(APPLICATION_PDF); - if (!isPDF && - (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || - mContentType.IsEmpty())) { + nsAutoCString ext; + if (mContentType.LowerCaseEqualsASCII(APPLICATION_OCTET_STREAM) || + mContentType.IsEmpty()) { nsAutoString flname; aChannel->GetContentDispositionFilename(flname); - isPDF = StringEndsWith(flname, u".pdf"_ns); - if (!isPDF) { + if (!flname.IsEmpty()) { + int32_t extStart = flname.RFindChar(u'.'); + if (extStart != kNotFound) { + CopyUTF16toUTF8(Substring(flname, extStart + 1), ext); + } + } + if (ext.IsEmpty() || (!mozilla::StaticPrefs:: + browser_download_ignore_content_disposition() && + !ext.EqualsLiteral("pdf"))) { nsCOMPtr<nsIURI> uri; aChannel->GetURI(getter_AddRefs(uri)); nsCOMPtr<nsIURL> url(do_QueryInterface(uri)); if (url) { - nsAutoCString ext; url->GetFileExtension(ext); - isPDF = ext.EqualsLiteral("pdf"); } } + isPDF = ext.EqualsLiteral("pdf"); } - // For a PDF, check if the preference is set that forces attachments to be - // opened inline. If so, treat it as a non-attachment by clearing - // 'forceExternalHandling' again. This allows it open a PDF directly - // instead of downloading it first. It may still end up being handled by - // a helper app depending anyway on the later checks. - if (isPDF) { + // One of the preferences to forces attachments to be opened inline is set. + // If so, treat it as a non-attachment by clearing 'forceExternalHandling' + // again. This allows it open a file directly instead of downloading it + // first. It may still end up being handled by a helper app depending anyway + // on the later checks. + if (mozilla::StaticPrefs::browser_download_ignore_content_disposition() || + isPDF) { nsCOMPtr<nsILoadInfo> loadInfo; aChannel->GetLoadInfo(getter_AddRefs(loadInfo)); @@ -328,8 +336,13 @@ nsresult nsDocumentOpenInfo::DispatchContent(nsIRequest* request) { nsCOMPtr<nsIMIMEService> mimeSvc( do_GetService(NS_MIMESERVICE_CONTRACTID)); NS_ENSURE_TRUE(mimeSvc, NS_ERROR_FAILURE); - mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), ""_ns, - getter_AddRefs(mimeInfo)); + if (isPDF) { + mimeSvc->GetFromTypeAndExtension(nsLiteralCString(APPLICATION_PDF), + ""_ns, getter_AddRefs(mimeInfo)); + } else { + mimeSvc->GetFromTypeAndExtension(mContentType, ext, + getter_AddRefs(mimeInfo)); + } if (mimeInfo) { int32_t action = nsIMIMEInfo::saveToDisk; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/06801c8… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/06801c8… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/mullvad-browser][mullvad-browser-128.2.0esr-14.0-1] Bug 1436462 - Use "Open in new private window" for bookmarks when in PBM. r=places-reviewers, mak
by morgan (@morgan) 17 Sep '24

17 Sep '24
morgan pushed to branch mullvad-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Mullvad Browser Commits: ffc25ae2 by Henry Wilkes at 2024-09-17T18:40:23+00:00 Bug 1436462 - Use &quot;Open in new private window&quot; for bookmarks when in PBM. r=places-reviewers,mak This makes the bookmark menu consistent with the &quot;File&quot; and context menu when using private browsing mode. We also share the same hide item logic for these &quot;open&quot; items in one place in PlacesUIUtils so that they can be shared between the two consumers (regular bookmarks and managed bookmarks). This ensures that the &quot;Open in container&quot; item if hidden for managed bookmarks in a private window. Differential Revision: https://phabricator.services.mozilla.com/D220120 - - - - - 5 changed files: - browser/components/places/PlacesUIUtils.sys.mjs - browser/components/places/content/controller.js - browser/components/places/content/placesContextMenu.inc.xhtml - browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js - browser/components/places/tests/browser/head.js Changes: ===================================== browser/components/places/PlacesUIUtils.sys.mjs ===================================== @@ -1514,6 +1514,40 @@ export var PlacesUIUtils = { } }, + /** + * Determines whether the given "placesContext" menu item would open a link + * under some special conditions, but those special conditions cannot be met. + * + * @param {Element} item The menu or menu item to decide for. + * + * @returns {boolean} Whether the item is an "open" item that should be + * hidden. + */ + shouldHideOpenMenuItem(item) { + if ( + item.hasAttribute("hide-if-disabled-private-browsing") && + !lazy.PrivateBrowsingUtils.enabled + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-private-browsing") && + lazy.PrivateBrowsingUtils.isWindowPrivate(item.ownerGlobal) + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-usercontext-disabled") && + !Services.prefs.getBoolPref("privacy.userContext.enabled", false) + ) { + return true; + } + + return false; + }, + async managedPlacesContextShowing(event) { let menupopup = event.target; let document = menupopup.ownerDocument; @@ -1528,12 +1562,6 @@ export var PlacesUIUtils = { menupopup.triggerNode.menupopup ); } - let linkItems = [ - "placesContext_open:newtab", - "placesContext_open:newwindow", - "placesContext_openSeparator", - "placesContext_copy", - ]; // Hide everything. We'll unhide the things we need. Array.from(menupopup.children).forEach(function (child) { child.hidden = true; @@ -1555,12 +1583,18 @@ export var PlacesUIUtils = { openContainerInTabs_menuitem.disabled = !openContainerInTabs; openContainerInTabs_menuitem.hidden = false; } else { - linkItems.forEach(id => (document.getElementById(id).hidden = false)); - document.getElementById("placesContext_open:newprivatewindow").hidden = - lazy.PrivateBrowsingUtils.isWindowPrivate(window) || - !lazy.PrivateBrowsingUtils.enabled; - document.getElementById("placesContext_open:newcontainertab").hidden = - !Services.prefs.getBoolPref("privacy.userContext.enabled", false); + for (let id of [ + "placesContext_open:newtab", + "placesContext_open:newcontainertab", + "placesContext_open:newwindow", + "placesContext_open:newprivatewindow", + ]) { + let item = document.getElementById(id); + item.hidden = this.shouldHideOpenMenuItem(item); + } + for (let id of ["placesContext_openSeparator", "placesContext_copy"]) { + document.getElementById(id).hidden = false; + } } event.target.ownerGlobal.updateCommands("places"); ===================================== browser/components/places/content/controller.js ===================================== @@ -465,17 +465,7 @@ PlacesController.prototype = { * and the item can be displayed, false otherwise. */ _shouldShowMenuItem(aMenuItem, aMetaData) { - if ( - aMenuItem.hasAttribute("hide-if-private-browsing") && - !PrivateBrowsingUtils.enabled - ) { - return false; - } - - if ( - aMenuItem.hasAttribute("hide-if-usercontext-disabled") && - !Services.prefs.getBoolPref("privacy.userContext.enabled", false) - ) { + if (PlacesUIUtils.shouldHideOpenMenuItem(aMenuItem)) { return false; } @@ -566,8 +556,12 @@ PlacesController.prototype = { * menuitem when there's no insertion point. An insertion point represents * a point in the view where a new item can be inserted. * 9) The boolean `hide-if-private-browsing` attribute may be set to hide a - * menuitem in private browsing mode - * 10) The boolean `hide-if-single-click-opens` attribute may be set to hide a + * menuitem in private browsing mode. + * 10) The boolean `hide-if-disabled-private-browsing` attribute may be set to + * hide a menuitem if private browsing is not enabled. + * 11) The boolean `hide-if-usercontext-disabled` attribute may be set to + * hide a menuitem if containers are disabled. + * 12) The boolean `hide-if-single-click-opens` attribute may be set to hide a * menuitem in views opening entries with a single click. * * @param {object} aPopup @@ -593,9 +587,6 @@ PlacesController.prototype = { item.getAttribute("hide-if-no-insertion-point") == "true" && noIp && !(ip && ip.isTag && item.id == "placesContext_paste"); - let hideIfPrivate = - item.getAttribute("hide-if-private-browsing") == "true" && - PrivateBrowsingUtils.isWindowPrivate(window); // Hide `Open` if the primary action on click is opening. let hideIfSingleClickOpens = item.getAttribute("hide-if-single-click-opens") == "true" && @@ -610,7 +601,6 @@ PlacesController.prototype = { let shouldHideItem = hideIfNoIP || - hideIfPrivate || hideIfSingleClickOpens || hideIfNotSearch || !this._shouldShowMenuItem(item, metadata); ===================================== browser/components/places/content/placesContextMenu.inc.xhtml ===================================== @@ -52,13 +52,14 @@ command="placesCmd_open:window" data-l10n-id="places-open-in-window" selection-type="single" - node-type="link"/> + node-type="link" + hide-if-private-browsing="true"/> <menuitem id="placesContext_open:newprivatewindow" command="placesCmd_open:privatewindow" data-l10n-id="places-open-in-private-window" selection-type="single" node-type="link" - hide-if-private-browsing="true"/> + hide-if-disabled-private-browsing="true"/> <menuitem id="placesContext_showInFolder" data-l10n-id="places-show-in-folder" command="placesCmd_showInFolder" ===================================== browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js ===================================== @@ -814,3 +814,118 @@ add_task(async function test_library_noselection_contextmenu_contents() { ); }); }); + +add_task(async function test_private_browsing_window() { + // Test the context menu when in a private browsing window. + + let win = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + }); + + let optionItems = [ + "placesContext_open:newtab", + // Hidden in private window "placesContext_open:newcontainertab" + // Hidden in private window "placesContext_open:newwindow" + "placesContext_open:newprivatewindow", + "placesContext_show_bookmark:info", + "placesContext_deleteBookmark", + "placesContext_cut", + "placesContext_copy", + "placesContext_paste_group", + "placesContext_new:bookmark", + "placesContext_new:folder", + "placesContext_new:separator", + ]; + + // Test toolbar. + await checkContextMenu( + async function () { + let toolbarBookmark = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.toolbarGuid, + title: "Bookmark Title", + url: TEST_URL, + }); + + let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid, win); + + let contextMenu = win.document.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + + EventUtils.synthesizeMouseAtCenter( + toolbarNode, + { button: 2, type: "contextmenu" }, + win + ); + await popupShownPromise; + return contextMenu; + }, + [ + ...optionItems, + "placesContext_showAllBookmarks", + "toggle_PersonalToolbar", + "show-other-bookmarks_PersonalToolbar", + ], + win.document + ); + + // Test side bar. + await withSidebarTree( + "bookmarks", + async tree => { + await checkContextMenu( + async bookmark => { + tree.selectItems([bookmark.guid]); + + let contextMenu = + win.SidebarController.browser.contentDocument.getElementById( + "placesContext" + ); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + synthesizeClickOnSelectedTreeCell(tree, { type: "contextmenu" }, win); + await popupShownPromise; + return contextMenu; + }, + optionItems, + win.SidebarController.browser.contentDocument + ); + }, + win + ); + + // Test library window opened when using private browsing window. + optionItems.splice( + optionItems.indexOf("placesContext_show_bookmark:info"), + 1 + ); + optionItems.splice(0, 0, "placesContext_open"); + + await withLibraryWindow( + "BookmarksToolbar", + async ({ right }) => { + await checkContextMenu( + async bookmark => { + let contextMenu = right.ownerDocument.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + right.selectItems([bookmark.guid]); + synthesizeClickOnSelectedTreeCell(right, { type: "contextmenu" }); + await popupShownPromise; + return contextMenu; + }, + optionItems, + right.ownerDocument + ); + }, + win + ); + + await BrowserTestUtils.closeWindow(win); +}); ===================================== browser/components/places/tests/browser/head.js ===================================== @@ -6,8 +6,8 @@ ChromeUtils.defineLazyGetter(this, "gFluentStrings", function () { return new Localization(["branding/brand.ftl", "browser/browser.ftl"], true); }); -function openLibrary(callback, aLeftPaneRoot) { - let library = window.openDialog( +function openLibrary(callback, aLeftPaneRoot, win = window) { + let library = win.openDialog( "chrome://browser/content/places/places.xhtml", "", "chrome,toolbar=yes,dialog=no,resizable", @@ -27,10 +27,12 @@ function openLibrary(callback, aLeftPaneRoot) { * * @param {object} aLeftPaneRoot * Hierarchy to open and select in the left pane. + * @param {Window} [win] + * The window to use to open the library. * @returns {Promise} * Resolves to the handle to the library window. */ -function promiseLibrary(aLeftPaneRoot) { +function promiseLibrary(aLeftPaneRoot, win = window) { return new Promise(resolve => { let library = Services.wm.getMostRecentWindow("Places:Organizer"); if (library && !library.closed) { @@ -42,7 +44,7 @@ function promiseLibrary(aLeftPaneRoot) { checkLibraryPaneVisibility(library, aLeftPaneRoot); resolve(library); } else { - openLibrary(resolve, aLeftPaneRoot); + openLibrary(resolve, aLeftPaneRoot, win); } }); } @@ -380,9 +382,11 @@ function fillBookmarkTextField(id, text, win, blur = true) { * @param {Function} taskFn * The task to execute once the sidebar is ready. Will get the Places * tree view as input. + * @param {Window} [win] + * The window to open the sidebar in, else uses the default window. */ -var withSidebarTree = async function (type, taskFn) { - let sidebar = document.getElementById("sidebar"); +var withSidebarTree = async function (type, taskFn, win = window) { + let sidebar = win.document.getElementById("sidebar"); info("withSidebarTree: waiting sidebar load"); let sidebarLoadedPromise = new Promise(resolve => { sidebar.addEventListener( @@ -395,7 +399,7 @@ var withSidebarTree = async function (type, taskFn) { }); let sidebarId = type == "bookmarks" ? "viewBookmarksSidebar" : "viewHistorySidebar"; - SidebarController.show(sidebarId); + win.SidebarController.show(sidebarId); await sidebarLoadedPromise; let treeId = type == "bookmarks" ? "bookmarks-view" : "historyTree"; @@ -406,7 +410,7 @@ var withSidebarTree = async function (type, taskFn) { try { await taskFn(tree); } finally { - SidebarController.hide(); + win.SidebarController.hide(); } }; @@ -419,9 +423,11 @@ var withSidebarTree = async function (type, taskFn) { * @param {Function} taskFn * The task to execute once the Library is ready. * Will get { left, right } trees as argument. + * @param {Window} [win] + * The window to use to open the library. */ -var withLibraryWindow = async function (hierarchy, taskFn) { - let library = await promiseLibrary(hierarchy); +var withLibraryWindow = async function (hierarchy, taskFn, win = window) { + let library = await promiseLibrary(hierarchy, win); let left = library.document.getElementById("placesList"); let right = library.document.getElementById("placeContent"); info("withLibrary: executing the task"); @@ -477,8 +483,8 @@ function promisePopupHidden(popup) { } // Identify a bookmark node in the Bookmarks Toolbar by its guid. -function getToolbarNodeForItemGuid(itemGuid) { - let children = document.getElementById("PlacesToolbarItems").childNodes; +function getToolbarNodeForItemGuid(itemGuid, win = window) { + let children = win.document.getElementById("PlacesToolbarItems").childNodes; for (let child of children) { if (itemGuid === child._placesNode.bookmarkGuid) { return child; View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/ffc… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/ffc… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][base-browser-128.2.0esr-14.0-1] Bug 1436462 - Use "Open in new private window" for bookmarks when in PBM. r=places-reviewers, mak
by morgan (@morgan) 17 Sep '24

17 Sep '24
morgan pushed to branch base-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: 9cd3c30f by Henry Wilkes at 2024-09-17T18:39:47+00:00 Bug 1436462 - Use &quot;Open in new private window&quot; for bookmarks when in PBM. r=places-reviewers,mak This makes the bookmark menu consistent with the &quot;File&quot; and context menu when using private browsing mode. We also share the same hide item logic for these &quot;open&quot; items in one place in PlacesUIUtils so that they can be shared between the two consumers (regular bookmarks and managed bookmarks). This ensures that the &quot;Open in container&quot; item if hidden for managed bookmarks in a private window. Differential Revision: https://phabricator.services.mozilla.com/D220120 - - - - - 5 changed files: - browser/components/places/PlacesUIUtils.sys.mjs - browser/components/places/content/controller.js - browser/components/places/content/placesContextMenu.inc.xhtml - browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js - browser/components/places/tests/browser/head.js Changes: ===================================== browser/components/places/PlacesUIUtils.sys.mjs ===================================== @@ -1514,6 +1514,40 @@ export var PlacesUIUtils = { } }, + /** + * Determines whether the given "placesContext" menu item would open a link + * under some special conditions, but those special conditions cannot be met. + * + * @param {Element} item The menu or menu item to decide for. + * + * @returns {boolean} Whether the item is an "open" item that should be + * hidden. + */ + shouldHideOpenMenuItem(item) { + if ( + item.hasAttribute("hide-if-disabled-private-browsing") && + !lazy.PrivateBrowsingUtils.enabled + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-private-browsing") && + lazy.PrivateBrowsingUtils.isWindowPrivate(item.ownerGlobal) + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-usercontext-disabled") && + !Services.prefs.getBoolPref("privacy.userContext.enabled", false) + ) { + return true; + } + + return false; + }, + async managedPlacesContextShowing(event) { let menupopup = event.target; let document = menupopup.ownerDocument; @@ -1528,12 +1562,6 @@ export var PlacesUIUtils = { menupopup.triggerNode.menupopup ); } - let linkItems = [ - "placesContext_open:newtab", - "placesContext_open:newwindow", - "placesContext_openSeparator", - "placesContext_copy", - ]; // Hide everything. We'll unhide the things we need. Array.from(menupopup.children).forEach(function (child) { child.hidden = true; @@ -1555,12 +1583,18 @@ export var PlacesUIUtils = { openContainerInTabs_menuitem.disabled = !openContainerInTabs; openContainerInTabs_menuitem.hidden = false; } else { - linkItems.forEach(id => (document.getElementById(id).hidden = false)); - document.getElementById("placesContext_open:newprivatewindow").hidden = - lazy.PrivateBrowsingUtils.isWindowPrivate(window) || - !lazy.PrivateBrowsingUtils.enabled; - document.getElementById("placesContext_open:newcontainertab").hidden = - !Services.prefs.getBoolPref("privacy.userContext.enabled", false); + for (let id of [ + "placesContext_open:newtab", + "placesContext_open:newcontainertab", + "placesContext_open:newwindow", + "placesContext_open:newprivatewindow", + ]) { + let item = document.getElementById(id); + item.hidden = this.shouldHideOpenMenuItem(item); + } + for (let id of ["placesContext_openSeparator", "placesContext_copy"]) { + document.getElementById(id).hidden = false; + } } event.target.ownerGlobal.updateCommands("places"); ===================================== browser/components/places/content/controller.js ===================================== @@ -465,17 +465,7 @@ PlacesController.prototype = { * and the item can be displayed, false otherwise. */ _shouldShowMenuItem(aMenuItem, aMetaData) { - if ( - aMenuItem.hasAttribute("hide-if-private-browsing") && - !PrivateBrowsingUtils.enabled - ) { - return false; - } - - if ( - aMenuItem.hasAttribute("hide-if-usercontext-disabled") && - !Services.prefs.getBoolPref("privacy.userContext.enabled", false) - ) { + if (PlacesUIUtils.shouldHideOpenMenuItem(aMenuItem)) { return false; } @@ -566,8 +556,12 @@ PlacesController.prototype = { * menuitem when there's no insertion point. An insertion point represents * a point in the view where a new item can be inserted. * 9) The boolean `hide-if-private-browsing` attribute may be set to hide a - * menuitem in private browsing mode - * 10) The boolean `hide-if-single-click-opens` attribute may be set to hide a + * menuitem in private browsing mode. + * 10) The boolean `hide-if-disabled-private-browsing` attribute may be set to + * hide a menuitem if private browsing is not enabled. + * 11) The boolean `hide-if-usercontext-disabled` attribute may be set to + * hide a menuitem if containers are disabled. + * 12) The boolean `hide-if-single-click-opens` attribute may be set to hide a * menuitem in views opening entries with a single click. * * @param {object} aPopup @@ -593,9 +587,6 @@ PlacesController.prototype = { item.getAttribute("hide-if-no-insertion-point") == "true" && noIp && !(ip && ip.isTag && item.id == "placesContext_paste"); - let hideIfPrivate = - item.getAttribute("hide-if-private-browsing") == "true" && - PrivateBrowsingUtils.isWindowPrivate(window); // Hide `Open` if the primary action on click is opening. let hideIfSingleClickOpens = item.getAttribute("hide-if-single-click-opens") == "true" && @@ -610,7 +601,6 @@ PlacesController.prototype = { let shouldHideItem = hideIfNoIP || - hideIfPrivate || hideIfSingleClickOpens || hideIfNotSearch || !this._shouldShowMenuItem(item, metadata); ===================================== browser/components/places/content/placesContextMenu.inc.xhtml ===================================== @@ -52,13 +52,14 @@ command="placesCmd_open:window" data-l10n-id="places-open-in-window" selection-type="single" - node-type="link"/> + node-type="link" + hide-if-private-browsing="true"/> <menuitem id="placesContext_open:newprivatewindow" command="placesCmd_open:privatewindow" data-l10n-id="places-open-in-private-window" selection-type="single" node-type="link" - hide-if-private-browsing="true"/> + hide-if-disabled-private-browsing="true"/> <menuitem id="placesContext_showInFolder" data-l10n-id="places-show-in-folder" command="placesCmd_showInFolder" ===================================== browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js ===================================== @@ -814,3 +814,118 @@ add_task(async function test_library_noselection_contextmenu_contents() { ); }); }); + +add_task(async function test_private_browsing_window() { + // Test the context menu when in a private browsing window. + + let win = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + }); + + let optionItems = [ + "placesContext_open:newtab", + // Hidden in private window "placesContext_open:newcontainertab" + // Hidden in private window "placesContext_open:newwindow" + "placesContext_open:newprivatewindow", + "placesContext_show_bookmark:info", + "placesContext_deleteBookmark", + "placesContext_cut", + "placesContext_copy", + "placesContext_paste_group", + "placesContext_new:bookmark", + "placesContext_new:folder", + "placesContext_new:separator", + ]; + + // Test toolbar. + await checkContextMenu( + async function () { + let toolbarBookmark = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.toolbarGuid, + title: "Bookmark Title", + url: TEST_URL, + }); + + let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid, win); + + let contextMenu = win.document.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + + EventUtils.synthesizeMouseAtCenter( + toolbarNode, + { button: 2, type: "contextmenu" }, + win + ); + await popupShownPromise; + return contextMenu; + }, + [ + ...optionItems, + "placesContext_showAllBookmarks", + "toggle_PersonalToolbar", + "show-other-bookmarks_PersonalToolbar", + ], + win.document + ); + + // Test side bar. + await withSidebarTree( + "bookmarks", + async tree => { + await checkContextMenu( + async bookmark => { + tree.selectItems([bookmark.guid]); + + let contextMenu = + win.SidebarController.browser.contentDocument.getElementById( + "placesContext" + ); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + synthesizeClickOnSelectedTreeCell(tree, { type: "contextmenu" }, win); + await popupShownPromise; + return contextMenu; + }, + optionItems, + win.SidebarController.browser.contentDocument + ); + }, + win + ); + + // Test library window opened when using private browsing window. + optionItems.splice( + optionItems.indexOf("placesContext_show_bookmark:info"), + 1 + ); + optionItems.splice(0, 0, "placesContext_open"); + + await withLibraryWindow( + "BookmarksToolbar", + async ({ right }) => { + await checkContextMenu( + async bookmark => { + let contextMenu = right.ownerDocument.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + right.selectItems([bookmark.guid]); + synthesizeClickOnSelectedTreeCell(right, { type: "contextmenu" }); + await popupShownPromise; + return contextMenu; + }, + optionItems, + right.ownerDocument + ); + }, + win + ); + + await BrowserTestUtils.closeWindow(win); +}); ===================================== browser/components/places/tests/browser/head.js ===================================== @@ -6,8 +6,8 @@ ChromeUtils.defineLazyGetter(this, "gFluentStrings", function () { return new Localization(["branding/brand.ftl", "browser/browser.ftl"], true); }); -function openLibrary(callback, aLeftPaneRoot) { - let library = window.openDialog( +function openLibrary(callback, aLeftPaneRoot, win = window) { + let library = win.openDialog( "chrome://browser/content/places/places.xhtml", "", "chrome,toolbar=yes,dialog=no,resizable", @@ -27,10 +27,12 @@ function openLibrary(callback, aLeftPaneRoot) { * * @param {object} aLeftPaneRoot * Hierarchy to open and select in the left pane. + * @param {Window} [win] + * The window to use to open the library. * @returns {Promise} * Resolves to the handle to the library window. */ -function promiseLibrary(aLeftPaneRoot) { +function promiseLibrary(aLeftPaneRoot, win = window) { return new Promise(resolve => { let library = Services.wm.getMostRecentWindow("Places:Organizer"); if (library && !library.closed) { @@ -42,7 +44,7 @@ function promiseLibrary(aLeftPaneRoot) { checkLibraryPaneVisibility(library, aLeftPaneRoot); resolve(library); } else { - openLibrary(resolve, aLeftPaneRoot); + openLibrary(resolve, aLeftPaneRoot, win); } }); } @@ -380,9 +382,11 @@ function fillBookmarkTextField(id, text, win, blur = true) { * @param {Function} taskFn * The task to execute once the sidebar is ready. Will get the Places * tree view as input. + * @param {Window} [win] + * The window to open the sidebar in, else uses the default window. */ -var withSidebarTree = async function (type, taskFn) { - let sidebar = document.getElementById("sidebar"); +var withSidebarTree = async function (type, taskFn, win = window) { + let sidebar = win.document.getElementById("sidebar"); info("withSidebarTree: waiting sidebar load"); let sidebarLoadedPromise = new Promise(resolve => { sidebar.addEventListener( @@ -395,7 +399,7 @@ var withSidebarTree = async function (type, taskFn) { }); let sidebarId = type == "bookmarks" ? "viewBookmarksSidebar" : "viewHistorySidebar"; - SidebarController.show(sidebarId); + win.SidebarController.show(sidebarId); await sidebarLoadedPromise; let treeId = type == "bookmarks" ? "bookmarks-view" : "historyTree"; @@ -406,7 +410,7 @@ var withSidebarTree = async function (type, taskFn) { try { await taskFn(tree); } finally { - SidebarController.hide(); + win.SidebarController.hide(); } }; @@ -419,9 +423,11 @@ var withSidebarTree = async function (type, taskFn) { * @param {Function} taskFn * The task to execute once the Library is ready. * Will get { left, right } trees as argument. + * @param {Window} [win] + * The window to use to open the library. */ -var withLibraryWindow = async function (hierarchy, taskFn) { - let library = await promiseLibrary(hierarchy); +var withLibraryWindow = async function (hierarchy, taskFn, win = window) { + let library = await promiseLibrary(hierarchy, win); let left = library.document.getElementById("placesList"); let right = library.document.getElementById("placeContent"); info("withLibrary: executing the task"); @@ -477,8 +483,8 @@ function promisePopupHidden(popup) { } // Identify a bookmark node in the Bookmarks Toolbar by its guid. -function getToolbarNodeForItemGuid(itemGuid) { - let children = document.getElementById("PlacesToolbarItems").childNodes; +function getToolbarNodeForItemGuid(itemGuid, win = window) { + let children = win.document.getElementById("PlacesToolbarItems").childNodes; for (let child of children) { if (itemGuid === child._placesNode.bookmarkGuid) { return child; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/9cd3c30… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/9cd3c30… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser][tor-browser-128.2.0esr-14.0-1] Bug 1436462 - Use "Open in new private window" for bookmarks when in PBM. r=places-reviewers, mak
by morgan (@morgan) 17 Sep '24

17 Sep '24
morgan pushed to branch tor-browser-128.2.0esr-14.0-1 at The Tor Project / Applications / Tor Browser Commits: 1d54c76d by Henry Wilkes at 2024-09-16T21:45:38+00:00 Bug 1436462 - Use &quot;Open in new private window&quot; for bookmarks when in PBM. r=places-reviewers,mak This makes the bookmark menu consistent with the &quot;File&quot; and context menu when using private browsing mode. We also share the same hide item logic for these &quot;open&quot; items in one place in PlacesUIUtils so that they can be shared between the two consumers (regular bookmarks and managed bookmarks). This ensures that the &quot;Open in container&quot; item if hidden for managed bookmarks in a private window. Differential Revision: https://phabricator.services.mozilla.com/D220120 - - - - - 5 changed files: - browser/components/places/PlacesUIUtils.sys.mjs - browser/components/places/content/controller.js - browser/components/places/content/placesContextMenu.inc.xhtml - browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js - browser/components/places/tests/browser/head.js Changes: ===================================== browser/components/places/PlacesUIUtils.sys.mjs ===================================== @@ -1514,6 +1514,40 @@ export var PlacesUIUtils = { } }, + /** + * Determines whether the given "placesContext" menu item would open a link + * under some special conditions, but those special conditions cannot be met. + * + * @param {Element} item The menu or menu item to decide for. + * + * @returns {boolean} Whether the item is an "open" item that should be + * hidden. + */ + shouldHideOpenMenuItem(item) { + if ( + item.hasAttribute("hide-if-disabled-private-browsing") && + !lazy.PrivateBrowsingUtils.enabled + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-private-browsing") && + lazy.PrivateBrowsingUtils.isWindowPrivate(item.ownerGlobal) + ) { + return true; + } + + if ( + item.hasAttribute("hide-if-usercontext-disabled") && + !Services.prefs.getBoolPref("privacy.userContext.enabled", false) + ) { + return true; + } + + return false; + }, + async managedPlacesContextShowing(event) { let menupopup = event.target; let document = menupopup.ownerDocument; @@ -1528,12 +1562,6 @@ export var PlacesUIUtils = { menupopup.triggerNode.menupopup ); } - let linkItems = [ - "placesContext_open:newtab", - "placesContext_open:newwindow", - "placesContext_openSeparator", - "placesContext_copy", - ]; // Hide everything. We'll unhide the things we need. Array.from(menupopup.children).forEach(function (child) { child.hidden = true; @@ -1555,12 +1583,18 @@ export var PlacesUIUtils = { openContainerInTabs_menuitem.disabled = !openContainerInTabs; openContainerInTabs_menuitem.hidden = false; } else { - linkItems.forEach(id => (document.getElementById(id).hidden = false)); - document.getElementById("placesContext_open:newprivatewindow").hidden = - lazy.PrivateBrowsingUtils.isWindowPrivate(window) || - !lazy.PrivateBrowsingUtils.enabled; - document.getElementById("placesContext_open:newcontainertab").hidden = - !Services.prefs.getBoolPref("privacy.userContext.enabled", false); + for (let id of [ + "placesContext_open:newtab", + "placesContext_open:newcontainertab", + "placesContext_open:newwindow", + "placesContext_open:newprivatewindow", + ]) { + let item = document.getElementById(id); + item.hidden = this.shouldHideOpenMenuItem(item); + } + for (let id of ["placesContext_openSeparator", "placesContext_copy"]) { + document.getElementById(id).hidden = false; + } } event.target.ownerGlobal.updateCommands("places"); ===================================== browser/components/places/content/controller.js ===================================== @@ -465,17 +465,7 @@ PlacesController.prototype = { * and the item can be displayed, false otherwise. */ _shouldShowMenuItem(aMenuItem, aMetaData) { - if ( - aMenuItem.hasAttribute("hide-if-private-browsing") && - !PrivateBrowsingUtils.enabled - ) { - return false; - } - - if ( - aMenuItem.hasAttribute("hide-if-usercontext-disabled") && - !Services.prefs.getBoolPref("privacy.userContext.enabled", false) - ) { + if (PlacesUIUtils.shouldHideOpenMenuItem(aMenuItem)) { return false; } @@ -566,8 +556,12 @@ PlacesController.prototype = { * menuitem when there's no insertion point. An insertion point represents * a point in the view where a new item can be inserted. * 9) The boolean `hide-if-private-browsing` attribute may be set to hide a - * menuitem in private browsing mode - * 10) The boolean `hide-if-single-click-opens` attribute may be set to hide a + * menuitem in private browsing mode. + * 10) The boolean `hide-if-disabled-private-browsing` attribute may be set to + * hide a menuitem if private browsing is not enabled. + * 11) The boolean `hide-if-usercontext-disabled` attribute may be set to + * hide a menuitem if containers are disabled. + * 12) The boolean `hide-if-single-click-opens` attribute may be set to hide a * menuitem in views opening entries with a single click. * * @param {object} aPopup @@ -593,9 +587,6 @@ PlacesController.prototype = { item.getAttribute("hide-if-no-insertion-point") == "true" && noIp && !(ip && ip.isTag && item.id == "placesContext_paste"); - let hideIfPrivate = - item.getAttribute("hide-if-private-browsing") == "true" && - PrivateBrowsingUtils.isWindowPrivate(window); // Hide `Open` if the primary action on click is opening. let hideIfSingleClickOpens = item.getAttribute("hide-if-single-click-opens") == "true" && @@ -610,7 +601,6 @@ PlacesController.prototype = { let shouldHideItem = hideIfNoIP || - hideIfPrivate || hideIfSingleClickOpens || hideIfNotSearch || !this._shouldShowMenuItem(item, metadata); ===================================== browser/components/places/content/placesContextMenu.inc.xhtml ===================================== @@ -52,13 +52,14 @@ command="placesCmd_open:window" data-l10n-id="places-open-in-window" selection-type="single" - node-type="link"/> + node-type="link" + hide-if-private-browsing="true"/> <menuitem id="placesContext_open:newprivatewindow" command="placesCmd_open:privatewindow" data-l10n-id="places-open-in-private-window" selection-type="single" node-type="link" - hide-if-private-browsing="true"/> + hide-if-disabled-private-browsing="true"/> <menuitem id="placesContext_showInFolder" data-l10n-id="places-show-in-folder" command="placesCmd_showInFolder" ===================================== browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js ===================================== @@ -814,3 +814,118 @@ add_task(async function test_library_noselection_contextmenu_contents() { ); }); }); + +add_task(async function test_private_browsing_window() { + // Test the context menu when in a private browsing window. + + let win = await BrowserTestUtils.openNewBrowserWindow({ + private: true, + }); + + let optionItems = [ + "placesContext_open:newtab", + // Hidden in private window "placesContext_open:newcontainertab" + // Hidden in private window "placesContext_open:newwindow" + "placesContext_open:newprivatewindow", + "placesContext_show_bookmark:info", + "placesContext_deleteBookmark", + "placesContext_cut", + "placesContext_copy", + "placesContext_paste_group", + "placesContext_new:bookmark", + "placesContext_new:folder", + "placesContext_new:separator", + ]; + + // Test toolbar. + await checkContextMenu( + async function () { + let toolbarBookmark = await PlacesUtils.bookmarks.insert({ + parentGuid: PlacesUtils.bookmarks.toolbarGuid, + title: "Bookmark Title", + url: TEST_URL, + }); + + let toolbarNode = getToolbarNodeForItemGuid(toolbarBookmark.guid, win); + + let contextMenu = win.document.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + + EventUtils.synthesizeMouseAtCenter( + toolbarNode, + { button: 2, type: "contextmenu" }, + win + ); + await popupShownPromise; + return contextMenu; + }, + [ + ...optionItems, + "placesContext_showAllBookmarks", + "toggle_PersonalToolbar", + "show-other-bookmarks_PersonalToolbar", + ], + win.document + ); + + // Test side bar. + await withSidebarTree( + "bookmarks", + async tree => { + await checkContextMenu( + async bookmark => { + tree.selectItems([bookmark.guid]); + + let contextMenu = + win.SidebarController.browser.contentDocument.getElementById( + "placesContext" + ); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + synthesizeClickOnSelectedTreeCell(tree, { type: "contextmenu" }, win); + await popupShownPromise; + return contextMenu; + }, + optionItems, + win.SidebarController.browser.contentDocument + ); + }, + win + ); + + // Test library window opened when using private browsing window. + optionItems.splice( + optionItems.indexOf("placesContext_show_bookmark:info"), + 1 + ); + optionItems.splice(0, 0, "placesContext_open"); + + await withLibraryWindow( + "BookmarksToolbar", + async ({ right }) => { + await checkContextMenu( + async bookmark => { + let contextMenu = right.ownerDocument.getElementById("placesContext"); + let popupShownPromise = BrowserTestUtils.waitForEvent( + contextMenu, + "popupshown" + ); + right.selectItems([bookmark.guid]); + synthesizeClickOnSelectedTreeCell(right, { type: "contextmenu" }); + await popupShownPromise; + return contextMenu; + }, + optionItems, + right.ownerDocument + ); + }, + win + ); + + await BrowserTestUtils.closeWindow(win); +}); ===================================== browser/components/places/tests/browser/head.js ===================================== @@ -6,8 +6,8 @@ ChromeUtils.defineLazyGetter(this, "gFluentStrings", function () { return new Localization(["branding/brand.ftl", "browser/browser.ftl"], true); }); -function openLibrary(callback, aLeftPaneRoot) { - let library = window.openDialog( +function openLibrary(callback, aLeftPaneRoot, win = window) { + let library = win.openDialog( "chrome://browser/content/places/places.xhtml", "", "chrome,toolbar=yes,dialog=no,resizable", @@ -27,10 +27,12 @@ function openLibrary(callback, aLeftPaneRoot) { * * @param {object} aLeftPaneRoot * Hierarchy to open and select in the left pane. + * @param {Window} [win] + * The window to use to open the library. * @returns {Promise} * Resolves to the handle to the library window. */ -function promiseLibrary(aLeftPaneRoot) { +function promiseLibrary(aLeftPaneRoot, win = window) { return new Promise(resolve => { let library = Services.wm.getMostRecentWindow("Places:Organizer"); if (library && !library.closed) { @@ -42,7 +44,7 @@ function promiseLibrary(aLeftPaneRoot) { checkLibraryPaneVisibility(library, aLeftPaneRoot); resolve(library); } else { - openLibrary(resolve, aLeftPaneRoot); + openLibrary(resolve, aLeftPaneRoot, win); } }); } @@ -380,9 +382,11 @@ function fillBookmarkTextField(id, text, win, blur = true) { * @param {Function} taskFn * The task to execute once the sidebar is ready. Will get the Places * tree view as input. + * @param {Window} [win] + * The window to open the sidebar in, else uses the default window. */ -var withSidebarTree = async function (type, taskFn) { - let sidebar = document.getElementById("sidebar"); +var withSidebarTree = async function (type, taskFn, win = window) { + let sidebar = win.document.getElementById("sidebar"); info("withSidebarTree: waiting sidebar load"); let sidebarLoadedPromise = new Promise(resolve => { sidebar.addEventListener( @@ -395,7 +399,7 @@ var withSidebarTree = async function (type, taskFn) { }); let sidebarId = type == "bookmarks" ? "viewBookmarksSidebar" : "viewHistorySidebar"; - SidebarController.show(sidebarId); + win.SidebarController.show(sidebarId); await sidebarLoadedPromise; let treeId = type == "bookmarks" ? "bookmarks-view" : "historyTree"; @@ -406,7 +410,7 @@ var withSidebarTree = async function (type, taskFn) { try { await taskFn(tree); } finally { - SidebarController.hide(); + win.SidebarController.hide(); } }; @@ -419,9 +423,11 @@ var withSidebarTree = async function (type, taskFn) { * @param {Function} taskFn * The task to execute once the Library is ready. * Will get { left, right } trees as argument. + * @param {Window} [win] + * The window to use to open the library. */ -var withLibraryWindow = async function (hierarchy, taskFn) { - let library = await promiseLibrary(hierarchy); +var withLibraryWindow = async function (hierarchy, taskFn, win = window) { + let library = await promiseLibrary(hierarchy, win); let left = library.document.getElementById("placesList"); let right = library.document.getElementById("placeContent"); info("withLibrary: executing the task"); @@ -477,8 +483,8 @@ function promisePopupHidden(popup) { } // Identify a bookmark node in the Bookmarks Toolbar by its guid. -function getToolbarNodeForItemGuid(itemGuid) { - let children = document.getElementById("PlacesToolbarItems").childNodes; +function getToolbarNodeForItemGuid(itemGuid, win = window) { + let children = win.document.getElementById("PlacesToolbarItems").childNodes; for (let child of children) { if (itemGuid === child._placesNode.bookmarkGuid) { return child; View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1d54c76… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/1d54c76… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-build][maint-13.5] MB 334: Fix .desktop file for opening external links
by morgan (@morgan) 17 Sep '24

17 Sep '24
morgan pushed to branch maint-13.5 at The Tor Project / Applications / tor-browser-build Commits: 6027863e by Nicolas Vigier at 2024-09-17T18:36:17+00:00 MB 334: Fix .desktop file for opening external links The `Exec` entry from the .desktop file included in the rpm and deb packages was missing the `%u` parameter. - - - - - 1 changed file: - projects/linux-packages/browser.desktop.in Changes: ===================================== projects/linux-packages/browser.desktop.in ===================================== @@ -5,7 +5,7 @@ Name=[% c("var/Project_Name") %] GenericName=Web Browser Comment=[% c("var/system_pkg/pkg_description") %] Categories=Network;WebBrowser; -Exec=/[% c("var/system_pkg/install_path") %]/start-[% c("var/project-name") %] --detach +Exec=/[% c("var/system_pkg/install_path") %]/start-[% c("var/project-name") %] --detach %u Icon=[% c("var/system_pkg/pkg_name") %] StartupWMClass=[% c("var/display_name") %] [% IF ! c("var/tor-browser") -%] View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/6… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-build/-/commit/6… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
[Git][tpo/applications/tor-browser-update-responses][main] release: new version, 13.5.4
by morgan (@morgan) 17 Sep '24

17 Sep '24
morgan pushed to branch main at The Tor Project / Applications / Tor Browser update responses Commits: c3a2e496 by Morgan at 2024-09-17T16:29:47+00:00 release: new version, 13.5.4 - - - - - 30 changed files: - update_3/release/.htaccess - − update_3/release/13.5-13.5.3-linux-i686-ALL.xml - − update_3/release/13.5-13.5.3-linux-x86_64-ALL.xml - − update_3/release/13.5-13.5.3-macos-ALL.xml - − update_3/release/13.5-13.5.3-windows-i686-ALL.xml - − update_3/release/13.5-13.5.3-windows-x86_64-ALL.xml - − update_3/release/13.5.1-13.5.3-linux-i686-ALL.xml - − update_3/release/13.5.1-13.5.3-linux-x86_64-ALL.xml - − update_3/release/13.5.1-13.5.3-macos-ALL.xml - − update_3/release/13.5.1-13.5.3-windows-i686-ALL.xml - − update_3/release/13.5.1-13.5.3-windows-x86_64-ALL.xml - + update_3/release/13.5.1-13.5.4-linux-i686-ALL.xml - + update_3/release/13.5.1-13.5.4-linux-x86_64-ALL.xml - + update_3/release/13.5.1-13.5.4-macos-ALL.xml - + update_3/release/13.5.1-13.5.4-windows-i686-ALL.xml - + update_3/release/13.5.1-13.5.4-windows-x86_64-ALL.xml - − update_3/release/13.5.2-13.5.3-linux-i686-ALL.xml - − update_3/release/13.5.2-13.5.3-linux-x86_64-ALL.xml - − update_3/release/13.5.2-13.5.3-macos-ALL.xml - − update_3/release/13.5.2-13.5.3-windows-i686-ALL.xml - − update_3/release/13.5.2-13.5.3-windows-x86_64-ALL.xml - + update_3/release/13.5.2-13.5.4-linux-i686-ALL.xml - + update_3/release/13.5.2-13.5.4-linux-x86_64-ALL.xml - + update_3/release/13.5.2-13.5.4-macos-ALL.xml - + update_3/release/13.5.2-13.5.4-windows-i686-ALL.xml - + update_3/release/13.5.2-13.5.4-windows-x86_64-ALL.xml - + update_3/release/13.5.3-13.5.4-linux-i686-ALL.xml - + update_3/release/13.5.3-13.5.4-linux-x86_64-ALL.xml - + update_3/release/13.5.3-13.5.4-macos-ALL.xml - + update_3/release/13.5.3-13.5.4-windows-i686-ALL.xml The diff was not included because it is too large. View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-update-responses… -- View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser-update-responses… You're receiving this email because of your account on gitlab.torproject.org.
1 0
0 0
  • ← Newer
  • 1
  • ...
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • ...
  • 1861
  • Older →

HyperKitty Powered by HyperKitty version 1.3.12.