microsoftLogin.js (1075B)
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 const SANDBOX_ATTR = "allow-storage-access-by-user-activation"; 6 7 console.warn( 8 "Firefox calls the Storage Access API on behalf of the site. See https://bugzilla.mozilla.org/show_bug.cgi?id=1638383 for details." 9 ); 10 11 // Watches for MS auth iframes and adds missing sandbox attribute. The attribute 12 // is required so the third-party iframe can gain access to its first party 13 // storage via the Storage Access API. 14 function init() { 15 const observer = new MutationObserver(() => { 16 document.body 17 .querySelectorAll( 18 `iframe:is([id^='msalRenewFrame'], [src^="https://login.microsoftonline.com"])[sandbox]` 19 ) 20 .forEach(frame => { 21 frame.sandbox.add(SANDBOX_ATTR); 22 }); 23 }); 24 25 observer.observe(document.body, { 26 attributes: true, 27 subtree: false, 28 childList: true, 29 }); 30 } 31 window.addEventListener("DOMContentLoaded", init);