Skip to content

Commit

Permalink
Bug 31747: Move new identity and new circuit icons to browser repo
Browse files Browse the repository at this point in the history
  • Loading branch information
acatarineu committed Oct 4, 2019
1 parent a07b24b commit 70eb988
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 71 deletions.
54 changes: 0 additions & 54 deletions chrome/content/torbutton.js
Expand Up @@ -361,60 +361,6 @@ function torbutton_init() {
torbutton_log(1, "registering Tor check observer");
torbutton_tor_check_observer.register();

// Add torbutton and security level buttons to the bar.
// This should maybe be in the startup function, but we want to add
// the button to the panel before it's state (color) is set..
let insertedButton = m_tb_prefs.getBoolPref("extensions.torbutton.inserted_button");
let insertedSecurityLevel = m_tb_prefs.getBoolPref("extensions.torbutton.inserted_security_level");
if (!insertedButton || !insertedSecurityLevel) {
try {
// ESR31-style toolbar is handled by the existing compiled-in pref.
// We also need to prevent first-run toolbar reorg (#13378), so we
// reset this toolbar state on first-run.
try {
// get serialized toolbar state
let uiCustomizationStateJSON = m_tb_prefs.getStringPref("browser.uiCustomization.state");
let uiCustomizationState = JSON.parse(uiCustomizationStateJSON);

let placeButtonAfterUrlbar = function(navBar, buttonId) {
torbutton_log(3, 'placing ' + buttonId);
// try and remove button if it's present
let buttonIndex = navBar.indexOf(buttonId);
if (buttonIndex != -1) {
navBar.splice(buttonIndex, 1);
}
// if urlbar isn't present (which *shouldn't* be possible),
// inserts button at the beginning of the toolbar (since urlbarIndex will be -1)
let urlbarIndex = navBar.indexOf("urlbar-container");
buttonIndex = urlbarIndex + 1;
navBar.splice(buttonIndex, 0, buttonId);
};

// array of navbar elements
let navBar = uiCustomizationState["placements"]["nav-bar"];
placeButtonAfterUrlbar(navBar, "security-level-button");
placeButtonAfterUrlbar(navBar, "torbutton-button");

// serialize back into pref
uiCustomizationStateJSON = JSON.stringify(uiCustomizationState, null, 0);
m_tb_prefs.setStringPref("browser.uiCustomization.state", uiCustomizationStateJSON);
} catch(e) {
torbutton_log(4, 'error updating toolbar, reverting to default : ' + e);
// reverts the serialized toolbar state to default set in Tor Browser
m_tb_prefs.clearUserPref("browser.uiCustomization.state");
}
// reverts toolbar state to firefox defaults
CustomizableUI.reset();
// 'restores' toolbar state from serialized state in "browser.uiCustomization.state"
CustomizableUI.undoReset();
torbutton_log(3, 'toolbar updated');
m_tb_prefs.setBoolPref("extensions.torbutton.inserted_button", true);
m_tb_prefs.setBoolPref("extensions.torbutton.inserted_security_level", true);
} catch(e) {
torbutton_log(4, 'failed to update the toolbar : ' + e);
}
}

torbutton_update_toolbutton();
torbutton_notify_if_update_needed();

Expand Down
8 changes: 0 additions & 8 deletions chrome/skin/new_circuit.svg

This file was deleted.

10 changes: 1 addition & 9 deletions chrome/skin/torbutton.css
Expand Up @@ -58,12 +58,4 @@ svg#tor-circuit circle.node-circle {
stroke: #195021;
stroke-width: 2px;
fill: white;
}

#appMenuNewIdentity {
list-style-image: url("chrome://browser/skin/reload.svg");
}

#appMenuNewCircuit {
list-style-image: url("chrome://torbutton/skin/new_circuit.svg");
}
}

0 comments on commit 70eb988

Please sign in to comment.