tor-browser

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

bridgeQrDialog.js (798B)


      1 "use strict";
      2 
      3 const { QRCode } = ChromeUtils.importESModule(
      4  "resource://gre/modules/QRCode.sys.mjs"
      5 );
      6 
      7 window.addEventListener(
      8  "DOMContentLoaded",
      9  () => {
     10    const bridgeString = window.arguments[0];
     11 
     12    const target = document.getElementById("bridgeQr-target");
     13    const style = window.getComputedStyle(target);
     14    // We are assuming that the style width and height have "px" units.
     15    // Trailing "px" is not parsed.
     16    // NOTE: Our QRCode module doesn't seem to use the width or height
     17    // attributes.
     18    const width = parseInt(style.width, 10);
     19    const height = parseInt(style.height, 10);
     20    new QRCode(target, {
     21      text: bridgeString,
     22      width,
     23      height,
     24      colorDark: style.color,
     25      colorLight: style.backgroundColor,
     26    });
     27  },
     28  { once: true }
     29 );