tor-browser

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

artstationLogin.js (1047B)


      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 console.warn(
      8  `When logging in, Firefox calls the Storage Access API on behalf of the site. See https://bugzilla.mozilla.org/show_bug.cgi?id=1926551 for details.`
      9 );
     10 
     11 // Third-party origin we need to request storage access for.
     12 const STORAGE_ACCESS_ORIGIN = "https://accounts.google.com";
     13 
     14 document.documentElement.addEventListener(
     15  "click",
     16  e => {
     17    const { target, isTrusted } = e;
     18    if (!isTrusted) {
     19      return;
     20    }
     21    const loginElement = target.closest("btn.js-google-login-button");
     22    if (!loginElement) {
     23      return;
     24    }
     25 
     26    console.warn(
     27      "Calling the Storage Access API on behalf of " + STORAGE_ACCESS_ORIGIN
     28    );
     29    e.stopPropagation();
     30    e.preventDefault();
     31    document.requestStorageAccessForOrigin(STORAGE_ACCESS_ORIGIN).then(() => {
     32      target.click();
     33    });
     34  },
     35  true
     36 );