Loading Cargo.lock +27 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,8 @@ dependencies = [ "ssl_tokens_cache", "static_prefs", "storage", "tor_provider", "tor_service", "trust-anchors", "unic-langid", "unic-langid-ffi", Loading Loading @@ -8225,6 +8227,31 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" [[package]] name = "tor_provider" version = "0.1.0" dependencies = [ "bytes", "log", "memchr", "thiserror 2.0.12", ] [[package]] name = "tor_service" version = "0.1.0" dependencies = [ "bytes", "cstr", "log", "moz_task", "nserror", "nsstring", "thin-vec", "tor_provider", "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 @@ -161,6 +161,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 +32 −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" #include "nsIFile.idl" [scriptable, uuid(4b250614-968a-412f-9191-9ffd9d4bd001)] interface ITorControlPortReceiver : nsISupports { void onAsyncMessage(in ACString message); }; [scriptable, uuid(1389d157-4695-43a2-a7d8-538aaa350766)] interface ITorMessageHandler : nsISupports { void onMessage(in ACString message); void onError(in ACString error); }; // TODO: Remove once we have a provider. [scriptable, uuid(f56d710e-5650-4b8c-8d31-279f360003ee)] interface ITorControlPort : nsISupports { void start(in ITorControlPortReceiver receiver); void sendCommand(in ACString command, in ITorMessageHandler handler); void close(); }; [scriptable, uuid(2537313c-e120-408c-a2f6-86e6e1bdf899)] interface ITorService : nsISupports { // For development purposes... ITorControlPort createControlPort(in ACString host, in long port); ITorControlPort createControlPortIPC(in nsIFile socket); }; 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 +27 −0 Original line number Diff line number Diff line Loading @@ -2997,6 +2997,8 @@ dependencies = [ "ssl_tokens_cache", "static_prefs", "storage", "tor_provider", "tor_service", "trust-anchors", "unic-langid", "unic-langid-ffi", Loading Loading @@ -8225,6 +8227,31 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa7c7f42dea4b1b99439786f5633aeb9c14c1b53f75e282803c2ec2ad545873c" [[package]] name = "tor_provider" version = "0.1.0" dependencies = [ "bytes", "log", "memchr", "thiserror 2.0.12", ] [[package]] name = "tor_service" version = "0.1.0" dependencies = [ "bytes", "cstr", "log", "moz_task", "nserror", "nsstring", "thin-vec", "tor_provider", "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 @@ -161,6 +161,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 +32 −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" #include "nsIFile.idl" [scriptable, uuid(4b250614-968a-412f-9191-9ffd9d4bd001)] interface ITorControlPortReceiver : nsISupports { void onAsyncMessage(in ACString message); }; [scriptable, uuid(1389d157-4695-43a2-a7d8-538aaa350766)] interface ITorMessageHandler : nsISupports { void onMessage(in ACString message); void onError(in ACString error); }; // TODO: Remove once we have a provider. [scriptable, uuid(f56d710e-5650-4b8c-8d31-279f360003ee)] interface ITorControlPort : nsISupports { void start(in ITorControlPortReceiver receiver); void sendCommand(in ACString command, in ITorMessageHandler handler); void close(); }; [scriptable, uuid(2537313c-e120-408c-a2f6-86e6e1bdf899)] interface ITorService : nsISupports { // For development purposes... ITorControlPort createControlPort(in ACString host, in long port); ITorControlPort createControlPortIPC(in nsIFile socket); };
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', }, ]