Loading Cargo.lock +10 −0 Original line number Diff line number Diff line Loading @@ -2982,6 +2982,7 @@ dependencies = [ "ssl_tokens_cache", "static_prefs", "storage", "tor_service", "trust-anchors", "unic-langid", "unic-langid-ffi", Loading Loading @@ -8116,6 +8117,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" [[package]] name = "tor_service" version = "0.1.0" dependencies = [ "nserror", "nsstring", "xpcom", ] [[package]] name = "tower-service" version = "0.3.2" Loading toolkit/components/moz.build +3 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,9 @@ if CONFIG["MOZ_UNIFFI_FIXTURES"]: # Exclude aboutinference (about:inference). tor-browser#44045. if CONFIG["TOR_RUST_INTEGRATION"]: DIRS += ["tor-integration"] UNIFIED_SOURCES += [ "/toolkit/components/antitracking/ContentBlockingAllowList.cpp", ] toolkit/components/tor-integration/ITorService.idl 0 → 100644 +9 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" [scriptable, uuid(2537313c-e120-408c-a2f6-86e6e1bdf899)] interface ITorService : nsISupports { }; toolkit/components/tor-integration/TorService.h 0 → 100644 +29 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_ #define TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_ #include "nsCOMPtr.h" #include "ITorService.h" // Inspired by // toolkit/components/extensions/storage/ExtensionStorageComponents.h. // Implemented in Rust extern "C" nsresult NewTorServiceImpl(ITorService** aResult); namespace torproject { already_AddRefed<ITorService> NewTorService() { nsCOMPtr<ITorService> service; nsresult rv = NewTorServiceImpl(getter_AddRefs(service)); if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; } return service.forget(); } } // namespace torproject #endif // TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_ toolkit/components/tor-integration/components.conf 0 → 100644 +14 −0 Original line number Diff line number Diff line # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. Classes = [ { 'cid': '{2537313c-e120-408c-a2f6-86e6e1bdf899}', 'contract_ids': ['@torproject.org/tor-service;1'], 'interfaces': ['ITorService'], 'constructor': 'torproject::NewTorService', 'headers': ['torproject/TorService.h'], 'js_name': 'tor', }, ] Loading
Cargo.lock +10 −0 Original line number Diff line number Diff line Loading @@ -2982,6 +2982,7 @@ dependencies = [ "ssl_tokens_cache", "static_prefs", "storage", "tor_service", "trust-anchors", "unic-langid", "unic-langid-ffi", Loading Loading @@ -8116,6 +8117,15 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" [[package]] name = "tor_service" version = "0.1.0" dependencies = [ "nserror", "nsstring", "xpcom", ] [[package]] name = "tower-service" version = "0.3.2" Loading
toolkit/components/moz.build +3 −0 Original line number Diff line number Diff line Loading @@ -159,6 +159,9 @@ if CONFIG["MOZ_UNIFFI_FIXTURES"]: # Exclude aboutinference (about:inference). tor-browser#44045. if CONFIG["TOR_RUST_INTEGRATION"]: DIRS += ["tor-integration"] UNIFIED_SOURCES += [ "/toolkit/components/antitracking/ContentBlockingAllowList.cpp", ]
toolkit/components/tor-integration/ITorService.idl 0 → 100644 +9 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" [scriptable, uuid(2537313c-e120-408c-a2f6-86e6e1bdf899)] interface ITorService : nsISupports { };
toolkit/components/tor-integration/TorService.h 0 → 100644 +29 −0 Original line number Diff line number Diff line /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_ #define TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_ #include "nsCOMPtr.h" #include "ITorService.h" // Inspired by // toolkit/components/extensions/storage/ExtensionStorageComponents.h. // Implemented in Rust extern "C" nsresult NewTorServiceImpl(ITorService** aResult); namespace torproject { already_AddRefed<ITorService> NewTorService() { nsCOMPtr<ITorService> service; nsresult rv = NewTorServiceImpl(getter_AddRefs(service)); if (NS_WARN_IF(NS_FAILED(rv))) { return nullptr; } return service.forget(); } } // namespace torproject #endif // TOOLKIT_COMPONENTS_TOR_INTEGRATION_TORSERVICE_H_
toolkit/components/tor-integration/components.conf 0 → 100644 +14 −0 Original line number Diff line number Diff line # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. Classes = [ { 'cid': '{2537313c-e120-408c-a2f6-86e6e1bdf899}', 'contract_ids': ['@torproject.org/tor-service;1'], 'interfaces': ['ITorService'], 'constructor': 'torproject::NewTorService', 'headers': ['torproject/TorService.h'], 'js_name': 'tor', }, ]