Skip to content
Snippets Groups Projects
Verified Commit e55fdfad authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame :jack_o_lantern:
Browse files

fixup! Bug 10760: Integrate TorButton to TorBrowser core

Extract the new identity button from torbutton
parent 94b1d59e
Branches
No related tags found
1 merge request!694Bug 41796: Rebased on top of FIREFOX_ESR_115_BASE
......@@ -59,11 +59,6 @@
<toolbarbutton id="appMenu-new-identity"
class="subviewbutton"
key="new-identity-key"/>
<toolbarbutton id="appMenuNewCircuit"
class="subviewbutton"
key="torbutton-new-circuit-key"
label="&torbutton.context_menu.new_circuit_sentence_case;"
oncommand="torbutton_new_circuit();"/>
<toolbarseparator/>
<toolbarbutton id="appMenu-bookmarks-button"
class="subviewbutton subviewbutton-nav"
......
......@@ -31,11 +31,6 @@
<menuseparator/>
<menuitem id="menu_newIdentity"
key="new-identity-key"/>
<menuitem id="menu_newCircuit"
accesskey="&torbutton.context_menu.new_circuit_key;"
key="torbutton-new-circuit-key"
label="&torbutton.context_menu.new_circuit;"
oncommand="torbutton_new_circuit();"/>
<menuseparator/>
<menuitem id="menu_openLocation"
hidden="true"
......
......@@ -396,5 +396,4 @@
internal="true"/>
#endif
<key id="new-identity-key" modifiers="accel shift" key="U" oncommand="NewIdentityButton.onCommand(event)"/>
<key id="torbutton-new-circuit-key" modifiers="accel shift" key="L" oncommand="torbutton_new_circuit()"/>
</keyset>
......@@ -592,11 +592,6 @@
<toolbarbutton id="new-identity-button" class="toolbarbutton-1 chromeclass-toolbar-additional"/>
<toolbarbutton id="new-circuit-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
label="&torbutton.context_menu.new_circuit;"
oncommand="torbutton_new_circuit();"
tooltiptext="&torbutton.context_menu.new_circuit;"/>
<toolbarbutton id="fullscreen-button" class="toolbarbutton-1 chromeclass-toolbar-additional"
observes="View:FullScreen"
type="checkbox"
......
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.5994 2.89744C9.52191 2.34851 8.2983 2.15477 7.10392 2.34398C6.64247 2.41708 6.19453 2.5459 5.76923 2.72578C5.82159 2.91042 5.84961 3.10529 5.84961 3.3067C5.84961 4.48031 4.89821 5.4317 3.72461 5.4317C2.551 5.4317 1.59961 4.48031 1.59961 3.3067C1.59961 2.1331 2.551 1.1817 3.72461 1.1817C4.23757 1.1817 4.70808 1.36346 5.07525 1.66608C5.65429 1.3987 6.27072 1.21038 6.90834 1.10937C8.36342 0.878863 9.85413 1.11489 11.1668 1.78364C12.4795 2.45239 13.5468 3.51953 14.2158 4.83212C14.8848 6.14471 15.121 7.63538 14.8907 9.0905C14.8368 9.43143 14.5167 9.66408 14.1757 9.61013C13.8348 9.55617 13.6022 9.23605 13.6561 8.89511C13.8451 7.70071 13.6512 6.47713 13.1021 5.39971C12.553 4.3223 11.6769 3.44636 10.5994 2.89744ZM4.64961 3.3067C4.64961 3.81756 4.23547 4.2317 3.72461 4.2317C3.21375 4.2317 2.79961 3.81756 2.79961 3.3067C2.79961 2.79584 3.21375 2.3817 3.72461 2.3817C4.23547 2.3817 4.64961 2.79584 4.64961 3.3067Z" fill="context-fill"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.82421 6.38991C2.16514 6.44387 2.39779 6.76399 2.34383 7.10492C2.15482 8.29933 2.34875 9.52291 2.89785 10.6003C3.44695 11.6777 4.32303 12.5537 5.40053 13.1026C6.47803 13.6515 7.70165 13.8453 8.89602 13.6561C9.35628 13.5831 9.8031 13.4548 10.2274 13.2757C10.1734 13.0884 10.1445 12.8906 10.1445 12.686C10.1445 11.5124 11.0959 10.561 12.2695 10.561C13.4431 10.561 14.3945 11.5124 14.3945 12.686C14.3945 13.8596 13.4431 14.811 12.2695 14.811C11.7602 14.811 11.2927 14.6318 10.9267 14.333C10.3471 14.6009 9.72997 14.7895 9.0916 14.8907C7.63652 15.1212 6.14581 14.8851 4.83311 14.2164C3.52042 13.5476 2.45311 12.4805 1.78415 11.1679C1.11519 9.85533 0.878921 8.36466 1.1092 6.90954C1.16315 6.56861 1.48327 6.33596 1.82421 6.38991ZM13.1945 12.686C13.1945 13.1968 12.7804 13.611 12.2695 13.611C11.7587 13.611 11.3445 13.1968 11.3445 12.686C11.3445 12.1751 11.7587 11.761 12.2695 11.761C12.7804 11.761 13.1945 12.1751 13.1945 12.686Z" fill="context-fill"/>
</svg>
......@@ -283,5 +283,3 @@
skin/classic/browser/weather/night-mostly-cloudy-with-flurries.svg (../shared/weather/night-mostly-cloudy-with-flurries.svg)
skin/classic/browser/new_identity.svg (../shared/icons/new_identity.svg)
skin/classic/browser/new_circuit.svg (../shared/icons/new_circuit.svg)
......@@ -250,10 +250,6 @@ toolbar[brighttext]:-moz-lwtheme {
list-style-image: url("chrome://browser/skin/new_identity.svg");
}
#new-circuit-button {
list-style-image: url("chrome://browser/skin/new_circuit.svg");
}
#privatebrowsing-button {
list-style-image: url("chrome://browser/skin/privateBrowsing.svg");
}
......
// window globals
var torbutton_init;
var torbutton_new_circuit;
(() => {
// Bug 1506 P1-P5: This is the main Torbutton overlay file. Much needs to be
......@@ -14,12 +13,9 @@ var torbutton_new_circuit;
/* global gBrowser, Services, AppConstants */
let {
unescapeTorString,
getDomainForBrowser,
torbutton_log,
torbutton_get_property_string,
} = ChromeUtils.import("resource://torbutton/modules/utils.js");
let { unescapeTorString, torbutton_log } = ChromeUtils.import(
"resource://torbutton/modules/utils.js"
);
let { configureControlPortModule, wait_for_controller } = ChromeUtils.import(
"resource://torbutton/modules/tor-control-port.js"
);
......@@ -302,19 +298,6 @@ var torbutton_new_circuit;
return response;
}
// Bug 1506 P4: Needed for New IP Address
torbutton_new_circuit = function () {
let firstPartyDomain = getDomainForBrowser(gBrowser.selectedBrowser);
let domainIsolator = Cc["@torproject.org/domain-isolator;1"].getService(
Ci.nsISupports
).wrappedJSObject;
domainIsolator.newCircuitForDomain(firstPartyDomain);
gBrowser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
};
async function torbutton_do_tor_check() {
let checkSvc = Cc["@torproject.org/torbutton-torCheckService;1"].getService(
Ci.nsISupports
......
......@@ -207,45 +207,6 @@ var unescapeTorString = function (str) {
return _torControl._strUnescape(str);
};
var getFPDFromHost = hostname => {
try {
return Services.eTLD.getBaseDomainFromHost(hostname);
} catch (e) {
if (
e.result == Cr.NS_ERROR_HOST_IS_IP_ADDRESS ||
e.result == Cr.NS_ERROR_INSUFFICIENT_DOMAIN_LEVELS
) {
return hostname;
}
}
return null;
};
// Assuming this is called with gBrowser.selectedBrowser
var getDomainForBrowser = browser => {
let fpd = browser.contentPrincipal.originAttributes.firstPartyDomain;
// Bug 31562: For neterror or certerror, get the original URL from
// browser.currentURI and use it to calculate the firstPartyDomain.
let knownErrors = [
"about:neterror",
"about:certerror",
"about:httpsonlyerror",
];
let documentURI = browser.documentURI;
if (
documentURI &&
documentURI.schemeIs("about") &&
knownErrors.some(x => documentURI.spec.startsWith(x))
) {
let knownSchemes = ["http", "https", "ftp"];
let currentURI = browser.currentURI;
if (currentURI && knownSchemes.some(x => currentURI.schemeIs(x))) {
fpd = getFPDFromHost(currentURI.host) || fpd;
}
}
return fpd;
};
var m_tb_torlog = Cc["@torproject.org/torbutton-logger;1"].getService(
Ci.nsISupports
).wrappedJSObject;
......@@ -304,7 +265,6 @@ let EXPORTED_SYMBOLS = [
"bindPrefAndInit",
"getEnv",
"getLocale",
"getDomainForBrowser",
"getPrefValue",
"observe",
"showDialog",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment