diff --git a/content/api-message.js b/content/api-message.js index adad654..e63f8a2 100644 --- a/content/api-message.js +++ b/content/api-message.js @@ -1,6 +1,6 @@ import {App} from './app.js'; -// ---------- API Message Handler (Side Effect) ------------ +// ---------- API Message Handler -------------------------- export class OnMessage { static { @@ -102,11 +102,12 @@ export class OnMessage { } } + // https://bugzilla.mozilla.org/show_bug.cgi?id=1670278 + // Enable extensions to send network requests (fetch) with a specific cookieStoreId (container tab context) + // if privacy.firstparty.isolate = true + // Error: First-Party Isolation is enabled, but the required 'firstPartyDomain' attribute was not set. static async addCookie(url, headers, storeId) { // add contextual cookies, only in container/incognito - // https://bugzilla.mozilla.org/show_bug.cgi?id=1670278 - // if privacy.firstparty.isolate = true - // Error: First-Party Isolation is enabled, but the required 'firstPartyDomain' attribute was not set. const cookies = await browser.cookies.getAll({url, storeId}); const str = cookies && cookies.map(item => `${item.name}=${item.value}`).join('; '); str && (headers['FM-Contextual-Cookie'] = str); diff --git a/content/api.js b/content/api.js index a8962f1..d8cd295 100644 --- a/content/api.js +++ b/content/api.js @@ -79,7 +79,7 @@ browser.userScripts.onBeforeScript.addListener(script => { height: 100%; top: 0; left: 0; - background: rgba(0, 0, 0, 0.4); + background: #0008; } @keyframes center { @@ -253,7 +253,7 @@ browser.userScripts.onBeforeScript.addListener(script => { } // check protocol - if (!['http:', 'https:'].includes(url.protocol)) { + if (!['http:', 'https:', 'blob:'].includes(url.protocol)) { API.log(`checkURL ${url} ➜ Unsupported Protocol ${url.protocol}`); return; } @@ -268,6 +268,7 @@ browser.userScripts.onBeforeScript.addListener(script => { 'access-control-request-method', 'connection', 'content-length', 'cookie2', 'date', 'dnt', 'expect', 'keep-alive', 'te', 'trailer', 'transfer-encoding', 'upgrade', 'via']; + init.headers ||= {}; // check init.headers Object.keys(init.headers).forEach(item => { const LC = item.toLowerCase(); if (LC.startsWith('proxy-') || LC.startsWith('sec-') || forbiddenHeader.includes(LC)) { @@ -315,13 +316,13 @@ browser.userScripts.onBeforeScript.addListener(script => { In order to make callback functions visible ONLY for GM.xmlHttpRequest(GM_xmlhttpRequest) */ - static callUserScriptCallback(object, name, ...args) { + static userScriptCallback(object, name, ...args) { try { const cb = object.wrappedJSObject[name]; typeof cb === 'function' && cb(...args); } catch(error) { - API.log(`callUserScriptCallback ➜ ${error.message}`); + API.log(`userScriptCallback ➜ ${error.message}`); } } } @@ -514,7 +515,7 @@ browser.userScripts.onBeforeScript.addListener(script => { // convert text responseXML to XML DocumentFragment response.responseXML && (response.responseXML = document.createRange().createContextualFragment(response.responseXML.trim())); - API.callUserScriptCallback(init, type, + API.userScriptCallback(init, type, typeof response.response === 'string' ? script.export(response) : cloneInto(response, window)); }, // ---------- /other background functions -------------- diff --git a/content/default.css b/content/default.css index 8d80b17..304a63b 100644 --- a/content/default.css +++ b/content/default.css @@ -6,7 +6,7 @@ body.dark { --hover: #888; --btn-bg: #666; --border: #777; - --option-bg: #444; + --alt-bg: #444; --link: #0ef; --dim: #ccc; @@ -27,7 +27,7 @@ body.dark { --hover: #eaeaea; --btn-bg: #f5f5f5; --border: #ddd; - --option-bg: #f5f5f5; + --alt-bg: #f5f5f5; --link: #08f; --dim: #777; @@ -64,10 +64,12 @@ section { select, textarea, input[type="number"], -input[type="text"] { +input[type="text"], +input[type="password"], +input[type="url"] { width: 100%; color: inherit; - background: var(--option-bg); + background-color: var(--alt-bg); border: 1px solid var(--border); border-radius: 0.3em; } diff --git a/content/help.css b/content/help.css index 8355dcd..c9f9150 100644 --- a/content/help.css +++ b/content/help.css @@ -166,7 +166,7 @@ a[href^="https://developer.chrome.com/"]::before, a[href^="https://github.com/"]::before, a[href*=".github.io/"]::before { content: ''; - background: url('../image/dino.svg') no-repeat center / contain; + background: url('../image/logo/dino.svg') no-repeat center / contain; display: inline-block; height: 0.9em; width: 0.9em; @@ -178,25 +178,25 @@ a[href*=".github.io/"]::before { a[href^="https://blog.mozilla.org/"]::before, a[href^="https://developer.mozilla.org/"]::before, a[href^="https://www.mozilla.org/"]::before { - background-image: url('../image/moz.svg'); + background-image: url('../image/logo/moz.svg'); border-radius: 1em; } a[href^="https://bugzilla.mozilla.org/show_bug.cgi?id="]::before { - background-image: url('../image/bugzilla.png'); + background-image: url('../image/logo/bugzilla.png'); } a[href^="https://github.com/"]::before, a[href*=".github.io/"]::before { - background-image: url('../image/github.svg'); + background-image: url('../image/logo/github.svg'); } a[href^="https://codemirror.net/"]::before { - background-image: url('../image/codemirror.svg'); + background-image: url('../image/logo/codemirror.svg'); } a[href^="https://developer.chrome.com/"]::before { - background-image: url('../image/chrome.svg'); + background-image: url('../image/logo/chrome.svg'); } /* ----- Navigation ----- */ @@ -260,11 +260,11 @@ nav ul::after { } nav li { - padding: 0.2em 0.5em; white-space: nowrap; position: relative; } + nav li.arrow::after { content: '›'; position: absolute; @@ -386,7 +386,6 @@ cite::before { content: '— source: '; } - kbd { color: #333; padding: 0.1em 0.4em; diff --git a/content/help.html b/content/help.html index 0935df0..5671462 100644 --- a/content/help.html +++ b/content/help.html @@ -753,7 +753,7 @@