cambridgeDictionaryLogin.js (1083B)
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=1993727 for details.` 9 ); 10 11 // Third-party origin we need to request storage access for. 12 const STORAGE_ACCESS_ORIGIN = "https://accounts.eu1.gigya.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( 22 "span.cdo-login-button, span.cdo-register-button" 23 ); 24 if (!loginElement) { 25 return; 26 } 27 28 console.warn( 29 "Calling the Storage Access API on behalf of " + STORAGE_ACCESS_ORIGIN 30 ); 31 e.stopPropagation(); 32 e.preventDefault(); 33 document.requestStorageAccessForOrigin(STORAGE_ACCESS_ORIGIN).then(() => { 34 target.click(); 35 }); 36 }, 37 true 38 );