This is an automated email from the git hooks/post-receive script.
boklm pushed a commit to branch main in repository builders/tor-browser-build.
The following commit(s) were added to refs/heads/main by this push: new fc1170e Bug 40621: Update namecoin patches for linted TorButton fc1170e is described below
commit fc1170e5d97b02f2da5bd938edf42ee7396b53b3 Author: Nicolas Vigier boklm@torproject.org AuthorDate: Wed Sep 7 16:39:54 2022 +0200
Bug 40621: Update namecoin patches for linted TorButton --- projects/firefox/namecoin-torbutton.patch | 198 ++++++++++++++++-------------- 1 file changed, 103 insertions(+), 95 deletions(-)
diff --git a/projects/firefox/namecoin-torbutton.patch b/projects/firefox/namecoin-torbutton.patch index 4e92628..c923d68 100644 --- a/projects/firefox/namecoin-torbutton.patch +++ b/projects/firefox/namecoin-torbutton.patch @@ -1,8 +1,8 @@ diff --git a/chrome/content/tor-circuit-display.js b/chrome/content/tor-circuit-display.js -index d6034384..120d32a0 100644 +index e4b5ceea..fb0b8fc9 100644 --- a/chrome/content/tor-circuit-display.js +++ b/chrome/content/tor-circuit-display.js -@@ -48,7 +48,11 @@ let credentialsToNodeDataMap = new Map(), +@@ -58,7 +58,11 @@ let createTorCircuitDisplay = (function() { knownCircuitIDs = new Map(), // A mutable map that records the SOCKS credentials for the // latest channels for each browser + domain. @@ -13,112 +13,120 @@ index d6034384..120d32a0 100644 + // A mutable map from .bit[.onion] domains to .onion domains. + bitToOnionMap = {};
- // __trimQuotes(s)__. - // Removes quotation marks around a quoted string. -@@ -132,6 +136,28 @@ let getCircuitStatusByID = async function (aController, circuitID) { - return null; - }; + // __trimQuotes(s)__. + // Removes quotation marks around a quoted string. +@@ -153,6 +157,28 @@ let createTorCircuitDisplay = (function() { + return null; + };
-+// __collectBitTargets(aContoller)__. -+// Watches for STREAM NEW events. When a NEW event occurs, we will see -+// the stream's target domain. If that target is a .bit domain, then -+// we want to be sure to record this so we can later record if it is -+// remapped to a .onion domain. -+let collectBitTargets = function (aController) { -+ return aController.watchEvent( -+ "STREAM", -+ streamEvent => streamEvent.StreamStatus === "NEW", -+ async (streamEvent) => { -+ logger.eclog(3, "new streamEvent:" + JSON.stringify(streamEvent)); -+ if (streamEvent && streamEvent.StreamID && streamEvent.Target) { -+ let targetDomain = streamEvent.Target.split(":")[0]; -+ if (targetDomain.endsWith(".bit") || -+ targetDomain.endsWith(".bit.onion")) { -+ bitTargets[streamEvent.StreamID] = Services.eTLD.getBaseDomainFromHost(targetDomain); -+ logger.eclog(3, "stream on .bit domain: " + targetDomain); ++ // __collectBitTargets(aContoller)__. ++ // Watches for STREAM NEW events. When a NEW event occurs, we will see ++ // the stream's target domain. If that target is a .bit domain, then ++ // we want to be sure to record this so we can later record if it is ++ // remapped to a .onion domain. ++ let collectBitTargets = function (aController) { ++ return aController.watchEvent( ++ "STREAM", ++ streamEvent => streamEvent.StreamStatus === "NEW", ++ async (streamEvent) => { ++ logger.eclog(3, "new streamEvent:" + JSON.stringify(streamEvent)); ++ if (streamEvent && streamEvent.StreamID && streamEvent.Target) { ++ let targetDomain = streamEvent.Target.split(":")[0]; ++ if (targetDomain.endsWith(".bit") || ++ targetDomain.endsWith(".bit.onion")) { ++ bitTargets[streamEvent.StreamID] = Services.eTLD.getBaseDomainFromHost(targetDomain); ++ logger.eclog(3, "stream on .bit domain: " + targetDomain); ++ } + } -+ } -+ }); -+}; ++ }); ++ }; + - // __collectIsolationData(aController, updateUI)__. - // Watches for STREAM SENTCONNECT events. When a SENTCONNECT event occurs, then - // we assume isolation settings (SOCKS username+password) are now fixed for the -@@ -145,6 +171,15 @@ let collectIsolationData = function (aController, updateUI) { - "STREAM", - streamEvent => streamEvent.StreamStatus === "SENTCONNECT", - async (streamEvent) => { -+ logger.eclog(3, "sentconnect streamEvent:" + JSON.stringify(streamEvent)); -+ // Collect any stream target that might be an onion. -+ if (streamEvent && streamEvent.StreamID && streamEvent.Target) { -+ let targetDomain = streamEvent.Target.split(":")[0]; -+ if (targetDomain.endsWith(".onion")) { -+ bitToOnionMap[bitTargets[streamEvent.StreamID]] = targetDomain; -+ logger.eclog(3, "mapped " + bitTargets[streamEvent.StreamID] + " to " + targetDomain); + // __collectIsolationData(aController, updateUI)__. + // Watches for STREAM SENTCONNECT events. When a SENTCONNECT event occurs, then + // we assume isolation settings (SOCKS username+password) are now fixed for the +@@ -166,6 +192,15 @@ let createTorCircuitDisplay = (function() { + "STREAM", + streamEvent => streamEvent.StreamStatus === "SENTCONNECT", + async streamEvent => { ++ logger.eclog(3, "sentconnect streamEvent:" + JSON.stringify(streamEvent)); ++ // Collect any stream target that might be an onion. ++ if (streamEvent && streamEvent.StreamID && streamEvent.Target) { ++ let targetDomain = streamEvent.Target.split(":")[0]; ++ if (targetDomain.endsWith(".onion")) { ++ bitToOnionMap[bitTargets[streamEvent.StreamID]] = targetDomain; ++ logger.eclog(3, "mapped " + bitTargets[streamEvent.StreamID] + " to " + targetDomain); ++ } + } -+ } - if (!knownCircuitIDs.get(streamEvent.CircuitID)) { - logger.eclog(3, "streamEvent.CircuitID: " + streamEvent.CircuitID); - knownCircuitIDs.set(streamEvent.CircuitID, true); -@@ -312,7 +347,9 @@ let updateCircuitDisplay = function () { - } + if (!knownCircuitIDs.get(streamEvent.CircuitID)) { + logger.eclog(3, "streamEvent.CircuitID: " + streamEvent.CircuitID); + knownCircuitIDs.set(streamEvent.CircuitID, true); +@@ -367,7 +402,9 @@ let createTorCircuitDisplay = (function() { + }
- let domainParts = []; -- if (domain.endsWith(".onion")) { -+ logger.eclog(3, "bit to onion map:" + JSON.stringify(bitToOnionMap) + ", domain: " + domain); -+ let mappedOnion = bitToOnionMap[domain]; -+ if (domain.endsWith(".onion") || mappedOnion) { - for (let i = 0; i < 3; ++i) { - li(uiString("relay")); + let domainParts = []; +- if (domain.endsWith(".onion")) { ++ logger.eclog(3, "bit to onion map:" + JSON.stringify(bitToOnionMap) + ", domain: " + domain); ++ let mappedOnion = bitToOnionMap[domain]; ++ if (domain.endsWith(".onion") || mappedOnion) { + for (let i = 0; i < 3; ++i) { + li(uiString("relay")); + } +@@ -380,28 +417,32 @@ let createTorCircuitDisplay = (function() { + domainParts.push(domain); } -@@ -325,24 +362,28 @@ let updateCircuitDisplay = function () { - domainParts.push(domain); - }
-- // We use a XUL html:span element so that the tooltiptext is displayed. -- li([ -- "html:span", -- { -- class: "circuit-onion", -- onclick: ` +- // We use a XUL html:span element so that the tooltiptext is displayed. +- li([ +- "html:span", +- { +- class: "circuit-onion", +- onclick: ` - this.classList.add("circuit-onion-copied"); - Cc[ - "@mozilla.org/widget/clipboardhelper;1" - ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) - `, -- "data-onion": domain, -- "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), -- "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), -- tooltiptext: domain, -- }, -- ...domainParts, -- ]); -+ if (mappedOnion) { -+ li(domain, " ", ["span", { class: "circuit-ip-address" }, mappedOnion]); -+ } else { -+ // We use a XUL html:span element so that the tooltiptext is displayed. -+ li([ -+ "html:span", -+ { -+ class: "circuit-onion", -+ onclick: ` +- "data-onion": domain, +- "data-text-clicktocopy": torbutton_get_property_string( +- "torbutton.circuit_display.click_to_copy" +- ), +- "data-text-copied": torbutton_get_property_string( +- "torbutton.circuit_display.copied" +- ), +- tooltiptext: domain, +- }, +- ...domainParts, +- ]); ++ if (mappedOnion) { ++ li(domain, " ", ["span", { class: "circuit-ip-address" }, mappedOnion]); ++ } else { ++ // We use a XUL html:span element so that the tooltiptext is displayed. ++ li([ ++ "html:span", ++ { ++ class: "circuit-onion", ++ onclick: ` + this.classList.add("circuit-onion-copied"); + Cc[ + "@mozilla.org/widget/clipboardhelper;1" + ].getService(Ci.nsIClipboardHelper).copyString(this.getAttribute("data-onion")) + `, -+ "data-onion": domain, -+ "data-text-clicktocopy": torbutton_get_property_string("torbutton.circuit_display.click_to_copy"), -+ "data-text-copied": torbutton_get_property_string("torbutton.circuit_display.copied"), -+ tooltiptext: domain, -+ }, -+ ...domainParts, -+ ]); -+ } ++ "data-onion": domain, ++ "data-text-clicktocopy": torbutton_get_property_string( ++ "torbutton.circuit_display.click_to_copy" ++ ), ++ "data-text-copied": torbutton_get_property_string( ++ "torbutton.circuit_display.copied" ++ ), ++ tooltiptext: domain, ++ }, ++ ...domainParts, ++ ]); ++ }
- // Hide the note about guards if we are using a bridge. - document.getElementById("circuit-guard-note-container").style.display = -@@ -454,6 +495,7 @@ let setupDisplay = function (enablePrefName) { + // Hide the note about guards if we are using a bridge. + document.getElementById("circuit-guard-note-container").style.display = +@@ -534,6 +575,7 @@ let createTorCircuitDisplay = (function() { stopCollectingIsolationData = null, stopCollectingBrowserCredentials = null, stopEnsuringCorrectPopupDimensions = null, @@ -126,7 +134,7 @@ index d6034384..120d32a0 100644 stop = function() { syncDisplayWithSelectedTab(false); if (myController) { -@@ -466,6 +508,9 @@ let setupDisplay = function (enablePrefName) { +@@ -546,6 +588,9 @@ let createTorCircuitDisplay = (function() { if (stopEnsuringCorrectPopupDimensions) { stopEnsuringCorrectPopupDimensions(); } @@ -136,11 +144,11 @@ index d6034384..120d32a0 100644 myController = null; } }, -@@ -474,6 +519,7 @@ let setupDisplay = function (enablePrefName) { +@@ -554,6 +599,7 @@ let createTorCircuitDisplay = (function() { try { myController = await wait_for_controller(); syncDisplayWithSelectedTab(true); + stopCollectingBitTargets = collectBitTargets(myController); - stopCollectingIsolationData = collectIsolationData(myController, updateCircuitDisplay); - stopCollectingBrowserCredentials = collectBrowserCredentials(); - stopEnsuringCorrectPopupDimensions = ensureCorrectPopupDimensions(); + stopCollectingIsolationData = collectIsolationData( + myController, + updateCircuitDisplay
tor-commits@lists.torproject.org