Merge branch 'master' into proxy-support

This commit is contained in:
luke crouch
2021-09-28 17:07:21 -05:00
15 changed files with 483 additions and 197 deletions
+1 -1
View File
@@ -712,7 +712,7 @@ window.assignManager = {
reloadPageInContainer(url, currentUserContextId, userContextId, index, active, neverAsk = false, openerTabId = null) {
const cookieStoreId = backgroundLogic.cookieStoreId(userContextId);
const loadPage = browser.extension.getURL("confirm-page.html");
const loadPage = browser.runtime.getURL("confirm-page.html");
// False represents assignment is not permitted
// If the user has explicitly checked "Never Ask Again" on the warning page we will send them straight there
if (neverAsk) {
+1 -1
View File
@@ -22,7 +22,7 @@ const backgroundLogic = {
},
async getExtensionInfo() {
const manifestPath = browser.extension.getURL("manifest.json");
const manifestPath = browser.runtime.getURL("manifest.json");
const response = await fetch(manifestPath);
const extensionInfo = await response.json();
return extensionInfo;
+10 -10
View File
@@ -7,21 +7,21 @@ async function load() {
redirectUrlElement.textContent = redirectUrl;
appendFavicon(redirectUrl, redirectUrlElement);
const container = await browser.contextualIdentities.get(cookieStoreId);
[...document.querySelectorAll(".container-name")].forEach((containerNameElement) => {
containerNameElement.textContent = container.name;
});
// If default container, button will default to normal HTML content
if (currentCookieStoreId) {
const currentContainer = await browser.contextualIdentities.get(currentCookieStoreId);
document.getElementById("current-container-name").textContent = currentContainer.name;
}
document.getElementById("deny").addEventListener("click", (e) => {
e.preventDefault();
denySubmit(redirectUrl);
});
const container = await browser.contextualIdentities.get(cookieStoreId);
const currentContainer = currentCookieStoreId ? await browser.contextualIdentities.get(currentCookieStoreId) : null;
const currentContainerName = currentContainer ? currentContainer.name : "";
document.querySelectorAll("[data-message-id]").forEach(el => {
const elementData = el.dataset;
const containerName = elementData.messageArg === "container-name" ? container.name : currentContainerName;
el.textContent = browser.i18n.getMessage(elementData.messageId, containerName);
});
document.getElementById("confirm").addEventListener("click", (e) => {
e.preventDefault();
confirmSubmit(redirectUrl, cookieStoreId);
+1 -1
View File
@@ -24,7 +24,7 @@ async function addMessage(message) {
divElement.innerText = message.text;
const imageElement = document.createElement("img");
const imagePath = browser.extension.getURL("/img/container-site-d-24.png");
const imagePath = browser.runtime.getURL("/img/container-site-d-24.png");
const response = await fetch(imagePath);
const blob = await response.blob();
const objectUrl = URL.createObjectURL(blob);
+9
View File
@@ -0,0 +1,9 @@
document.addEventListener("DOMContentLoaded", async () => {
document.querySelectorAll("[data-i18n-message-id]").forEach(el => {
const messageArgs = el.dataset.i18nPlaceholder ? el.dataset.i18nPlaceholder : null;
el.textContent = browser.i18n.getMessage(el.dataset.i18nMessageId, [messageArgs]);
});
document.querySelectorAll("[data-i18n-attribute]").forEach(el => {
el.setAttribute(el.dataset.i18nAttribute, browser.i18n.getMessage(el.dataset.i18nAttributeMessageId));
});
});
+6 -6
View File
@@ -41,7 +41,7 @@ function addRemoveSiteIsolation() {
}
async function getExtensionInfo() {
const manifestPath = browser.extension.getURL("manifest.json");
const manifestPath = browser.runtime.getURL("manifest.json");
const response = await fetch(manifestPath);
const extensionInfo = await response.json();
return extensionInfo;
@@ -924,7 +924,7 @@ Logic.registerPanel(OPEN_NEW_CONTAINER_PICKER, {
// This method is called when the panel is shown.
prepare() {
Logic.listenToPickerBackButton();
document.getElementById("picker-title").textContent = "Open a New Tab in";
document.getElementById("picker-title").textContent = browser.i18n.getMessage("openANewTabIn");
const fragment = document.createDocumentFragment();
const pickedFunction = function (identity) {
try {
@@ -992,7 +992,7 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
});
this._listenerSet = true;
}
document.getElementById("picker-title").textContent = "Manage Containers";
document.getElementById("picker-title").textContent = browser.i18n.getMessage("manageContainers");
const fragment = document.createDocumentFragment();
const pickedFunction = function (identity) {
Logic.showPanel(P_CONTAINER_EDIT, identity);
@@ -1004,7 +1004,7 @@ Logic.registerPanel(MANAGE_CONTAINERS_PICKER, {
<td>
<div class="menu-icon"><img alt="New Container" src="/img/new-16.svg" />
</div>
<span class="menu-text">New Container</span>
<span class="menu-text">${ browser.i18n.getMessage("newContainer") }</span>
</td>
</tr>
</table>
@@ -1108,7 +1108,7 @@ Logic.registerPanel(REOPEN_IN_CONTAINER_PICKER, {
// This method is called when the panel is shown.
async prepare() {
Logic.listenToPickerBackButton();
document.getElementById("picker-title").textContent = "Reopen This Site in";
document.getElementById("picker-title").textContent = browser.i18n.getMessage("reopenThisSiteIn");
const fragment = document.createDocumentFragment();
const currentTab = await Utils.currentTab();
const pickedFunction = function (identity) {
@@ -1201,7 +1201,7 @@ Logic.registerPanel(ALWAYS_OPEN_IN_PICKER, {
// This method is called when the panel is shown.
prepare() {
Logic.listenToPickerBackButton();
document.getElementById("picker-title").textContent = "Reopen This Site in";
document.getElementById("picker-title").textContent = browser.i18n.getMessage("alwaysOpenIn");
const fragment = document.createDocumentFragment();
document.getElementById("new-container-div").innerHTML = "";