tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

bug1878024-g1.globo.com-fix-account-icon.js (1206B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 "use strict";
      6 
      7 /**
      8 * Bug 1878024 - g1.globo.com squashed account icons
      9 *
     10 * Account icons appear to be squashed due to bug 1700474 with flex-sizing.
     11 * This works around the issue by adding CSS to the relevant web component.
     12 */
     13 
     14 /* globals exportFunction */
     15 
     16 const ENABLED_MESSAGE =
     17  "Extra CSS to fix account icons is being applied to the nova-barra-globocom web component. See https://bugzilla.mozilla.org/show_bug.cgi?id=1878024 for details.";
     18 
     19 const { appendChild } = DocumentFragment.prototype.wrappedJSObject;
     20 
     21 ShadowRoot.wrappedJSObject.prototype.appendChild = exportFunction(function (
     22  child
     23 ) {
     24  if (this.host?.localName === "nova-barra-globocom") {
     25    const style = child.querySelector("style");
     26    if (style) {
     27      console.info(ENABLED_MESSAGE);
     28      style.textContent = `${style.textContent} .base-container .button-login-icon img { flex-shrink: 0; }`;
     29    }
     30    delete ShadowRoot.wrappedJSObject.prototype.appendChild;
     31  }
     32  return appendChild.call(this, child);
     33 }, window);