From 40a355a42d4a9444dc753c04c6608dade2f06a23 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:27 +0200 Subject: Adding upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../components/aboutconfig/content/aboutconfig.js | 1 + .../aboutconfig/test/browser/browser.toml | 3 +- .../aboutconfig/test/browser/browser_clipboard.js | 17 + .../aboutconfig/test/browser/browser_edit.js | 21 + .../components/aboutmemory/content/aboutMemory.js | 6 +- .../antitracking/ContentBlockingAllowList.cpp | 69 ++ .../antitracking/ContentBlockingAllowList.h | 56 +- .../antitracking/ContentBlockingAllowList.sys.mjs | 2 +- .../antitracking/PurgeTrackerService.sys.mjs | 2 +- .../URLDecorationAnnotationsService.sys.mjs | 2 +- .../antitracking/URLQueryStringStripper.cpp | 4 +- .../BounceTrackingProtection.cpp | 123 +++- .../BounceTrackingProtection.h | 28 +- .../BounceTrackingRecord.cpp | 13 +- .../BounceTrackingRecord.h | 15 +- .../BounceTrackingState.cpp | 17 +- .../bouncetrackingprotection/BounceTrackingState.h | 6 +- .../BounceTrackingStateGlobal.cpp | 32 +- .../BounceTrackingStateGlobal.h | 11 + .../nsIBounceTrackingProtection.idl | 4 + .../test/browser/browser_bouncetracking_purge.js | 66 ++ ...st_bouncetracking_clearExpiredUserActivation.js | 85 +++ .../test/xpcshell/xpcshell.toml | 2 + .../antitracking/test/browser/3rdPartySVG.html | 2 +- .../antitracking/test/browser/3rdPartyWorker.html | 2 +- .../antitracking/test/browser/antitracking_head.js | 12 +- .../test/browser/blobPartitionPage.html | 2 +- .../test/browser/browser-blocking.toml | 6 +- .../test/browser/browser_aboutblank.js | 4 +- .../browser_addonHostPermissionIgnoredInTP.js | 2 +- .../test/browser/browser_allowListNotifications.js | 2 +- ...owser_allowListNotifications_alwaysPartition.js | 2 +- ...allowListSeparationInPrivateAndNormalWindows.js | 2 +- .../browser/browser_allowPermissionForTracker.js | 4 +- .../browser/browser_backgroundImageAssertion.js | 2 +- .../test/browser/browser_blockingCookies.js | 4 +- .../test/browser/browser_blockingDOMCache.js | 2 +- .../browser_blockingDOMCacheAlwaysPartition.js | 2 +- .../browser_blockingDOMCacheAlwaysPartitionSAA.js | 2 +- .../test/browser/browser_blockingDOMCacheSAA.js | 2 +- .../test/browser/browser_blockingIndexedDb.js | 4 +- .../browser/browser_blockingIndexedDbInWorkers.js | 6 +- .../browser/browser_blockingIndexedDbInWorkers2.js | 10 +- .../test/browser/browser_blockingLocalStorage.js | 4 +- .../test/browser/browser_blockingMessaging.js | 20 +- .../test/browser/browser_blockingNoOpener.js | 2 +- .../test/browser/browser_blockingServiceWorkers.js | 2 +- ...owser_blockingServiceWorkersStorageAccessAPI.js | 2 +- .../test/browser/browser_blockingSessionStorage.js | 4 +- .../test/browser/browser_blockingSharedWorkers.js | 4 +- .../browser_contentBlockingAllowListPrincipal.js | 14 +- .../browser/browser_contentBlockingTelemetry.js | 3 +- .../test/browser/browser_cookieBetweenTabs.js | 2 +- .../browser/browser_denyPermissionForTracker.js | 2 +- .../test/browser/browser_doublyNestedTracker.js | 2 +- .../browser_existingCookiesForSubresources.js | 2 +- ...er_firstPartyCookieRejectionHonoursAllowList.js | 4 +- .../test/browser/browser_hasStorageAccess.js | 2 +- .../browser_hasStorageAccess_alwaysPartition.js | 2 +- .../test/browser/browser_localStorageEvents.js | 4 +- ...odifyRequestNotificationForTrackingResources.js | 4 +- .../browser/browser_partitionedConsoleMessage.js | 2 +- .../test/browser/browser_partitionedCookies.js | 20 +- .../test/browser/browser_partitionedDOMCache.js | 14 +- .../test/browser/browser_partitionedIndexedDB.js | 6 +- .../browser/browser_partitionedLocalStorage.js | 4 +- .../browser_partitionedLocalStorage_events.js | 2 +- .../test/browser/browser_partitionedLockManager.js | 4 +- .../test/browser/browser_partitionedMessaging.js | 4 +- .../browser/browser_partitionedServiceWorkers.js | 40 +- .../browser/browser_partitionedSharedWorkers.js | 4 +- .../browser/browser_permissionInNormalWindows.js | 5 +- ...er_permissionInNormalWindows_alwaysPartition.js | 6 +- .../browser/browser_permissionInPrivateWindows.js | 2 +- ...r_permissionInPrivateWindows_alwaysPartition.js | 2 +- .../test/browser/browser_permissionPropagation.js | 6 +- .../test/browser/browser_referrerDefaultPolicy.js | 2 +- .../antitracking/test/browser/browser_script.js | 2 +- .../browser/browser_siteSpecificWorkArounds.js | 8 +- .../browser/browser_socialtracking_save_image.js | 2 +- .../test/browser/browser_staticPartition_cache.js | 2 +- .../browser/browser_staticPartition_network.js | 2 +- .../test/browser/browser_staticPartition_saveAs.js | 6 +- .../browser/browser_staticPartition_tls_session.js | 2 +- .../browser/browser_storageAccessDoorHanger.js | 2 +- .../browser/browser_storageAccessPrivilegeAPI.js | 2 +- ...ageAccessPromiseRejectHandlerUserInteraction.js | 2 +- ...RejectHandlerUserInteraction_alwaysPartition.js | 2 +- ...geAccessPromiseResolveHandlerUserInteraction.js | 2 +- ...browser_storageAccessRemovalNavigateSubframe.js | 2 +- ...ccessRemovalNavigateSubframe_alwaysPartition.js | 2 +- ...browser_storageAccessRemovalNavigateTopframe.js | 2 +- ...ccessRemovalNavigateTopframe_alwaysPartition.js | 2 +- .../test/browser/browser_storageAccessSandboxed.js | 6 +- ...owser_storageAccessSandboxed_alwaysPartition.js | 6 +- .../browser_storageAccessThirdPartyChecks.js | 6 +- ...torageAccessThirdPartyChecks_alwaysPartition.js | 6 +- .../browser/browser_storageAccessWithDynamicFpi.js | 2 +- .../browser/browser_storageAccessWithHeuristics.js | 22 +- .../browser_storageAccess_TopLevel_Arguments.js | 2 +- ...rowser_storageAccess_TopLevel_CookieBehavior.js | 2 +- ...wser_storageAccess_TopLevel_CookiePermission.js | 2 +- ...r_storageAccess_TopLevel_CrossOriginSameSite.js | 2 +- .../browser_storageAccess_TopLevel_Doorhanger.js | 2 +- .../browser_storageAccess_TopLevel_Embed.js | 2 +- .../browser_storageAccess_TopLevel_Enable.js | 2 +- ...ccess_TopLevel_RequireIntermediatePermission.js | 2 +- ...orageAccess_TopLevel_StorageAccessPermission.js | 2 +- ...rowser_storageAccess_TopLevel_UserActivation.js | 2 +- .../test/browser/browser_subResources.js | 2 +- .../browser/browser_subResourcesPartitioned.js | 2 +- ...wser_subResourcesPartitioned_alwaysPartition.js | 2 +- .../browser_thirdPartyStorageRejectionForCORS.js | 2 +- .../test/browser/browser_urlDecorationStripping.js | 2 +- ...owser_urlDecorationStripping_alwaysPartition.js | 2 +- .../browser/browser_urlQueryStringStripping.js | 2 +- .../browser_urlQueryStringStripping_allowList.js | 2 +- .../test/browser/browser_userInteraction.js | 8 +- .../test/browser/browser_workerPropagation.js | 2 +- .../test/browser/file_saveAsPageInfo.html | 4 +- .../components/antitracking/test/browser/head.js | 2 + .../antitracking/test/browser/imageCacheWorker.js | 2 +- .../antitracking/test/browser/localStorage.html | 2 +- .../test/browser/partitionedstorage_head.js | 17 +- .../test/browser/storage_access_head.js | 2 +- .../antitracking/test/browser/tracker.js | 2 +- .../antitracking/test/browser/workerIframe.html | 2 +- .../test/xpcshell/test_staticPartition_authhttp.js | 2 +- .../test/xpcshell/test_staticPartition_prefetch.js | 2 +- .../test/xpcshell/test_staticPartition_preload.js | 2 +- .../antitracking/test/xpcshell/xpcshell.toml | 7 +- toolkit/components/apppicker/content/appPicker.js | 6 +- .../components/asyncshutdown/AsyncShutdown.sys.mjs | 3 +- .../components/asyncshutdown/nsIAsyncShutdown.idl | 4 - .../backgroundhangmonitor/ThreadStackHelper.cpp | 3 +- .../backgroundhangmonitor/ThreadStackHelper.h | 3 +- toolkit/components/bitsdownload/nsIBits.idl | 7 - .../cleardata/PrincipalsCollector.sys.mjs | 2 +- .../cleardata/ServiceWorkerCleanUp.sys.mjs | 2 +- .../components/cleardata/nsIClearDataService.idl | 2 +- .../test_moved_origin_directory_cleanup.py | 11 + .../cleardata/tests/unit/test_cookies.js | 71 ++ .../components/contentanalysis/ContentAnalysis.cpp | 437 ++++++++++--- .../components/contentanalysis/ContentAnalysis.h | 42 +- toolkit/components/contentanalysis/moz.build | 124 ++-- .../contentanalysis/nsIContentAnalysis.idl | 18 + .../contentanalysis/tests/browser/browser.toml | 3 + .../browser/browser_content_analysis_policies.js | 127 ++++ .../contentanalysis/tests/browser/moz.build | 7 + .../tests/gtest/TestContentAnalysis.cpp | 214 +++--- .../tests/gtest/TestContentAnalysis.h | 24 - .../tests/gtest/TestContentAnalysisAgent.cpp | 132 ++++ .../tests/gtest/TestContentAnalysisAgent.h | 24 + .../tests/gtest/TestContentAnalysisMisbehaving.cpp | 2 +- .../tests/gtest/TestContentAnalysisUtils.cpp | 2 +- .../contentanalysis/tests/gtest/moz.build | 4 + toolkit/components/contentanalysis/tests/moz.build | 7 + .../ContextualIdentityService.sys.mjs | 2 +- .../components/corroborator/Corroborate.sys.mjs | 12 +- toolkit/components/crashes/CrashManager.in.sys.mjs | 3 +- .../IdentityCredentialPromptService.sys.mjs | 12 +- .../IdentityCredentialStorageService.cpp | 19 +- toolkit/components/downloads/DownloadCore.sys.mjs | 4 +- .../components/downloads/DownloadHistory.sys.mjs | 4 +- .../downloads/DownloadIntegration.sys.mjs | 2 +- .../components/downloads/DownloadLegacy.sys.mjs | 14 +- toolkit/components/downloads/DownloadList.sys.mjs | 2 +- .../downloads/test/unit/common_test_Download.js | 35 +- toolkit/components/downloads/test/unit/head.js | 10 +- .../downloads/test/unit/test_DownloadHistory.js | 2 +- .../downloads/test/unit/test_DownloadLegacy.js | 2 + .../downloads/test/unit/test_DownloadList.js | 4 +- .../downloads/test/unit/test_Download_noext_win.js | 2 +- .../enterprisepolicies/WindowsGPOParser.sys.mjs | 2 +- .../enterprisepolicies/macOSPoliciesParser.sys.mjs | 2 +- toolkit/components/extensions/.eslintrc.js | 8 +- .../components/extensions/ConduitsChild.sys.mjs | 2 +- toolkit/components/extensions/Extension.sys.mjs | 45 +- .../components/extensions/ExtensionActions.sys.mjs | 32 +- .../components/extensions/ExtensionChild.sys.mjs | 10 +- .../components/extensions/ExtensionCommon.sys.mjs | 74 +-- .../components/extensions/ExtensionContent.sys.mjs | 4 +- toolkit/components/extensions/ExtensionDNR.sys.mjs | 18 +- .../extensions/ExtensionPageChild.sys.mjs | 4 +- .../components/extensions/ExtensionParent.sys.mjs | 26 +- .../extensions/ExtensionPermissions.sys.mjs | 5 +- .../extensions/ExtensionPolicyService.cpp | 9 +- .../extensions/ExtensionProcessScript.sys.mjs | 4 +- .../extensions/ExtensionScriptingStore.sys.mjs | 10 +- .../components/extensions/ExtensionStorage.sys.mjs | 2 +- .../extensions/ExtensionStorageIDB.sys.mjs | 2 +- .../extensions/ExtensionStorageSync.sys.mjs | 2 +- .../extensions/ExtensionStorageSyncKinto.sys.mjs | 6 +- .../extensions/ExtensionTelemetry.sys.mjs | 4 +- .../extensions/ExtensionTestCommon.sys.mjs | 2 +- .../components/extensions/ExtensionUtils.sys.mjs | 2 +- .../extensions/ExtensionWorkerChild.sys.mjs | 2 +- .../extensions/ExtensionXPCShellUtils.sys.mjs | 6 +- toolkit/components/extensions/ExtensionsParent.cpp | 4 +- .../components/extensions/MessageChannel.sys.mjs | 10 +- .../extensions/MessageManagerProxy.sys.mjs | 2 +- .../extensions/ProxyChannelFilter.sys.mjs | 8 +- toolkit/components/extensions/Schemas.sys.mjs | 44 +- .../components/extensions/WebNavigation.sys.mjs | 3 +- .../extensions/child/ext-declarativeNetRequest.js | 2 +- toolkit/components/extensions/child/ext-storage.js | 8 +- toolkit/components/extensions/child/ext-test.js | 4 +- .../extensions/child/ext-userScripts-content.js | 2 +- .../components/extensions/docs/webext-storage.rst | 2 +- .../components/extensions/docs/webidl_bindings.rst | 2 +- toolkit/components/extensions/metrics.yaml | 24 +- toolkit/components/extensions/parent/ext-alarms.js | 4 +- .../extensions/parent/ext-backgroundPage.js | 4 +- .../extensions/parent/ext-browsingData.js | 4 +- .../extensions/parent/ext-captivePortal.js | 10 +- .../components/extensions/parent/ext-clipboard.js | 2 +- .../extensions/parent/ext-contextualIdentities.js | 2 +- .../extensions/parent/ext-declarativeNetRequest.js | 2 +- toolkit/components/extensions/parent/ext-dns.js | 2 +- .../components/extensions/parent/ext-downloads.js | 11 +- .../extensions/parent/ext-geckoProfiler.js | 2 +- .../components/extensions/parent/ext-identity.js | 4 +- toolkit/components/extensions/parent/ext-idle.js | 2 +- .../components/extensions/parent/ext-management.js | 2 +- .../extensions/parent/ext-networkStatus.js | 2 +- .../extensions/parent/ext-protocolHandlers.js | 2 +- .../components/extensions/parent/ext-runtime.js | 4 +- .../components/extensions/parent/ext-scripting.js | 6 +- .../components/extensions/parent/ext-storage.js | 4 +- .../components/extensions/parent/ext-tabs-base.js | 77 +-- toolkit/components/extensions/parent/ext-theme.js | 2 +- .../extensions/parent/ext-webNavigation.js | 2 +- .../storage/webext_storage_bridge/src/lib.rs | 4 +- .../browser_ext_background_serviceworker.js | 2 +- .../test/browser/browser_ext_downloads_filters.js | 2 +- .../test/browser/browser_ext_downloads_referrer.js | 6 +- .../browser_ext_extension_page_tab_navigated.js | 2 +- .../test/browser/browser_ext_management_themes.js | 2 +- .../test/browser/browser_ext_themes_arrowpanels.js | 4 +- .../test/browser/browser_ext_themes_incognito.js | 2 +- .../browser_ext_themes_ntp_colors_perwindow.js | 3 +- .../test/mochitest/chrome_cleanup_script.js | 2 +- .../extensions/test/mochitest/file_indexedDB.html | 2 +- .../test/mochitest/file_simple_iframe_worker.html | 4 +- .../mochitest/file_simple_webrequest_worker.html | 4 +- .../extensions/test/mochitest/head_cookies.js | 2 +- .../extensions/test/mochitest/head_webrequest.js | 8 +- .../test/mochitest/mochitest-common.toml | 1 + .../test_chrome_ext_downloads_saveAs.html | 2 +- .../test_chrome_ext_downloads_uniquify.html | 2 +- .../mochitest/test_chrome_ext_permissions.html | 2 +- ...st_chrome_ext_webrequest_background_events.html | 4 +- .../test_chrome_ext_webrequest_mozextension.html | 2 +- .../test/mochitest/test_ext_activityLog.html | 4 +- .../test/mochitest/test_ext_async_clipboard.html | 8 +- .../mochitest/test_ext_browsingData_indexedDB.html | 2 +- .../test_ext_browsingData_localStorage.html | 2 +- .../test_ext_browsingData_serviceWorkers.html | 2 +- .../mochitest/test_ext_browsingData_settings.html | 8 +- .../mochitest/test_ext_exclude_include_globs.html | 4 +- .../test_ext_extension_iframe_messaging.html | 2 +- .../test/mochitest/test_ext_redirect_jar.html | 2 +- .../test_ext_request_urlClassification.html | 2 +- .../test_ext_sendmessage_doublereply.html | 2 +- .../mochitest/test_ext_sendmessage_reply2.html | 4 +- .../test/mochitest/test_ext_storage_cleanup.html | 2 +- .../mochitest/test_ext_streamfilter_multiple.html | 2 +- .../test_ext_streamfilter_processswitch.html | 2 +- .../mochitest/test_ext_subframes_privileges.html | 2 +- .../test_ext_tabs_executeScript_good.html | 2 +- .../test/mochitest/test_ext_tabs_permissions.html | 7 +- .../test_ext_web_accessible_incognito.html | 2 +- .../test_ext_web_accessible_resources.html | 2 +- .../test/mochitest/test_ext_webrequest_auth.html | 10 +- .../test_ext_webrequest_background_events.html | 2 +- .../test/mochitest/test_ext_webrequest_basic.html | 2 +- .../test/mochitest/test_ext_webrequest_errors.html | 2 +- .../test/mochitest/test_ext_webrequest_hsts.html | 10 +- .../test_ext_webrequest_redirect_bypass_cors.html | 2 +- .../test/mochitest/webrequest_chromeworker.js | 2 +- .../test/xpcshell/data/file_page_xhr.html | 2 +- .../test/xpcshell/data/file_permission_xhr.html | 2 +- .../components/extensions/test/xpcshell/head.js | 22 +- .../extensions/test/xpcshell/head_schemas.js | 4 +- .../test/xpcshell/head_service_worker.js | 2 +- .../extensions/test/xpcshell/test_csp_validator.js | 6 +- .../test/xpcshell/test_ext_alarms_does_not_fire.js | 2 +- ...est_ext_api_events_listener_calls_exceptions.js | 1 + .../test/xpcshell/test_ext_captivePortal.js | 5 - .../xpcshell/test_ext_contentScripts_register.js | 2 +- .../test/xpcshell/test_ext_contentscript.js | 2 +- .../xpcshell/test_ext_contentscript_context.js | 2 +- .../test_ext_contentscript_create_iframe.js | 2 +- .../xpcshell/test_ext_contentscript_importmap.js | 2 +- .../test_ext_contentscript_module_import.js | 2 +- .../test_ext_contentscript_triggeringPrincipal.js | 2 +- .../extensions/test/xpcshell/test_ext_contexts.js | 4 +- .../test/xpcshell/test_ext_contexts_gc.js | 4 +- .../test/xpcshell/test_ext_dnr_allowAllRequests.js | 2 +- .../test/xpcshell/test_ext_dnr_download.js | 2 +- .../test/xpcshell/test_ext_dnr_modifyHeaders.js | 2 +- .../test/xpcshell/test_ext_dnr_webrequest.js | 4 +- .../extensions/test/xpcshell/test_ext_dns.js | 2 +- .../test/xpcshell/test_ext_downloads_download.js | 2 +- .../xpcshell/test_ext_downloads_partitionKey.js | 2 +- .../test/xpcshell/test_ext_downloads_search.js | 2 +- .../test/xpcshell/test_ext_downloads_urlencoded.js | 2 +- .../test/xpcshell/test_ext_eventpage_messaging.js | 4 +- .../test/xpcshell/test_ext_experiments.js | 8 +- .../extensions/test/xpcshell/test_ext_i18n.js | 8 +- .../test/xpcshell/test_ext_indexedDB_principal.js | 12 +- .../test/xpcshell/test_ext_management.js | 2 +- .../xpcshell/test_ext_management_uninstall_self.js | 6 +- .../test/xpcshell/test_ext_messaging_startup.js | 4 +- .../test/xpcshell/test_ext_native_messaging.js | 6 +- .../xpcshell/test_ext_notifications_incognito.js | 2 +- .../test/xpcshell/test_ext_permissions.js | 26 + .../test/xpcshell/test_ext_persistent_events.js | 4 +- .../test/xpcshell/test_ext_privacy_disable.js | 2 +- .../test_ext_proxy_authorization_via_proxyinfo.js | 2 +- .../test/xpcshell/test_ext_proxy_onauthrequired.js | 8 +- .../test/xpcshell/test_ext_proxy_settings.js | 4 +- .../test/xpcshell/test_ext_proxy_socks.js | 4 +- .../test/xpcshell/test_ext_proxy_startup.js | 4 +- .../extensions/test/xpcshell/test_ext_redirects.js | 10 +- .../test_ext_runtime_onInstalled_and_onStartup.js | 2 +- .../test/xpcshell/test_ext_runtime_ports.js | 2 +- .../test/xpcshell/test_ext_runtime_ports_gc.js | 2 +- .../test/xpcshell/test_ext_runtime_sendMessage.js | 4 +- .../test/xpcshell/test_ext_same_site_redirects.js | 2 +- .../extensions/test/xpcshell/test_ext_schemas.js | 6 +- .../test/xpcshell/test_ext_schemas_interactive.js | 4 +- .../test_ext_schemas_manifest_permissions.js | 2 +- .../test/xpcshell/test_ext_schemas_privileged.js | 2 +- .../test/xpcshell/test_ext_schemas_roots.js | 2 +- .../test_ext_scripting_persistAcrossSessions.js | 12 + .../test_ext_storage_idb_data_migration.js | 3 +- .../test/xpcshell/test_ext_storage_sanitizer.js | 2 +- .../test/xpcshell/test_ext_storage_sync_kinto.js | 117 ++-- .../test/xpcshell/test_ext_storage_tab.js | 2 +- .../test/xpcshell/test_ext_userScripts_exports.js | 4 +- .../test/xpcshell/test_ext_webRequest_auth.js | 2 +- .../test_ext_webRequest_cancelWithReason.js | 4 +- .../test/xpcshell/test_ext_webRequest_download.js | 2 +- .../test_ext_webRequest_filterResponseData.js | 2 +- .../xpcshell/test_ext_webRequest_permission.js | 4 +- .../test_ext_webRequest_redirectProperty.js | 4 +- .../xpcshell/test_ext_webRequest_responseBody.js | 40 +- .../test/xpcshell/test_ext_webRequest_startup.js | 22 +- .../test/xpcshell/test_ext_webRequest_suspend.js | 4 +- .../xpcshell/test_ext_webRequest_viewsource.js | 2 +- .../test/xpcshell/test_ext_webRequest_webSocket.js | 10 +- .../xpcshell/test_ext_web_accessible_resources.js | 8 +- .../test/xpcshell/test_native_manifests.js | 2 +- .../test/xpcshell/test_proxy_failover.js | 6 +- .../test/xpcshell/test_proxy_info_results.js | 29 +- .../test/xpcshell/test_proxy_listener.js | 6 +- .../test/xpcshell/test_webRequest_filtering.js | 2 +- .../xpcshell/webidl-api/test_ext_webidl_api.js | 18 +- .../test_ext_webidl_api_event_callback.js | 20 +- .../test_ext_webidl_api_request_handler.js | 2 +- .../test_ext_webidl_api_schema_errors.js | 2 +- .../test_ext_webidl_api_schema_formatters.js | 2 +- .../webidl-api/test_ext_webidl_runtime_port.js | 2 +- .../webidl-api/ExtensionAPIRequestForwarder.cpp | 6 +- .../webidl-api/GenerateWebIDLBindings.py | 4 +- .../extensions/webrequest/WebRequest.sys.mjs | 4 +- toolkit/components/find/nsFind.cpp | 1 - toolkit/components/find/nsWebBrowserFind.cpp | 1 - .../AutofillProfileAutoComplete.sys.mjs | 2 +- .../formautofill/AutofillTelemetry.sys.mjs | 629 ------------------ toolkit/components/formautofill/Constants.ios.mjs | 3 +- .../formautofill/FormAutofill.ios.sys.mjs | 2 +- .../components/formautofill/FormAutofill.sys.mjs | 4 +- .../formautofill/FormAutofillChild.ios.sys.mjs | 14 +- .../formautofill/FormAutofillChild.sys.mjs | 524 ++++++++++++--- .../formautofill/FormAutofillContent.sys.mjs | 367 +---------- .../components/formautofill/FormAutofillNative.cpp | 20 +- .../formautofill/FormAutofillParent.sys.mjs | 6 +- .../formautofill/FormAutofillStorageBase.sys.mjs | 193 ++---- .../formautofill/FormAutofillSync.sys.mjs | 2 +- toolkit/components/formautofill/Helpers.ios.mjs | 100 ++- toolkit/components/formautofill/Overrides.ios.js | 1 - .../formautofill/ProfileAutoCompleteResult.sys.mjs | 62 +- .../android/FormAutofillPrompter.sys.mjs | 8 +- .../android/FormAutofillStorage.sys.mjs | 10 +- .../default/FormAutofillPrompter.sys.mjs | 6 +- toolkit/components/formautofill/moz.build | 5 + .../phonenumberutils/PhoneNumber.sys.mjs | 474 -------------- .../phonenumberutils/PhoneNumberMetaData.sys.mjs | 291 --------- .../phonenumberutils/PhoneNumberNormalizer.sys.mjs | 67 -- .../formautofill/shared/AddressComponent.sys.mjs | 10 +- .../formautofill/shared/AddressParser.sys.mjs | 2 +- .../formautofill/shared/AddressRecord.sys.mjs | 119 ++++ .../formautofill/shared/AutofillTelemetry.sys.mjs | 629 ++++++++++++++++++ .../formautofill/shared/FieldScanner.sys.mjs | 13 + .../shared/FormAutofillHeuristics.sys.mjs | 72 +- .../shared/FormAutofillSection.sys.mjs | 24 +- .../formautofill/shared/FormAutofillUtils.sys.mjs | 39 +- .../formautofill/shared/FormStateManager.sys.mjs | 2 +- .../formautofill/shared/PhoneNumber.sys.mjs | 474 ++++++++++++++ .../shared/PhoneNumberMetaData.sys.mjs | 291 +++++++++ .../shared/PhoneNumberNormalizer.sys.mjs | 67 ++ toolkit/components/glean/Cargo.toml | 6 +- toolkit/components/glean/api/Cargo.toml | 3 +- .../glean/api/src/ffi/custom_distribution.rs | 2 + .../glean/api/src/ffi/memory_distribution.rs | 2 + toolkit/components/glean/api/src/ffi/mod.rs | 1 + toolkit/components/glean/api/src/ffi/object.rs | 68 ++ .../glean/api/src/ffi/timing_distribution.rs | 2 + toolkit/components/glean/api/src/pings.rs | 2 +- .../glean/api/src/private/custom_distribution.rs | 4 + toolkit/components/glean/api/src/private/mod.rs | 2 + toolkit/components/glean/api/src/private/object.rs | 83 +++ toolkit/components/glean/api/src/private/ping.rs | 4 +- .../glean/api/src/private/timing_distribution.rs | 4 + toolkit/components/glean/bindings/GleanMetric.h | 1 + toolkit/components/glean/bindings/MetricTypes.h | 1 + toolkit/components/glean/bindings/jog/src/lib.rs | 6 + .../glean/bindings/private/CustomDistribution.cpp | 8 +- .../glean/bindings/private/DistributionData.h | 6 +- .../glean/bindings/private/MemoryDistribution.cpp | 8 +- .../components/glean/bindings/private/Object.cpp | 80 +++ toolkit/components/glean/bindings/private/Object.h | 94 +++ .../components/glean/bindings/private/Timespan.cpp | 1 + .../glean/bindings/private/TimingDistribution.cpp | 29 +- .../glean/build_scripts/glean_parser_ext/jog.py | 1 + .../glean_parser_ext/run_glean_parser.py | 27 + .../glean/build_scripts/glean_parser_ext/rust.py | 37 +- .../glean_parser_ext/templates/cpp.jinja2 | 2 + .../glean_parser_ext/templates/jog_factory.jinja2 | 15 +- .../glean_parser_ext/templates/ohttp.jinja2 | 13 + .../glean_parser_ext/templates/rust.jinja2 | 106 +++ .../glean_parser_ext/templates/rust_pings.jinja2 | 1 + .../glean/build_scripts/mach_commands.py | 17 +- toolkit/components/glean/metrics_index.py | 3 + toolkit/components/glean/moz.build | 13 + toolkit/components/glean/pings.yaml | 5 +- .../components/glean/src/init/viaduct_uploader.rs | 205 ++++-- toolkit/components/glean/src/lib.rs | 10 +- toolkit/components/glean/src/ohttp_pings.rs | 13 + toolkit/components/glean/tags.yaml | 20 +- toolkit/components/glean/tests/gtest/TestFog.cpp | 6 + .../glean/tests/pytest/gifft_output_Event | 4 +- .../glean/tests/pytest/gifft_output_Scalar | 6 +- .../components/glean/tests/pytest/jogfile_output | 21 + .../glean/tests/pytest/metrics_test.yaml | 20 + .../glean/tests/pytest/metrics_test_output | 138 +++- .../glean/tests/pytest/metrics_test_output_cpp | 19 +- .../glean/tests/pytest/metrics_test_output_js_cpp | 104 +-- .../glean/tests/pytest/metrics_test_output_js_h | 2 +- .../components/glean/tests/pytest/pings_test.yaml | 18 +- .../glean/tests/pytest/pings_test_output | 19 + .../glean/tests/pytest/pings_test_output_cpp | 7 + .../glean/tests/pytest/pings_test_output_js_cpp | 10 +- .../glean/tests/pytest/pings_test_output_js_h | 2 +- toolkit/components/glean/tests/test_metrics.yaml | 19 + toolkit/components/glean/tests/test_pings.yaml | 19 + toolkit/components/glean/tests/xpcshell/head.js | 152 +++++ .../components/glean/tests/xpcshell/test_GIFFT.js | 10 +- .../glean/tests/xpcshell/test_GIFFTIPC.js | 7 +- .../components/glean/tests/xpcshell/test_Glean.js | 118 +++- .../glean/tests/xpcshell/test_GleanIPC.js | 5 +- .../components/glean/tests/xpcshell/test_JOG.js | 27 +- .../components/glean/tests/xpcshell/test_JOGIPC.js | 5 +- .../components/glean/tests/xpcshell/test_OHTTP.js | 32 + .../components/glean/tests/xpcshell/xpcshell.toml | 3 + toolkit/components/glean/xpcom/FOG.cpp | 7 +- toolkit/components/glean/xpcom/nsIFOG.idl | 3 + toolkit/components/kvstore/kvstore.sys.mjs | 24 +- toolkit/components/kvstore/nsIKeyValue.idl | 16 +- toolkit/components/kvstore/src/lib.rs | 44 +- toolkit/components/kvstore/src/task.rs | 26 +- .../kvstore/test/xpcshell/test_kvstore.js | 74 ++- .../lib/SpecialMessageActions.sys.mjs | 1 + .../schemas/TriggerActionSchemas/index.md | 2 +- .../components/messaging-system/schemas/index.rst | 4 +- toolkit/components/ml/actors/MLEngineChild.sys.mjs | 325 +++++++++ .../components/ml/actors/MLEngineParent.sys.mjs | 403 ++++++++++++ toolkit/components/ml/actors/moz.build | 8 + .../components/ml/content/EngineProcess.sys.mjs | 241 +++++++ toolkit/components/ml/content/MLEngine.html | 16 + toolkit/components/ml/content/MLEngine.worker.mjs | 91 +++ .../components/ml/content/SummarizerModel.sys.mjs | 160 +++++ toolkit/components/ml/docs/index.md | 44 ++ toolkit/components/ml/jar.mn | 9 + toolkit/components/ml/moz.build | 17 + toolkit/components/ml/tests/browser/browser.toml | 5 + .../ml/tests/browser/browser_ml_engine.js | 219 +++++++ toolkit/components/ml/tests/browser/head.js | 155 +++++ toolkit/components/moz.build | 1 + toolkit/components/mozintl/mozIntl.sys.mjs | 2 +- toolkit/components/mozintl/test/test_mozintl.js | 8 +- toolkit/components/narrate/NarrateControls.sys.mjs | 92 ++- .../narrate/test/browser_narrate_toggle.js | 25 +- toolkit/components/nimbus/FeatureManifest.yaml | 321 +++++++-- .../nimbus/generate/generate_feature_manifest.py | 25 +- .../nimbus/lib/ExperimentManager.sys.mjs | 76 ++- .../components/nimbus/lib/ExperimentStore.sys.mjs | 2 +- .../lib/RemoteSettingsExperimentLoader.sys.mjs | 2 +- toolkit/components/nimbus/metrics.yaml | 38 +- .../nimbus/schemas/ExperimentFeature.schema.json | 125 ++++ .../schemas/ExperimentFeatureManifest.schema.json | 123 +--- .../test/unit/test_ExperimentManager_unenroll.js | 112 ++++ .../nimbus/test/unit/test_SharedDataMap.js | 5 +- toolkit/components/normandy/Normandy.sys.mjs | 2 +- .../components/normandy/actions/BaseAction.sys.mjs | 2 +- .../actions/BranchedAddonStudyAction.sys.mjs | 2 +- .../actions/PreferenceExperimentAction.sys.mjs | 2 +- .../normandy/actions/ShowHeartbeatAction.sys.mjs | 5 +- .../components/normandy/lib/AddonStudies.sys.mjs | 2 +- .../normandy/lib/LegacyHeartbeat.sys.mjs | 1 + .../normandy/lib/PreferenceExperiments.sys.mjs | 4 +- .../components/normandy/lib/RecipeRunner.sys.mjs | 4 +- .../test/browser/browser_ActionsManager.js | 2 +- .../normandy/test/browser/browser_BaseAction.js | 4 +- .../test/browser/browser_LegacyHeartbeat.js | 138 +++- .../test/browser/browser_PreferenceExperiments.js | 21 +- .../normandy/test/browser/browser_RecipeRunner.js | 12 +- .../browser_actions_BranchedAddonStudyAction.js | 2 +- .../browser_actions_PreferenceExperimentAction.js | 1 - .../normandy/test/unit/test_NormandyApi.js | 4 +- .../passwordmgr/LoginAutoComplete.sys.mjs | 2 +- toolkit/components/passwordmgr/LoginHelper.sys.mjs | 2 +- .../components/passwordmgr/LoginManager.shared.mjs | 2 +- .../components/passwordmgr/LoginManager.sys.mjs | 2 +- .../passwordmgr/LoginManagerAuthPrompter.sys.mjs | 6 +- .../passwordmgr/LoginManagerChild.sys.mjs | 48 +- .../passwordmgr/LoginManagerContextMenu.sys.mjs | 4 +- .../passwordmgr/LoginManagerPrompter.sys.mjs | 183 +++--- toolkit/components/passwordmgr/nsILoginInfo.idl | 6 - .../passwordmgr/nsILoginManagerAuthPrompter.idl | 5 - .../passwordmgr/nsILoginManagerPrompter.idl | 5 - .../passwordmgr/storage-geckoview.sys.mjs | 14 +- .../passwordmgr/test/browser/browser.toml | 49 +- .../browser_autocomplete_primary_password.js | 2 +- .../test/browser/browser_basicAuth_rateLimit.js | 16 +- .../test/browser/browser_deleteLoginsBackup.js | 2 +- .../test/browser/browser_doorhanger_crossframe.js | 2 +- .../browser_doorhanger_generated_password.js | 4 +- .../test/browser/browser_doorhanger_remembering.js | 52 +- .../test/browser/browser_doorhanger_window_open.js | 4 +- .../test/browser/browser_entry_point_telemetry.js | 2 +- .../test/browser/browser_formless_submit_chrome.js | 10 +- .../test/browser/browser_message_onFormSubmit.js | 2 +- .../test/browser/browser_preselect_login.js | 2 +- .../test/browser/browser_proxyAuth_prompt.js | 8 +- .../test/browser/browser_relay_telemetry.js | 2 +- .../browser_username_only_form_telemetry.js | 14 +- .../passwordmgr/test/mochitest/pwmgr_common.js | 25 +- .../test/mochitest/pwmgr_common_parent.js | 6 +- .../mochitest/test_autofill_https_downgrade.html | 2 +- .../test/mochitest/test_bug_627616.html | 46 +- .../test_dismissed_doorhanger_in_shadow_DOM.html | 8 +- .../test_formLike_rootElement_with_Shadow_DOM.html | 8 +- .../test/mochitest/test_formless_autofill.html | 2 +- .../test_formless_submit_form_removal.html | 14 +- ...test_formless_submit_form_removal_negative.html | 4 +- .../mochitest/test_formless_submit_navigation.html | 6 +- .../test_formless_submit_navigation_negative.html | 10 +- .../test/mochitest/test_munged_values.html | 8 +- .../mochitest/test_one_doorhanger_per_un_pw.html | 5 +- .../test/mochitest/test_password_length.html | 12 +- .../test/mochitest/test_prompt_async.html | 6 +- .../mochitest/test_prompt_promptAuth_proxy.html | 6 +- .../test_submit_without_field_modifications.html | 8 +- .../passwordmgr/test/mochitest/test_xhr.html | 2 +- ...ginManagerParent_onPasswordEditedOrGenerated.js | 11 +- .../passwordmgr/test/unit/test_logins_change.js | 2 +- .../pdfjs/content/GeckoViewPdfjsChild.sys.mjs | 4 +- .../pdfjs/content/GeckoViewPdfjsParent.sys.mjs | 18 +- .../pdfjs/content/PdfJsDefaultPreferences.sys.mjs | 1 + .../pdfjs/content/PdfStreamConverter.sys.mjs | 49 +- .../components/pdfjs/content/PdfjsChild.sys.mjs | 19 +- toolkit/components/pdfjs/content/build/pdf.mjs | 726 ++++++++++++++++----- .../pdfjs/content/build/pdf.scripting.mjs | 4 +- .../components/pdfjs/content/build/pdf.worker.mjs | 114 +++- .../web/images/gv-toolbarButton-openinapp.svg | 11 - .../pdfjs/content/web/viewer-geckoview.css | 8 - .../pdfjs/content/web/viewer-geckoview.html | 3 - .../pdfjs/content/web/viewer-geckoview.mjs | 439 +++++++------ toolkit/components/pdfjs/content/web/viewer.css | 292 ++++++++- toolkit/components/pdfjs/content/web/viewer.html | 19 +- toolkit/components/pdfjs/content/web/viewer.mjs | 451 +++++++------ toolkit/components/pdfjs/jar.mn | 1 - toolkit/components/pdfjs/moz.yaml | 4 +- toolkit/components/pdfjs/test/browser.toml | 2 + .../test/browser_pdfjs_caret_browsing_mode.js | 82 +++ .../pdfjs/test/browser_pdfjs_download_button.js | 2 +- .../test/browser_pdfjs_editing_contextmenu.js | 140 ++-- .../pdfjs/test/browser_pdfjs_nonpdf_filename.js | 2 +- .../pdfjs/test/browser_pdfjs_octet_stream.js | 2 +- .../components/pdfjs/test/browser_pdfjs_saveas.js | 2 +- .../pdfjs/test/browser_pdfjs_stamp_telemetry.js | 2 +- toolkit/components/pdfjs/test/head.js | 22 + .../components/pictureinpicture/content/player.js | 14 +- .../pictureinpicture/content/player.xhtml | 1 + .../tests/browser_cannotTriggerFromContent.js | 2 +- .../browser_closePip_pageNavigationChanges.js | 4 +- .../tests/browser_preserveTabPipIconOverlay.js | 4 +- .../tests/browser_removeVideoElement.js | 2 +- .../pictureinpicture/tests/browser_reversePiP.js | 25 +- .../tests/browser_touch_toggle_enablepip.js | 2 +- .../components/places/BookmarkHTMLUtils.sys.mjs | 2 +- .../components/places/BookmarkJSONUtils.sys.mjs | 23 +- toolkit/components/places/BookmarkList.sys.mjs | 262 ++++++++ toolkit/components/places/Bookmarks.sys.mjs | 158 ++--- toolkit/components/places/Database.cpp | 20 +- toolkit/components/places/Database.h | 1 + toolkit/components/places/Helpers.cpp | 22 + toolkit/components/places/Helpers.h | 8 + toolkit/components/places/History.cpp | 78 ++- toolkit/components/places/History.sys.mjs | 27 +- toolkit/components/places/PlacesBackups.sys.mjs | 2 +- toolkit/components/places/PlacesDBUtils.sys.mjs | 4 +- toolkit/components/places/PlacesExpiration.sys.mjs | 4 +- .../places/PlacesFrecencyRecalculator.sys.mjs | 55 +- toolkit/components/places/PlacesPreviews.sys.mjs | 43 +- toolkit/components/places/PlacesSyncUtils.sys.mjs | 4 +- .../components/places/PlacesTransactions.sys.mjs | 8 +- toolkit/components/places/PlacesUtils.sys.mjs | 81 +-- toolkit/components/places/SQLFunctions.cpp | 20 +- toolkit/components/places/SQLFunctions.h | 8 +- toolkit/components/places/Shutdown.h | 4 +- .../places/SyncedBookmarksMirror.sys.mjs | 2 +- toolkit/components/places/TaggingService.sys.mjs | 2 +- toolkit/components/places/moz.build | 1 + toolkit/components/places/mozIAsyncHistory.idl | 4 +- toolkit/components/places/nsFaviconService.cpp | 64 +- toolkit/components/places/nsINavHistoryService.idl | 2 +- toolkit/components/places/nsITaggingService.idl | 6 - toolkit/components/places/nsPlacesTriggers.h | 2 +- .../places/tests/PlacesTestUtils.sys.mjs | 22 +- .../test_818584-discard-duplicate-backups.js | 2 +- .../bookmarks/test_818593-store-backup-metadata.js | 4 +- .../bookmarks/test_insert_thousands_bookmarks.js | 24 + .../places/tests/bookmarks/xpcshell.toml | 2 + .../components/places/tests/browser/browser.toml | 4 + .../tests/browser/browser_double_redirect.js | 2 +- .../places/tests/browser/browser_favicon.js | 74 +++ .../browser_favicon_privatebrowsing_perwindowpb.js | 2 +- .../places/tests/browser/browser_history_post.js | 2 +- .../places/tests/browser/browser_notfound.js | 2 +- .../places/tests/browser/browser_redirect_self.js | 2 +- .../tests/browser/browser_visited_notfound.js | 2 +- .../places/tests/browser/browser_visituri.js | 238 +++++-- ...browser_visituri_privatebrowsing_perwindowpb.js | 2 +- .../components/places/tests/browser/favicon.html | 5 +- .../places/tests/browser/previews/browser.toml | 2 +- .../components/places/tests/browser/userpass.html | 13 + .../places/tests/chrome/test_371798.xhtml | 2 +- .../places/tests/expiration/test_notifications.js | 2 +- .../places/tests/favicons/head_favicons.js | 11 +- .../favicons/test_cached-favicon_mime_type.js | 60 +- .../tests/favicons/test_page-icon_protocol.js | 62 +- .../favicons/test_setAndFetchFaviconForPage.js | 16 +- .../places/tests/history/test_async_history_api.js | 10 +- .../places/tests/history/test_insertMany.js | 21 +- .../places/tests/history/test_removeByFilter.js | 4 +- .../tests/history/test_removeVisitsByFilter.js | 2 +- .../tests/history/test_updatePlaces_embed.js | 8 +- .../places/tests/migration/places_v75.sqlite | Bin 1507328 -> 0 bytes .../places/tests/migration/places_v77.sqlite | Bin 0 -> 1507328 bytes .../tests/migration/test_current_from_v74.js | 26 +- .../places/tests/migration/xpcshell.toml | 2 +- toolkit/components/places/tests/moz.build | 1 + .../components/places/tests/queries/test_async.js | 2 +- .../queries/test_containersQueries_sorting.js | 4 +- .../tests/queries/test_querySerialization.js | 46 +- .../places/tests/queries/test_redirects.js | 4 +- .../components/places/tests/queries/test_tags.js | 6 +- toolkit/components/places/tests/sync/head_sync.js | 6 +- .../tests/sync/test_bookmark_abort_merging.js | 4 +- .../tests/sync/test_bookmark_observer_recorder.js | 4 +- .../tests/unit/test_asyncExecuteLegacyQueries.js | 4 +- .../places/tests/unit/test_async_transactions.js | 2 +- .../places/tests/unit/test_bookmark_list.js | 115 ++++ .../places/tests/unit/test_bookmarks_html.js | 2 +- .../tests/unit/test_bookmarks_html_corrupt.js | 2 +- .../unit/test_bookmarks_restore_notification.js | 2 +- .../places/tests/unit/test_frecency_decay.js | 2 +- .../places/tests/unit/test_nsINavHistoryViewer.js | 8 +- .../components/places/tests/unit/test_origins.js | 79 ++- .../places/tests/unit/test_origins_parsing.js | 11 +- .../tests/unit/test_tag_autocomplete_search.js | 2 +- toolkit/components/places/tests/unit/xpcshell.toml | 2 + toolkit/components/printing/content/print.js | 2 +- .../printing/tests/browser_preview_navigation.js | 2 +- toolkit/components/printing/tests/head.js | 4 +- toolkit/components/processtools/ProcInfo.h | 12 +- toolkit/components/processtools/ProcInfo.mm | 45 +- toolkit/components/processtools/moz.build | 2 +- .../components/promiseworker/PromiseWorker.sys.mjs | 175 +++-- .../promiseworker/tests/xpcshell/data/worker.js | 13 +- .../promiseworker/tests/xpcshell/test_Promise.js | 48 +- .../worker/PromiseWorker.template.worker.js | 40 +- .../components/prompts/content/commonDialog.css | 9 - toolkit/components/prompts/content/commonDialog.js | 1 - .../components/prompts/content/commonDialog.xhtml | 10 - .../prompts/docs/nsIPromptService-reference.rst | 2 +- .../components/prompts/src/CommonDialog.sys.mjs | 4 - toolkit/components/prompts/src/Prompter.sys.mjs | 5 +- .../prompts/test/PromptTestUtils.sys.mjs | 112 +--- toolkit/components/prompts/test/chromeScript.js | 40 +- toolkit/components/prompts/test/prompt_common.js | 19 +- toolkit/components/remote/nsDBusRemoteServer.cpp | 10 +- toolkit/components/remote/nsDBusRemoteServer.h | 2 +- .../reportbrokensite/ReportBrokenSiteChild.sys.mjs | 118 +--- .../ReportBrokenSiteParent.sys.mjs | 310 +++++---- .../reputationservice/ApplicationReputation.cpp | 28 +- .../reputationservice/ApplicationReputation.h | 4 +- .../resistfingerprinting/RFPHelper.sys.mjs | 2 +- .../components/resistfingerprinting/metrics.yaml | 384 +++++++++++ toolkit/components/resistfingerprinting/moz.build | 12 + .../resistfingerprinting/nsRFPService.cpp | 38 ++ .../resistfingerprinting/nsUserCharacteristics.cpp | 297 +++++++++ .../resistfingerprinting/nsUserCharacteristics.h | 28 + toolkit/components/resistfingerprinting/pings.yaml | 19 + .../resistfingerprinting/tests/gtest/moz.build | 1 + .../tests/gtest/test_usercharping.cpp | 143 ++++ .../components/satchel/FormHandlerChild.sys.mjs | 72 ++ .../components/satchel/FormHistoryChild.sys.mjs | 7 +- .../components/satchel/FormHistoryStartup.sys.mjs | 2 +- toolkit/components/satchel/moz.build | 1 + .../components/satchel/nsFormFillController.cpp | 2 +- .../satchel/test/browser/browser_close_tab.js | 5 +- .../browser/browser_privbrowsing_perwindowpb.js | 2 +- .../satchel/test/test_form_submission.html | 16 +- .../satchel/test/test_popup_enter_event.html | 4 +- .../satchel/test/unit/test_db_corrupt.js | 2 +- .../search/AppProvidedSearchEngine.sys.mjs | 185 ++++-- toolkit/components/search/SearchEngine.sys.mjs | 4 +- toolkit/components/search/SearchService.sys.mjs | 207 +++--- .../search/SearchSuggestionController.sys.mjs | 4 +- toolkit/components/search/SearchUtils.sys.mjs | 4 +- toolkit/components/search/nsISearchService.idl | 2 +- .../schema/search-config-overrides-ui-schema.json | 3 + .../schema/search-config-overrides-v2-schema.json | 1 + .../search-config-overrides-v2-ui-schema.json | 9 + ...earch-default-override-allowlist-ui-schema.json | 2 +- .../search/tests/SearchTestUtils.sys.mjs | 10 +- .../data/search-config-v2-no-order-hint.json | 207 ++++++ .../tests/xpcshell/data/search-config-v2.json | 223 +++++++ .../method-extensions/search-config-v2.json | 83 +++ .../test_searchconfig_ui_schemas_valid.js | 36 + .../searchconfigs/test_searchconfig_validates.js | 191 +++--- .../searchconfigs/test_searchicons_validates.js | 20 - .../tests/xpcshell/searchconfigs/xpcshell.toml | 16 +- .../xpcshell/test-extensions/search-config-v2.json | 139 ++++ .../tests/xpcshell/test_appProvided_icons.js | 211 ++++++ .../tests/xpcshell/test_defaultPrivateEngine.js | 4 +- .../search/tests/xpcshell/test_engine_ids.js | 49 +- .../search/tests/xpcshell/test_engine_set_alias.js | 2 +- .../xpcshell/test_getSubmission_params_pref.js | 9 +- .../test_getSubmission_params_prefNimbus.js | 17 +- ...test_getSubmission_params_prefNimbus_invalid.js | 5 +- .../search/tests/xpcshell/test_initialization.js | 51 +- .../xpcshell/test_initialization_with_region.js | 87 ++- .../tests/xpcshell/test_maybereloadengine_order.js | 54 +- .../search/tests/xpcshell/test_missing_engine.js | 52 +- .../search/tests/xpcshell/test_opensearch_icon.js | 18 +- .../xpcshell/test_opensearch_icons_invalid.js | 6 +- .../xpcshell/test_override_allowlist_switch.js | 12 +- .../search/tests/xpcshell/test_reload_engines.js | 322 ++++++++- .../xpcshell/test_reload_engines_experiment.js | 126 +++- .../tests/xpcshell/test_reload_engines_locales.js | 93 ++- .../test_remove_engine_notification_box.js | 112 +++- .../search/tests/xpcshell/test_searchSuggest.js | 2 +- .../tests/xpcshell/test_searchSuggest_cookies.js | 2 +- .../xpcshell/test_searchSuggest_extraParams.js | 56 +- .../tests/xpcshell/test_searchTermFromResult.js | 169 +++-- .../search/tests/xpcshell/test_settings_persist.js | 62 +- .../tests/xpcshell/test_sort_orders-no-hints.js | 8 +- .../tests/xpcshell/test_telemetry_event_default.js | 206 +++++- .../search/tests/xpcshell/test_validate_engines.js | 56 +- .../tests/xpcshell/test_webextensions_install.js | 22 +- .../test_webextensions_startup_duplicate.js | 6 +- .../components/search/tests/xpcshell/xpcshell.toml | 13 +- .../sessionstore/SessionStoreChangeListener.cpp | 11 +- .../components/taskscheduler/TaskScheduler.sys.mjs | 2 +- .../taskscheduler/TaskSchedulerMacOSImpl.sys.mjs | 2 +- .../taskscheduler/TaskSchedulerWinImpl.sys.mjs | 2 +- toolkit/components/telemetry/Events.yaml | 48 +- toolkit/components/telemetry/Histograms.json | 94 +-- toolkit/components/telemetry/Scalars.yaml | 40 +- .../components/telemetry/TelemetryStartup.sys.mjs | 4 +- .../app/TelemetryControllerContent.sys.mjs | 2 +- .../telemetry/app/TelemetryEnvironment.sys.mjs | 2 +- .../telemetry/app/TelemetryReportingPolicy.sys.mjs | 5 +- .../telemetry/app/TelemetryScheduler.sys.mjs | 2 +- .../telemetry/app/TelemetryStorage.sys.mjs | 6 +- .../telemetry/dap/DAPTelemetrySender.sys.mjs | 2 +- .../telemetry/dap/DAPVisitCounter.sys.mjs | 2 +- .../components/telemetry/docs/data/health-ping.rst | 2 +- .../telemetry/docs/obsolete/fhr/architecture.rst | 6 +- .../telemetry/docs/obsolete/fhr/dataformat.rst | 2 +- .../components/telemetry/pings/EventPing.sys.mjs | 2 +- .../telemetry/pings/TelemetrySession.sys.mjs | 2 +- .../tests/browser/browser_DynamicScalars.js | 2 +- .../telemetry/tests/integration/tests/conftest.py | 8 +- .../marionette/harness/telemetry_harness/runner.py | 3 + .../harness/telemetry_harness/testcase.py | 12 +- .../tests/client/test_deletion_request_ping.py | 4 +- .../tests/client/test_main_tab_scalars.py | 4 +- .../data/search-extensions/search-config-v2.json | 40 ++ toolkit/components/telemetry/tests/unit/head.js | 6 +- .../telemetry/tests/unit/test_EventPing.js | 8 +- .../tests/unit/test_TelemetryController.js | 2 +- .../tests/unit/test_TelemetryEnvironment.js | 17 +- .../tests/unit/test_TelemetryEnvironment_search.js | 13 +- .../telemetry/tests/unit/test_TelemetryEvents.js | 2 +- .../tests/unit/test_TelemetryHistograms.js | 6 +- .../tests/unit/test_TelemetryLateWrites.js | 8 +- .../tests/unit/test_TelemetrySendOldPings.js | 2 +- .../telemetry/tests/unit/test_TelemetrySession.js | 10 +- .../components/telemetry/tests/unit/xpcshell.toml | 1 + toolkit/components/terminator/nsTerminator.cpp | 6 +- .../tooltiptext/TooltipTextProvider.sys.mjs | 227 +++---- toolkit/components/tooltiptext/tests/browser.toml | 2 + .../tests/browser_input_file_tooltips.js | 4 +- .../tooltiptext/tests/browser_nac_tooltip.js | 66 ++ .../tests/browser_shadow_dom_tooltip.js | 2 +- .../translations/TranslationsTelemetry.sys.mjs | 3 + .../actors/AboutTranslationsChild.sys.mjs | 12 +- .../actors/AboutTranslationsParent.sys.mjs | 6 +- .../translations/actors/TranslationsChild.sys.mjs | 1 + .../actors/TranslationsEngineChild.sys.mjs | 6 +- .../actors/TranslationsEngineParent.sys.mjs | 13 +- .../translations/actors/TranslationsParent.sys.mjs | 219 +++---- .../content/translations-document.sys.mjs | 74 ++- .../content/translations-engine.sys.mjs | 8 +- .../translations/content/translations.mjs | 7 +- .../browser_translations_translation_document.js | 100 +++ .../translations/tests/browser/shared-head.js | 142 ++-- .../tests/browser/translations-test.mjs | 2 +- toolkit/components/translations/translations.d.ts | 2 +- toolkit/components/uniffi-js/UniFFIPointer.cpp | 38 +- .../UrlClassifierHashCompleter.sys.mjs | 4 +- .../url-classifier/UrlClassifierLib.sys.mjs | 2 +- .../UrlClassifierListManager.sys.mjs | 2 +- .../UrlClassifierRemoteSettingsService.sys.mjs | 2 +- .../url-classifier/nsIUrlListManager.idl | 2 +- .../tests/UrlClassifierTestUtils.sys.mjs | 8 +- .../tests/mochitest/allowlistAnnotatedFrame.html | 2 +- .../tests/mochitest/classifiedAnnotatedFrame.html | 2 +- .../tests/mochitest/classifierCommon.js | 6 +- .../tests/mochitest/classifierHelper.js | 4 +- .../url-classifier/tests/mochitest/dnt.html | 2 +- .../url-classifier/tests/mochitest/features.js | 2 +- .../url-classifier/tests/mochitest/head.js | 2 +- .../tests/mochitest/test_bug1254766.html | 4 +- .../tests/mochitest/test_cachemiss.html | 4 +- .../mochitest/test_classified_annotations.html | 2 +- .../mochitest/test_classifier_changetablepref.html | 6 +- .../tests/mochitest/test_classify_by_default.html | 2 +- .../tests/mochitest/test_classify_ping.html | 6 +- .../mochitest/test_classify_top_sandboxed.html | 2 +- .../tests/mochitest/test_classify_track.html | 6 +- .../tests/mochitest/test_donottrack.html | 2 +- .../tests/mochitest/test_gethash.html | 2 +- .../test_privatebrowsing_trackingprotection.html | 2 +- .../tests/mochitest/test_reporturl.html | 4 +- .../tests/mochitest/test_threathit_report.html | 4 +- .../test_trackingprotection_bug1312515.html | 8 +- .../test_trackingprotection_bug1580416.html | 2 +- .../test_trackingprotection_whitelist.html | 2 +- .../tests/mochitest/workerFrame.html | 10 +- .../tests/unit/head_urlclassifier.js | 10 +- .../tests/unit/test_channelClassifierService.js | 20 +- .../url-classifier/tests/unit/test_dbservice.js | 2 +- .../tests/unit/test_hashcompleter.js | 4 +- .../url-classifier/tests/unit/test_partial.js | 2 +- .../tests/unit/test_rsListService.js | 24 +- .../tests/unit/test_shouldclassify.js | 6 +- toolkit/components/utils/ClientEnvironment.sys.mjs | 2 +- toolkit/components/utils/FilterExpressions.sys.mjs | 6 +- .../components/utils/JsonSchemaValidator.sys.mjs | 2 +- toolkit/components/utils/moz.build | 2 +- toolkit/components/utils/mozjexl.js | 1 - toolkit/components/utils/mozjexl.sys.mjs | 1 + .../components/windowcreator/nsIWindowCreator.idl | 6 - toolkit/components/windowwatcher/moz.build | 1 - .../components/windowwatcher/nsIPromptService.idl | 2 +- .../components/windowwatcher/nsPIPromptService.idl | 30 - 884 files changed, 17447 insertions(+), 7317 deletions(-) create mode 100644 toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js create mode 100644 toolkit/components/contentanalysis/tests/browser/browser.toml create mode 100644 toolkit/components/contentanalysis/tests/browser/browser_content_analysis_policies.js create mode 100644 toolkit/components/contentanalysis/tests/browser/moz.build delete mode 100644 toolkit/components/contentanalysis/tests/gtest/TestContentAnalysis.h create mode 100644 toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisAgent.cpp create mode 100644 toolkit/components/contentanalysis/tests/gtest/TestContentAnalysisAgent.h create mode 100644 toolkit/components/contentanalysis/tests/moz.build delete mode 100644 toolkit/components/formautofill/AutofillTelemetry.sys.mjs delete mode 100644 toolkit/components/formautofill/phonenumberutils/PhoneNumber.sys.mjs delete mode 100644 toolkit/components/formautofill/phonenumberutils/PhoneNumberMetaData.sys.mjs delete mode 100644 toolkit/components/formautofill/phonenumberutils/PhoneNumberNormalizer.sys.mjs create mode 100644 toolkit/components/formautofill/shared/AddressRecord.sys.mjs create mode 100644 toolkit/components/formautofill/shared/AutofillTelemetry.sys.mjs create mode 100644 toolkit/components/formautofill/shared/PhoneNumber.sys.mjs create mode 100644 toolkit/components/formautofill/shared/PhoneNumberMetaData.sys.mjs create mode 100644 toolkit/components/formautofill/shared/PhoneNumberNormalizer.sys.mjs create mode 100644 toolkit/components/glean/api/src/ffi/object.rs create mode 100644 toolkit/components/glean/api/src/private/object.rs create mode 100644 toolkit/components/glean/bindings/private/Object.cpp create mode 100644 toolkit/components/glean/bindings/private/Object.h create mode 100644 toolkit/components/glean/build_scripts/glean_parser_ext/templates/ohttp.jinja2 create mode 100644 toolkit/components/glean/src/ohttp_pings.rs create mode 100644 toolkit/components/glean/tests/xpcshell/test_OHTTP.js create mode 100644 toolkit/components/ml/actors/MLEngineChild.sys.mjs create mode 100644 toolkit/components/ml/actors/MLEngineParent.sys.mjs create mode 100644 toolkit/components/ml/actors/moz.build create mode 100644 toolkit/components/ml/content/EngineProcess.sys.mjs create mode 100644 toolkit/components/ml/content/MLEngine.html create mode 100644 toolkit/components/ml/content/MLEngine.worker.mjs create mode 100644 toolkit/components/ml/content/SummarizerModel.sys.mjs create mode 100644 toolkit/components/ml/docs/index.md create mode 100644 toolkit/components/ml/jar.mn create mode 100644 toolkit/components/ml/moz.build create mode 100644 toolkit/components/ml/tests/browser/browser.toml create mode 100644 toolkit/components/ml/tests/browser/browser_ml_engine.js create mode 100644 toolkit/components/ml/tests/browser/head.js create mode 100644 toolkit/components/nimbus/schemas/ExperimentFeature.schema.json delete mode 100644 toolkit/components/pdfjs/content/web/images/gv-toolbarButton-openinapp.svg create mode 100644 toolkit/components/pdfjs/test/browser_pdfjs_caret_browsing_mode.js create mode 100644 toolkit/components/places/BookmarkList.sys.mjs create mode 100644 toolkit/components/places/tests/bookmarks/test_insert_thousands_bookmarks.js create mode 100644 toolkit/components/places/tests/browser/browser_favicon.js create mode 100644 toolkit/components/places/tests/browser/userpass.html delete mode 100644 toolkit/components/places/tests/migration/places_v75.sqlite create mode 100644 toolkit/components/places/tests/migration/places_v77.sqlite create mode 100644 toolkit/components/places/tests/unit/test_bookmark_list.js create mode 100644 toolkit/components/resistfingerprinting/nsUserCharacteristics.cpp create mode 100644 toolkit/components/resistfingerprinting/nsUserCharacteristics.h create mode 100644 toolkit/components/resistfingerprinting/pings.yaml create mode 100644 toolkit/components/resistfingerprinting/tests/gtest/test_usercharping.cpp create mode 100644 toolkit/components/satchel/FormHandlerChild.sys.mjs create mode 100644 toolkit/components/search/schema/search-config-overrides-ui-schema.json create mode 100644 toolkit/components/search/schema/search-config-overrides-v2-ui-schema.json create mode 100644 toolkit/components/search/tests/xpcshell/data/search-config-v2-no-order-hint.json create mode 100644 toolkit/components/search/tests/xpcshell/data/search-config-v2.json create mode 100644 toolkit/components/search/tests/xpcshell/method-extensions/search-config-v2.json create mode 100644 toolkit/components/search/tests/xpcshell/searchconfigs/test_searchconfig_ui_schemas_valid.js delete mode 100644 toolkit/components/search/tests/xpcshell/searchconfigs/test_searchicons_validates.js create mode 100644 toolkit/components/search/tests/xpcshell/test-extensions/search-config-v2.json create mode 100644 toolkit/components/search/tests/xpcshell/test_appProvided_icons.js create mode 100644 toolkit/components/telemetry/tests/unit/data/search-extensions/search-config-v2.json create mode 100644 toolkit/components/tooltiptext/tests/browser_nac_tooltip.js delete mode 100644 toolkit/components/utils/mozjexl.js create mode 100644 toolkit/components/utils/mozjexl.sys.mjs delete mode 100644 toolkit/components/windowwatcher/nsPIPromptService.idl (limited to 'toolkit/components') diff --git a/toolkit/components/aboutconfig/content/aboutconfig.js b/toolkit/components/aboutconfig/content/aboutconfig.js index e11021ed64..5e67b764b5 100644 --- a/toolkit/components/aboutconfig/content/aboutconfig.js +++ b/toolkit/components/aboutconfig/content/aboutconfig.js @@ -255,6 +255,7 @@ class PrefRow { if (this.editing) { this.inputField = document.createElement("input"); this.inputField.value = this.value; + this.inputField.ariaLabel = this.name; if (this.type == "Number") { this.inputField.type = "number"; this.inputField.required = true; diff --git a/toolkit/components/aboutconfig/test/browser/browser.toml b/toolkit/components/aboutconfig/test/browser/browser.toml index acccf1f8f0..a0cce686b8 100644 --- a/toolkit/components/aboutconfig/test/browser/browser.toml +++ b/toolkit/components/aboutconfig/test/browser/browser.toml @@ -11,10 +11,9 @@ support-files = ["head.js"] ["browser_basic.js"] ["browser_clipboard.js"] -fail-if = ["a11y_checks"] # Bug 1854447 th, td.cell-value, #prefs may not be focusable; #show-all may be unlabeled ["browser_edit.js"] -fail-if = ["a11y_checks"] # Bug 1854447 span, th, td.cell-value may not be focusable; #show-all, input, button-add/delete/reset ghost-buttons may not be labeled +fail-if = ["a11y_checks"] # Bugs 1854447 and 1882380 span may not be focusable skip-if = ["os == 'linux' && ccov"] # Bug 1613515, the test consistently times out on Linux coverage builds. ["browser_locked.js"] diff --git a/toolkit/components/aboutconfig/test/browser/browser_clipboard.js b/toolkit/components/aboutconfig/test/browser/browser_clipboard.js index bcaa2c0328..a8fca568c7 100644 --- a/toolkit/components/aboutconfig/test/browser/browser_clipboard.js +++ b/toolkit/components/aboutconfig/test/browser/browser_clipboard.js @@ -33,6 +33,14 @@ add_task(async function test_copy() { let selectText = async target => { let { width, height } = target.getBoundingClientRect(); + + // We intentionally turn off this a11y check, because the following + // series of mouse events is purposefully targeting a non-interactive + // text content. This action does not require the element to have an + // interactive accessible to be done by assistive technology with caret + // browsing (when/if supported), this rule check shall be ignored by + // a11y_checks suite. + AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false }); EventUtils.synthesizeMouse( target, 1, @@ -54,6 +62,7 @@ add_task(async function test_copy() { { type: "mouseup" }, this.browser.contentWindow ); + AccessibilityUtils.resetEnv(); }; // Drag across the name cell. @@ -107,6 +116,13 @@ add_task(async function test_copy_multiple() { let { width, height } = endRow.valueCell.getBoundingClientRect(); // Drag from the top left of the first row to the bottom right of the last. + // We intentionally turn off this a11y check, because the following + // series of mouse events is purposefully targeting a non-interactive + // text content. This action does not require the element to have an + // interactive accessible to be done by assistive technology with caret + // browsing (when/if supported), this rule check shall be ignored by + // a11y_checks suite. + AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false }); EventUtils.synthesizeMouse( startRow.nameCell, 1, @@ -129,6 +145,7 @@ add_task(async function test_copy_multiple() { { type: "mouseup" }, this.browser.contentWindow ); + AccessibilityUtils.resetEnv(); await SimpleTest.promiseClipboardChange(expectedString, async () => { await BrowserTestUtils.synthesizeKey( diff --git a/toolkit/components/aboutconfig/test/browser/browser_edit.js b/toolkit/components/aboutconfig/test/browser/browser_edit.js index 9d10fb1e75..24fb168e76 100644 --- a/toolkit/components/aboutconfig/test/browser/browser_edit.js +++ b/toolkit/components/aboutconfig/test/browser/browser_edit.js @@ -282,6 +282,11 @@ add_task(async function test_edit_field_selected() { Assert.equal(row.value, startValue); row.editColumnButton.click(); Assert.equal(row.valueInput.value, startValue); + Assert.equal( + row.valueInput.getAttribute("aria-label"), + prefName, + "The input field is labeled from the pref name" + ); EventUtils.sendString(endValue, this.window); @@ -334,15 +339,31 @@ add_task(async function test_double_click_modify() { let click = (target, opts) => EventUtils.synthesizeMouseAtCenter(target, opts, this.window); let doubleClick = target => { + // We intentionally turn off this a11y check, because the following series + // of clicks (in these test cases) is either performing an activation of + // the edit mode for prefs or selecting a text in focused inputs. The + // edit mode can be activated with a separate "Edit" or "Toggle" button + // provided for each pref, and the text selection can be performed with + // caret browsing (when supported). Thus, this rule check can be ignored + // by a11y_checks suite. + AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false }); // Trigger two mouse events to simulate the first then second click. click(target, { clickCount: 1 }); click(target, { clickCount: 2 }); + AccessibilityUtils.resetEnv(); }; let tripleClick = target => { + // We intentionally turn off this a11y check, because the following series + // of clicks is purposefully targeting a non - interactive text content. + // This action does not require the element to have an interactive + // accessible to be done by assistive technology with caret browsing + // (when supported), this rule check shall be ignored by a11y_checks suite. + AccessibilityUtils.setEnv({ mustHaveAccessibleRule: false }); // Trigger all 3 mouse events to simulate the three mouse events we'd see. click(target, { clickCount: 1 }); click(target, { clickCount: 2 }); click(target, { clickCount: 3 }); + AccessibilityUtils.resetEnv(); }; // Check double-click to edit a boolean. diff --git a/toolkit/components/aboutmemory/content/aboutMemory.js b/toolkit/components/aboutmemory/content/aboutMemory.js index da2fd560d2..049818263f 100644 --- a/toolkit/components/aboutmemory/content/aboutMemory.js +++ b/toolkit/components/aboutmemory/content/aboutMemory.js @@ -2469,7 +2469,11 @@ function saveReportsToFile() { }; try { - fp.init(window, "Save Memory Reports", Ci.nsIFilePicker.modeSave); + fp.init( + window.browsingContext, + "Save Memory Reports", + Ci.nsIFilePicker.modeSave + ); } catch (ex) { // This will fail on Android, since there is no Save as file picker there. // Just save to the default downloads dir if it does. diff --git a/toolkit/components/antitracking/ContentBlockingAllowList.cpp b/toolkit/components/antitracking/ContentBlockingAllowList.cpp index 25806cd1e7..660906a49c 100644 --- a/toolkit/components/antitracking/ContentBlockingAllowList.cpp +++ b/toolkit/components/antitracking/ContentBlockingAllowList.cpp @@ -17,7 +17,9 @@ #include "nsICookieJarSettings.h" #include "nsIHttpChannel.h" #include "nsIHttpChannelInternal.h" +#include "nsIPermission.h" #include "nsNetUtil.h" +#include "nsString.h" using namespace mozilla; @@ -255,3 +257,70 @@ nsresult ContentBlockingAllowList::Check( returnInputArgument.release(); principal.forget(aPrincipal); } + +// ContentBlockingAllowListCache + +nsresult ContentBlockingAllowListCache::CheckForBaseDomain( + const nsACString& aBaseDomain, const OriginAttributes& aOriginAttributes, + bool& aIsAllowListed) { + MOZ_ASSERT(XRE_IsParentProcess()); + NS_ENSURE_TRUE(!aBaseDomain.IsEmpty(), NS_ERROR_INVALID_ARG); + aIsAllowListed = false; + + // Ensure we have the permission list. + nsresult rv = EnsureInit(); + NS_ENSURE_SUCCESS(rv, rv); + + if (aOriginAttributes.mPrivateBrowsingId > 0) { + aIsAllowListed = mEntriesPrivateBrowsing.Contains(aBaseDomain); + } else { + aIsAllowListed = mEntries.Contains(aBaseDomain); + } + + return NS_OK; +} + +nsresult ContentBlockingAllowListCache::EnsureInit() { + MOZ_ASSERT(XRE_IsParentProcess()); + + if (mIsInitialized) { + return NS_OK; + } + mIsInitialized = true; + + // 1. Get all permissions representing allow-list entries. + PermissionManager* permManager = PermissionManager::GetInstance(); + NS_ENSURE_TRUE(permManager, NS_ERROR_FAILURE); + + nsTArray types; + types.AppendElement("trackingprotection"); + types.AppendElement("trackingprotection-pb"); + + nsTArray> permissions; + nsresult rv = permManager->GetAllByTypes(types, permissions); + NS_ENSURE_SUCCESS(rv, rv); + + // 2. Populate mEntries and mEntriesPrivateBrowsing from permission list for + // faster lookup. + for (auto& permission : permissions) { + MOZ_ASSERT(permission); + + nsCOMPtr principal; + rv = permission->GetPrincipal(getter_AddRefs(principal)); + NS_ENSURE_SUCCESS(rv, rv); + MOZ_ASSERT(principal); + + nsAutoCString baseDomain; + rv = principal->GetBaseDomain(baseDomain); + NS_ENSURE_SUCCESS(rv, rv); + + // Sort base domains into sets for normal / private browsing. + if (principal->OriginAttributesRef().mPrivateBrowsingId > 0) { + mEntriesPrivateBrowsing.Insert(baseDomain); + } else { + mEntries.Insert(baseDomain); + } + } + + return NS_OK; +} diff --git a/toolkit/components/antitracking/ContentBlockingAllowList.h b/toolkit/components/antitracking/ContentBlockingAllowList.h index 2601173db7..1db29f3e35 100644 --- a/toolkit/components/antitracking/ContentBlockingAllowList.h +++ b/toolkit/components/antitracking/ContentBlockingAllowList.h @@ -9,6 +9,8 @@ #include "mozilla/dom/BrowsingContext.h" #include "nsIContentBlockingAllowList.h" +#include "nsIPermission.h" +#include "nsTHashSet.h" class nsICookieJarSettings; class nsIHttpChannel; @@ -19,7 +21,59 @@ class nsPIDOMWindowInner; namespace mozilla { class OriginAttributes; -struct ContentBlockingAllowListCache; + +/** + * @class ContentBlockingAllowListCache + * + * @brief This class represents a cache for the content blocking allow list. It + * is used for repeated lookups of the allow list for a specific base + * domain. Only use it if you need base domain lookups. In most cases + * this is not what you want. For regular allow-list checks by principal + * please use ContentBlockingAllowList. + */ +class ContentBlockingAllowListCache final { + public: + /** + * @brief Checks if a given base domain is allow-listed. This method considers + * the domain to be allow list if either the base domain or any of its + * subdomains are allow-listed. + * This is different from regular allow-list checks, + * @see{ContentBlockingAllowList::Check} where allow-listed state is only + * inherited to subdomains if the base domain is allow-listed. + * + * Example: + * If "example.com" is allow-listed, then "www.example.com" is also + * considered allow-listed. + * If foobar.example.org is allow-listed, then "example.org" is not + * considered allow-listed. + * + * @param aBaseDomain The base domain to check. + * @param aOriginAttributes The origin attributes associated with the base + * domain. + * @param aIsAllowListed [out] Set to true if the base domain is allow-listed, + * false otherwise. + * + * @return NS_OK if the check is successful, or an error code otherwise. + */ + nsresult CheckForBaseDomain(const nsACString& aBaseDomain, + const OriginAttributes& aOriginAttributes, + bool& aIsAllowListed); + + private: + bool mIsInitialized = false; + + // The cache is a hash set of base domains. If a base domain is in the set, it + // is allow-listed for that context (normal browsing, private browsing.) + nsTHashSet mEntries; + nsTHashSet mEntriesPrivateBrowsing; + + /** + * @brief Initializes the content blocking allow list cache if needed. + * + * @return NS_OK if initialization is successful, or an error code otherwise. + */ + nsresult EnsureInit(); +}; class ContentBlockingAllowList final : public nsIContentBlockingAllowList { public: diff --git a/toolkit/components/antitracking/ContentBlockingAllowList.sys.mjs b/toolkit/components/antitracking/ContentBlockingAllowList.sys.mjs index af1028083c..7efb0e7810 100644 --- a/toolkit/components/antitracking/ContentBlockingAllowList.sys.mjs +++ b/toolkit/components/antitracking/ContentBlockingAllowList.sys.mjs @@ -26,7 +26,7 @@ export const ContentBlockingAllowList = { "nsISupportsWeakReference", ]), - observe(subject, topic, data) { + observe(subject, topic) { if (topic == "last-pb-context-exited") { Services.perms.removeByType("trackingprotection-pb"); } diff --git a/toolkit/components/antitracking/PurgeTrackerService.sys.mjs b/toolkit/components/antitracking/PurgeTrackerService.sys.mjs index 08b5612287..458a35fef3 100644 --- a/toolkit/components/antitracking/PurgeTrackerService.sys.mjs +++ b/toolkit/components/antitracking/PurgeTrackerService.sys.mjs @@ -52,7 +52,7 @@ PurgeTrackerService.prototype = { // protection list, so we cache the result for faster future lookups. _trackingState: new Map(), - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { switch (aTopic) { case "idle-daily": // only allow one idle-daily listener to trigger until the list has been fully parsed. diff --git a/toolkit/components/antitracking/URLDecorationAnnotationsService.sys.mjs b/toolkit/components/antitracking/URLDecorationAnnotationsService.sys.mjs index ca285e972d..e445c8ec33 100644 --- a/toolkit/components/antitracking/URLDecorationAnnotationsService.sys.mjs +++ b/toolkit/components/antitracking/URLDecorationAnnotationsService.sys.mjs @@ -40,7 +40,7 @@ URLDecorationAnnotationsService.prototype = { branch.lockPref(PREF_NAME); }, - observe(aSubject, aTopic, aData) { + observe(aSubject, aTopic) { if (aTopic == "profile-after-change") { this.ensureUpdated(); } diff --git a/toolkit/components/antitracking/URLQueryStringStripper.cpp b/toolkit/components/antitracking/URLQueryStringStripper.cpp index 3b46738280..2e154b9103 100644 --- a/toolkit/components/antitracking/URLQueryStringStripper.cpp +++ b/toolkit/components/antitracking/URLQueryStringStripper.cpp @@ -98,7 +98,7 @@ URLQueryStringStripper::StripForCopyOrShare(nsIURI* aURI, URLParams params; - URLParams::Parse(query, [&](nsString&& name, nsString&& value) { + URLParams::Parse(query, true, [&](nsString&& name, nsString&& value) { nsAutoString lowerCaseName; ToLowerCase(name, lowerCaseName); // Look through the global rules. @@ -308,7 +308,7 @@ nsresult URLQueryStringStripper::StripQueryString(nsIURI* aURI, URLParams params; - URLParams::Parse(query, [&](nsString&& name, nsString&& value) { + URLParams::Parse(query, false, [&](nsString&& name, nsString&& value) { nsAutoString lowerCaseName; ToLowerCase(name, lowerCaseName); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.cpp index e5d9ccfea9..2b0577d5c6 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.cpp +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.cpp @@ -12,6 +12,7 @@ #include "ErrorList.h" #include "mozilla/AlreadyAddRefed.h" #include "mozilla/ClearOnShutdown.h" +#include "mozilla/ContentBlockingAllowList.h" #include "mozilla/Logging.h" #include "mozilla/Services.h" #include "mozilla/StaticPrefs_privacy.h" @@ -122,7 +123,7 @@ nsresult BounceTrackingProtection::RecordStatefulBounces( aBounceTrackingState->Describe().get())); // Assert: navigable’s bounce tracking record is not null. - BounceTrackingRecord* record = + const Maybe& record = aBounceTrackingState->GetBounceTrackingRecord(); NS_ENSURE_TRUE(record, NS_ERROR_FAILURE); @@ -368,6 +369,11 @@ BounceTrackingProtection::TestRunPurgeBounceTrackers( return NS_OK; } +NS_IMETHODIMP +BounceTrackingProtection::TestClearExpiredUserActivations() { + return ClearExpiredUserInteractions(); +} + NS_IMETHODIMP BounceTrackingProtection::TestAddBounceTrackerCandidate( JS::Handle aOriginAttributes, const nsACString& aHost, @@ -415,6 +421,22 @@ BounceTrackingProtection::TestAddUserActivation( RefPtr BounceTrackingProtection::PurgeBounceTrackers() { + // Prevent multiple purge operations from running at the same time. + if (mPurgeInProgress) { + MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, + ("%s: Skip: Purge already in progress.", __FUNCTION__)); + return PurgeBounceTrackersMozPromise::CreateAndReject( + nsresult::NS_ERROR_NOT_AVAILABLE, __func__); + } + mPurgeInProgress = true; + + // Obtain a cache of ContentBlockingAllowList permissions so we only need to + // fetch permissions once even when we do multiple base domain lookups. + ContentBlockingAllowListCache contentBlockingAllowListCache; + + // Collect promises for all clearing operations to later await on. + nsTArray> clearPromises; + // Run the purging algorithm for all global state objects. for (const auto& entry : mStorage->StateGlobalMapRef()) { const OriginAttributes& originAttributes = entry.GetKey(); @@ -429,13 +451,17 @@ BounceTrackingProtection::PurgeBounceTrackers() { oaSuffix.get())); } - PurgeBounceTrackersForStateGlobal(stateGlobal, originAttributes); + nsresult rv = PurgeBounceTrackersForStateGlobal( + stateGlobal, contentBlockingAllowListCache, clearPromises); + if (NS_WARN_IF(NS_FAILED(rv))) { + return PurgeBounceTrackersMozPromise::CreateAndReject(rv, __func__); + } } // Wait for all data clearing operations to complete. mClearPromises contains // one promise per host / clear task. return ClearDataMozPromise::AllSettled(GetCurrentSerialEventTarget(), - mClearPromises) + clearPromises) ->Then( GetCurrentSerialEventTarget(), __func__, [&](ClearDataMozPromise::AllSettledPromiseType::ResolveOrRejectValue&& @@ -450,7 +476,7 @@ BounceTrackingProtection::PurgeBounceTrackers() { // If any clear call failed reject. for (auto& result : aResults.ResolveValue()) { if (result.IsReject()) { - mClearPromises.Clear(); + mPurgeInProgress = false; return PurgeBounceTrackersMozPromise::CreateAndReject( NS_ERROR_FAILURE, __func__); } @@ -458,7 +484,8 @@ BounceTrackingProtection::PurgeBounceTrackers() { } // No clearing errors, resolve. - mClearPromises.Clear(); + + mPurgeInProgress = false; return PurgeBounceTrackersMozPromise::CreateAndResolve( std::move(purgedSiteHosts), __func__); }); @@ -466,34 +493,17 @@ BounceTrackingProtection::PurgeBounceTrackers() { nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal( BounceTrackingStateGlobal* aStateGlobal, - const OriginAttributes& aOriginAttributes) { + ContentBlockingAllowListCache& aContentBlockingAllowList, + nsTArray>& aClearPromises) { MOZ_ASSERT(aStateGlobal); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, - ("%s: #mUserActivation: %d, #mBounceTrackers: %d", __FUNCTION__, - aStateGlobal->UserActivationMapRef().Count(), - aStateGlobal->BounceTrackersMapRef().Count())); - - // Purge already in progress. - if (!mClearPromises.IsEmpty()) { - MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, - ("%s: Skip: Purge already in progress.", __FUNCTION__)); - return NS_ERROR_NOT_AVAILABLE; - } + ("%s: %s", __FUNCTION__, aStateGlobal->Describe().get())); const PRTime now = PR_Now(); - // Convert the user activation lifetime into microseconds for calculation with - // PRTime values. The pref is a 32-bit value. Cast into 64-bit before - // multiplying so we get the correct result. - int64_t activationLifetimeUsec = - static_cast( - StaticPrefs:: - privacy_bounceTrackingProtection_bounceTrackingActivationLifetimeSec()) * - PR_USEC_PER_SEC; // 1. Remove hosts from the user activation map whose user activation flag has // expired. - nsresult rv = - aStateGlobal->ClearUserActivationBefore(now - activationLifetimeUsec); + nsresult rv = ClearExpiredUserInteractions(aStateGlobal); NS_ENSURE_SUCCESS(rv, rv); // 2. Go over bounce tracker candidate map and purge state. @@ -502,7 +512,6 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal( do_GetService("@mozilla.org/clear-data-service;1", &rv); NS_ENSURE_SUCCESS(rv, rv); - mClearPromises.Clear(); nsTArray purgedSiteHosts; // Collect hosts to remove from the bounce trackers map. We can not remove @@ -545,6 +554,27 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal( continue; } + // Gecko specific: If the host is on the content blocking allow-list, + // continue. + bool isAllowListed = false; + rv = aContentBlockingAllowList.CheckForBaseDomain( + host, aStateGlobal->OriginAttributesRef(), isAllowListed); + if (NS_WARN_IF(NS_FAILED(rv))) { + continue; + } + if (isAllowListed) { + if (MOZ_LOG_TEST(gBounceTrackingProtectionLog, LogLevel::Debug)) { + nsAutoCString originAttributeSuffix; + aStateGlobal->OriginAttributesRef().CreateSuffix(originAttributeSuffix); + MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, + ("%s: Skip host on the content blocking allow-list: host: %s, " + "originAttributes: %s", + __FUNCTION__, PromiseFlatCString(host).get(), + originAttributeSuffix.get())); + } + continue; + } + // No exception above applies, clear state for the given host. RefPtr clearPromise = @@ -562,7 +592,7 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal( clearPromise->Reject(0, __func__); } - mClearPromises.AppendElement(clearPromise); + aClearPromises.AppendElement(clearPromise); // Remove it from the bounce trackers map, it's about to be purged. If the // clear call fails still remove it. We want to avoid an ever growing list @@ -575,6 +605,43 @@ nsresult BounceTrackingProtection::PurgeBounceTrackersForStateGlobal( return aStateGlobal->RemoveBounceTrackers(bounceTrackerCandidatesToRemove); } +nsresult BounceTrackingProtection::ClearExpiredUserInteractions( + BounceTrackingStateGlobal* aStateGlobal) { + if (!aStateGlobal && mStorage->StateGlobalMapRef().IsEmpty()) { + // Nothing to clear. + return NS_OK; + } + + const PRTime now = PR_Now(); + + // Convert the user activation lifetime into microseconds for calculation with + // PRTime values. The pref is a 32-bit value. Cast into 64-bit before + // multiplying so we get the correct result. + int64_t activationLifetimeUsec = + static_cast( + StaticPrefs:: + privacy_bounceTrackingProtection_bounceTrackingActivationLifetimeSec()) * + PR_USEC_PER_SEC; + + // Clear user activation for the given state global. + if (aStateGlobal) { + return aStateGlobal->ClearUserActivationBefore(now - + activationLifetimeUsec); + } + + // aStateGlobal not passed, clear user activation for all state globals. + for (const auto& entry : mStorage->StateGlobalMapRef()) { + const RefPtr& stateGlobal = entry.GetData(); + MOZ_ASSERT(stateGlobal); + + nsresult rv = + stateGlobal->ClearUserActivationBefore(now - activationLifetimeUsec); + NS_ENSURE_SUCCESS(rv, rv); + } + + return NS_OK; +} + // ClearDataCallback NS_IMPL_ISUPPORTS(BounceTrackingProtection::ClearDataCallback, diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.h b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.h index 98c61504c0..e99cf895be 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.h +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingProtection.h @@ -17,6 +17,7 @@ namespace mozilla { class BounceTrackingState; class BounceTrackingStateGlobal; class BounceTrackingProtectionStorage; +class ContentBlockingAllowListCache; class OriginAttributes; extern LazyLogModule gBounceTrackingProtectionLog; @@ -33,10 +34,17 @@ class BounceTrackingProtection final : public nsIBounceTrackingProtection { // navigation start for bounce tracking, or if the client bounce detection // timer expires after process response received for bounce tracking without // observing a client redirect. - nsresult RecordStatefulBounces(BounceTrackingState* aBounceTrackingState); + [[nodiscard]] nsresult RecordStatefulBounces( + BounceTrackingState* aBounceTrackingState); // Stores a user activation flag with a timestamp for the given principal. - nsresult RecordUserActivation(nsIPrincipal* aPrincipal); + [[nodiscard]] nsresult RecordUserActivation(nsIPrincipal* aPrincipal); + + // Clears expired user interaction flags for the given state global. If + // aStateGlobal == nullptr, clears expired user interaction flags for all + // state globals. + [[nodiscard]] nsresult ClearExpiredUserInteractions( + BounceTrackingStateGlobal* aStateGlobal = nullptr); private: BounceTrackingProtection(); @@ -53,13 +61,19 @@ class BounceTrackingProtection final : public nsIBounceTrackingProtection { MozPromise, nsresult, true>; RefPtr PurgeBounceTrackers(); - nsresult PurgeBounceTrackersForStateGlobal( - BounceTrackingStateGlobal* aStateGlobal, - const OriginAttributes& aOriginAttributes); - // Pending clear operations are stored as ClearDataMozPromise, one per host. using ClearDataMozPromise = MozPromise; - nsTArray> mClearPromises; + + // Clear state for classified bounce trackers for a specific state global. + // aClearPromises is populated with promises for each host that is cleared. + [[nodiscard]] nsresult PurgeBounceTrackersForStateGlobal( + BounceTrackingStateGlobal* aStateGlobal, + ContentBlockingAllowListCache& aContentBlockingAllowList, + nsTArray>& aClearPromises); + + // Whether a purge operation is currently in progress. This avoids running + // multiple purge operations at the same time. + bool mPurgeInProgress = false; // Wraps nsIClearDataCallback in MozPromise. class ClearDataCallback final : public nsIClearDataCallback { diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.cpp index 14ee178ae2..d4b33f9edb 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.cpp +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.cpp @@ -12,13 +12,11 @@ namespace mozilla { extern LazyLogModule gBounceTrackingProtectionLog; -NS_IMPL_CYCLE_COLLECTION(BounceTrackingRecord); - void BounceTrackingRecord::SetInitialHost(const nsACString& aHost) { mInitialHost = aHost; } -const nsACString& BounceTrackingRecord::GetInitialHost() { +const nsACString& BounceTrackingRecord::GetInitialHost() const { return mInitialHost; } @@ -26,7 +24,9 @@ void BounceTrackingRecord::SetFinalHost(const nsACString& aHost) { mFinalHost = aHost; } -const nsACString& BounceTrackingRecord::GetFinalHost() { return mFinalHost; } +const nsACString& BounceTrackingRecord::GetFinalHost() const { + return mFinalHost; +} void BounceTrackingRecord::AddBounceHost(const nsACString& aHost) { mBounceHosts.Insert(aHost); @@ -57,11 +57,12 @@ void BounceTrackingRecord::AddStorageAccessHost(const nsACString& aHost) { mStorageAccessHosts.Insert(aHost); } -const nsTHashSet& BounceTrackingRecord::GetBounceHosts() { +const nsTHashSet& BounceTrackingRecord::GetBounceHosts() const { return mBounceHosts; } -const nsTHashSet& BounceTrackingRecord::GetStorageAccessHosts() { +const nsTHashSet& BounceTrackingRecord::GetStorageAccessHosts() + const { return mStorageAccessHosts; } diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.h b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.h index d3e980d00b..73985a00a4 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.h +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingRecord.h @@ -7,9 +7,7 @@ #ifndef mozilla_BounceTrackingRecord_h #define mozilla_BounceTrackingRecord_h -#include "nsISupports.h" #include "nsStringFwd.h" -#include "nsCycleCollectionParticipant.h" #include "nsTHashSet.h" namespace mozilla { @@ -22,31 +20,26 @@ class CanonicalBrowsingContext; // navigation. class BounceTrackingRecord final { public: - NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(BounceTrackingRecord); - NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(BounceTrackingRecord); - void SetInitialHost(const nsACString& aHost); - const nsACString& GetInitialHost(); + const nsACString& GetInitialHost() const; void SetFinalHost(const nsACString& aHost); - const nsACString& GetFinalHost(); + const nsACString& GetFinalHost() const; void AddBounceHost(const nsACString& aHost); void AddStorageAccessHost(const nsACString& aHost); - const nsTHashSet& GetBounceHosts(); + const nsTHashSet& GetBounceHosts() const; - const nsTHashSet& GetStorageAccessHosts(); + const nsTHashSet& GetStorageAccessHosts() const; // Create a string that describes this record. Used for logging. nsCString Describe(); private: - ~BounceTrackingRecord() = default; - // A site's host. The initiator site of the current extended navigation. nsAutoCString mInitialHost; diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.cpp index c5abb8b8d7..b4af3daa07 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.cpp +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.cpp @@ -143,10 +143,11 @@ nsresult BounceTrackingState::Init( } void BounceTrackingState::ResetBounceTrackingRecord() { - mBounceTrackingRecord = nullptr; + mBounceTrackingRecord = Nothing(); } -BounceTrackingRecord* BounceTrackingState::GetBounceTrackingRecord() { +const Maybe& +BounceTrackingState::GetBounceTrackingRecord() { return mBounceTrackingRecord; } @@ -452,7 +453,7 @@ nsresult BounceTrackingState::OnStartNavigation( // tracking record to a new bounce tracking record with initial host set to // initialHost. if (!mBounceTrackingRecord) { - mBounceTrackingRecord = new BounceTrackingRecord(); + mBounceTrackingRecord = Some(BounceTrackingRecord()); mBounceTrackingRecord->SetInitialHost(siteHost); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, @@ -477,7 +478,7 @@ nsresult BounceTrackingState::OnStartNavigation( NS_ENSURE_SUCCESS(rv, rv); MOZ_ASSERT(!mBounceTrackingRecord); - mBounceTrackingRecord = new BounceTrackingRecord(); + mBounceTrackingRecord = Some(BounceTrackingRecord()); mBounceTrackingRecord->SetInitialHost(siteHost); return NS_OK; @@ -539,8 +540,12 @@ nsresult BounceTrackingState::OnResponseReceived( ("%s: Calling RecordStatefulBounces after timeout.", __FUNCTION__)); BounceTrackingState* bounceTrackingState = thisWeak; - bounceTrackingState->mBounceTrackingProtection->RecordStatefulBounces( - bounceTrackingState); + DebugOnly rv = + bounceTrackingState->mBounceTrackingProtection + ->RecordStatefulBounces(bounceTrackingState); + NS_WARNING_ASSERTION( + NS_SUCCEEDED(rv), + "Running RecordStatefulBounces after a timeout failed."); bounceTrackingState->mClientBounceDetectionTimeout = nullptr; }, diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.h b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.h index 70deee5abe..17d324bda9 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.h +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingState.h @@ -7,6 +7,7 @@ #ifndef mozilla_BounceTrackingState_h #define mozilla_BounceTrackingState_h +#include "BounceTrackingRecord.h" #include "mozilla/WeakPtr.h" #include "mozilla/OriginAttributes.h" #include "nsIPrincipal.h" @@ -22,7 +23,6 @@ class nsIPrincipal; namespace mozilla { class BounceTrackingProtection; -class BounceTrackingRecord; namespace dom { class CanonicalBrowsingContext; @@ -55,7 +55,7 @@ class BounceTrackingState : public nsIWebProgressListener, static void ResetAllForOriginAttributesPattern( const OriginAttributesPattern& aPattern); - BounceTrackingRecord* GetBounceTrackingRecord(); + const Maybe& GetBounceTrackingRecord(); void ResetBounceTrackingRecord(); @@ -113,7 +113,7 @@ class BounceTrackingState : public nsIWebProgressListener, // Record to keep track of extended navigation data. Reset on extended // navigation end. - RefPtr mBounceTrackingRecord; + Maybe mBounceTrackingRecord; // Timer to wait to wait for a client redirect after a navigation ends. RefPtr mClientBounceDetectionTimeout; diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp index 3481753431..b94c887c90 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.cpp @@ -106,6 +106,11 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( NS_ENSURE_ARG_MIN(aFrom, 0); NS_ENSURE_TRUE(!aTo || aTo.value() > aFrom, NS_ERROR_INVALID_ARG); + MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, + ("%s: Clearing user activations by time range from %" PRIu64 + " to %" PRIu64 " %s", + __FUNCTION__, aFrom, aTo.valueOr(0), Describe().get())); + // Clear in memory user activation data. if (aEntryType.isNothing() || aEntryType.value() == @@ -113,10 +118,10 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( for (auto iter = mUserActivation.Iter(); !iter.Done(); iter.Next()) { if (iter.Data() >= aFrom && (aTo.isNothing() || iter.Data() <= aTo.value())) { - iter.Remove(); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, ("%s: Remove user activation for %s", __FUNCTION__, PromiseFlatCString(iter.Key()).get())); + iter.Remove(); } } } @@ -128,10 +133,10 @@ nsresult BounceTrackingStateGlobal::ClearByTimeRange( for (auto iter = mBounceTrackers.Iter(); !iter.Done(); iter.Next()) { if (iter.Data() >= aFrom && (aTo.isNothing() || iter.Data() <= aTo.value())) { - iter.Remove(); MOZ_LOG(gBounceTrackingProtectionLog, LogLevel::Debug, ("%s: Remove bouncer tracker for %s", __FUNCTION__, PromiseFlatCString(iter.Key()).get())); + iter.Remove(); } } } @@ -187,4 +192,27 @@ nsresult BounceTrackingStateGlobal::RemoveBounceTrackers( return NS_OK; } +// static +nsCString BounceTrackingStateGlobal::DescribeMap( + const nsTHashMap& aMap) { + nsAutoCString mapStr; + + for (auto iter = aMap.ConstIter(); !iter.Done(); iter.Next()) { + mapStr.Append(nsPrintfCString("{ %s: %" PRIu64 " }, ", + PromiseFlatCString(iter.Key()).get(), + iter.Data())); + } + + return std::move(mapStr); +} + +nsCString BounceTrackingStateGlobal::Describe() { + nsAutoCString originAttributeSuffix; + mOriginAttributes.CreateSuffix(originAttributeSuffix); + return nsPrintfCString( + "{ mOriginAttributes: %s, mUserActivation: %s, mBounceTrackers: %s }", + originAttributeSuffix.get(), DescribeMap(mUserActivation).get(), + DescribeMap(mBounceTrackers).get()); +} + } // namespace mozilla diff --git a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.h b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.h index 6680ceae6f..c8ed72c11f 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.h +++ b/toolkit/components/antitracking/bouncetrackingprotection/BounceTrackingStateGlobal.h @@ -37,6 +37,10 @@ class BounceTrackingStateGlobal final { bool ShouldPersistToDisk() const { return !IsPrivateBrowsing(); } + const OriginAttributes& OriginAttributesRef() const { + return mOriginAttributes; + }; + bool HasUserActivation(const nsACString& aSiteHost) const; // Store a user interaction flag for the given host. This will remove the @@ -79,6 +83,9 @@ class BounceTrackingStateGlobal final { return mBounceTrackers; } + // Create a string that describes this object. Used for logging. + nsCString Describe(); + private: ~BounceTrackingStateGlobal() = default; @@ -103,6 +110,10 @@ class BounceTrackingStateGlobal final { // on the given site host performed an action that could indicate stateful // bounce tracking took place. nsTHashMap mBounceTrackers{}; + + // Helper to create a string representation of a siteHost -> timestamp map. + static nsCString DescribeMap( + const nsTHashMap& aMap); }; } // namespace mozilla diff --git a/toolkit/components/antitracking/bouncetrackingprotection/nsIBounceTrackingProtection.idl b/toolkit/components/antitracking/bouncetrackingprotection/nsIBounceTrackingProtection.idl index 9ade9cb0ea..1163492333 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/nsIBounceTrackingProtection.idl +++ b/toolkit/components/antitracking/bouncetrackingprotection/nsIBounceTrackingProtection.idl @@ -28,6 +28,10 @@ interface nsIBounceTrackingProtection : nsISupports { [implicit_jscontext] Promise testRunPurgeBounceTrackers(); + // Clear expired user activation flags. Expiry is set via pref + // "privacy.bounceTrackingProtection.bounceTrackingActivationLifetimeSec". + void testClearExpiredUserActivations(); + // Getters and setters for user activation and bounce tracker state. // These are used for testing purposes only. // State is keyed by OriginAttributes. diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js index a8e98b80f0..eedd374197 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/browser/browser_bouncetracking_purge.js @@ -119,3 +119,69 @@ add_task(async function test_purging_skip_open_tab_extra_window() { bounceTrackingProtection.clearAll(); }); + +add_task(async function test_purging_skip_content_blocking_allow_list() { + initBounceTrackerState(); + + await BrowserTestUtils.withNewTab("https://example.com", async browser => { + window.ContentBlockingAllowList.add(browser); + }); + + Assert.deepEqual( + await bounceTrackingProtection.testRunPurgeBounceTrackers(), + ["example.net"], + "Should only purge example.net. example.org is within the grace period, example.com is allow-listed." + ); + + info( + "Remove the allow-list entry for example.com and test that it gets purged now." + ); + + await BrowserTestUtils.withNewTab("https://example.com", async browser => { + window.ContentBlockingAllowList.remove(browser); + }); + Assert.deepEqual( + await bounceTrackingProtection.testRunPurgeBounceTrackers(), + ["example.com"], + "example.com should have been purged now that it is no longer allow-listed." + ); + + bounceTrackingProtection.clearAll(); +}); + +add_task( + async function test_purging_skip_content_blocking_allow_list_subdomain() { + initBounceTrackerState(); + + await BrowserTestUtils.withNewTab( + "https://test1.example.com", + async browser => { + window.ContentBlockingAllowList.add(browser); + } + ); + + Assert.deepEqual( + await bounceTrackingProtection.testRunPurgeBounceTrackers(), + ["example.net"], + "Should only purge example.net. example.org is within the grace period, example.com is allow-listed via test1.example.com." + ); + + info( + "Remove the allow-list entry for test1.example.com and test that it gets purged now." + ); + + await BrowserTestUtils.withNewTab( + "https://test1.example.com", + async browser => { + window.ContentBlockingAllowList.remove(browser); + } + ); + Assert.deepEqual( + await bounceTrackingProtection.testRunPurgeBounceTrackers(), + ["example.com"], + "example.com should have been purged now that test1.example.com it is no longer allow-listed." + ); + + bounceTrackingProtection.clearAll(); + } +); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js new file mode 100644 index 0000000000..28a1350b3e --- /dev/null +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/test_bouncetracking_clearExpiredUserActivation.js @@ -0,0 +1,85 @@ +/* Any copyright is dedicated to the Public Domain. +http://creativecommons.org/publicdomain/zero/1.0/ */ + +"use strict"; + +/** + * Test that expired user activations are cleared by the the helper method + * testClearExpiredUserActivations. + */ +add_task(async function test() { + // Need a profile to data clearing calls. + do_get_profile(); + + let btp = Cc["@mozilla.org/bounce-tracking-protection;1"].getService( + Ci.nsIBounceTrackingProtection + ); + + // Reset global bounce tracking state. + btp.clearAll(); + + // Assert initial test state. + Assert.deepEqual( + btp.testGetBounceTrackerCandidateHosts({}), + [], + "No tracker candidates initially." + ); + Assert.deepEqual( + btp.testGetUserActivationHosts({}), + [], + "No user activation hosts initially." + ); + + // Get the bounce tracking activation lifetime. The pref is in seconds, we + // need to convert it to microseconds, as the user activation timestamps are + // in microseconds (PRTime). + let bounceTrackingActivationLifetimeUSec = + 1000 * + 1000 * + Services.prefs.getIntPref( + "privacy.bounceTrackingProtection.bounceTrackingActivationLifetimeSec" + ); + + // Add some test data for user activation. + btp.testAddUserActivation({}, "not-expired1.com", Date.now() * 1000); + btp.testAddUserActivation( + {}, + "not-expired2.com", + Date.now() * 1000 - bounceTrackingActivationLifetimeUSec / 2 + ); + btp.testAddUserActivation( + { privateBrowsingId: 1 }, + "pbm-not-expired.com", + Date.now() * 1000 + ); + btp.testAddUserActivation( + {}, + "expired1.com", + Date.now() * 1000 - bounceTrackingActivationLifetimeUSec * 2 + ); + btp.testAddUserActivation( + {}, + "expired2.com", + Date.now() * 1000 - (bounceTrackingActivationLifetimeUSec + 1000 * 1000) + ); + btp.testAddUserActivation({ privateBrowsingId: 1 }, "pbm-expired.com", 1); + + // Clear expired user activations. + btp.testClearExpiredUserActivations(); + + // Assert that expired user activations have been cleared. + Assert.deepEqual( + btp.testGetUserActivationHosts({}).sort(), + ["not-expired1.com", "not-expired2.com"], + "Expired user activation flags have been cleared for normal browsing." + ); + + Assert.deepEqual( + btp.testGetUserActivationHosts({ privateBrowsingId: 1 }).sort(), + ["pbm-not-expired.com"], + "Expired user activation flags have been cleared for private browsing." + ); + + // Reset global bounce tracking state. + btp.clearAll(); +}); diff --git a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml index 16e270b85c..c3aeee502f 100644 --- a/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml +++ b/toolkit/components/antitracking/bouncetrackingprotection/test/xpcshell/xpcshell.toml @@ -5,4 +5,6 @@ prefs = [ "privacy.bounceTrackingProtection.bounceTrackingPurgeTimerPeriodSec=0", ] +["test_bouncetracking_clearExpiredUserActivation.js"] + ["test_bouncetracking_purge.js"] diff --git a/toolkit/components/antitracking/test/browser/3rdPartySVG.html b/toolkit/components/antitracking/test/browser/3rdPartySVG.html index df791f355f..9ce6fc8ba1 100644 --- a/toolkit/components/antitracking/test/browser/3rdPartySVG.html +++ b/toolkit/components/antitracking/test/browser/3rdPartySVG.html @@ -11,7 +11,7 @@

3rd party content with an SVG image background

diff --git a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html index 87638b1132..5d014124a1 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_dismissed_doorhanger_in_shadow_DOM.html @@ -67,13 +67,7 @@ async function editPasswordFieldInShadowDOM() { async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html index 06458893ea..722a86efc9 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formLike_rootElement_with_Shadow_DOM.html @@ -94,13 +94,7 @@ const TESTCASES = [ async function testForm(testcase) { const iframeLoaded = new Promise(resolve => { - IFRAME.addEventListener( - "load", - function(e) { - resolve(true); - }, - { once: true } - ); + IFRAME.addEventListener("load", _e => resolve(true), { once: true }); }); // This could complete before the page finishes loading. diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html index 4d1b7582a9..05be33e4dd 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_autofill.html @@ -12,7 +12,7 @@ gTestDependsOnDeprecatedLogin = true; let doneSetupPromise = new Promise(resolve => { document.addEventListener("DOMContentLoaded", () => { - document.getElementById("loginFrame").addEventListener("load", async evt => { + document.getElementById("loginFrame").addEventListener("load", async _e => { // Tell the parent to setup test logins. await runChecksAfterCommonInit(); resolve(); diff --git a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html index 5512c57db2..b2ff2d8845 100644 --- a/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html +++ b/toolkit/components/passwordmgr/test/mochitest/test_formless_submit_form_removal.html @@ -10,10 +10,8 @@