<commit_before>// Initialize variables
let hostUrl;
let activeTab;
let cookieStoreId;
let page = browser.extension.getBackgroundPage().exposedFunctions;

// Logs the error
function onError(error) {
	console.error(`Error: ${error}`);
}

// Fills the popup page
function fillPopup(tabs) {
	browser.storage.local.get("activeMode")
	.then((items) => {
		document.getElementById("activeModeSwitch").checked = items.activeMode;
		return Promise.resolve();
	}).catch(onError);

	let notifyMessage = page.getNotifyMessage();
	if (notifyMessage !== "") {
		document.getElementById("notify").appendChild(document.createTextNode(notifyMessage));
	}
	// Fill the host site placeholder if it exists
	activeTab = tabs[0];
	if (!page.isAWebpage(activeTab.url)) {
		return Promise.resolve();
	}
	hostUrl = page.getHostname(activeTab.url);

	// Sets the checkbox depending on the if it exists in the set
	cookieStoreId = tabs[0].cookieStoreId;
	if (page.contextualIdentitiesEnabled) {
		document.getElementById("switchToWhiteList").checked = page.whiteList.hasHost(hostUrl, cookieStoreId);
	} else {
		document.getElementById("switchToWhiteList").checked = page.whiteList.hasHost(hostUrl);
	}

	// hostUrl = page.extractMainDomain(hostUrl);
	let hostPlaceholder = document.getElementById("hostwebsite");

	// Append the favicon image of the host site to the beggining of the URL

	if (activeTab.favIconUrl) {
		let faviconImage = new Image();
		faviconImage.src = activeTab.favIconUrl;
		faviconImage.style.width = "1em";
		faviconImage.style.height = "1em";
		hostPlaceholder.appendChild(faviconImage);
	}

	// Sets the Host site placeholder
	hostPlaceholder.appendChild(document.createTextNode(hostUrl));
	if (page.contextualIdentitiesEnabled) {
		let name = page.cache.getNameFromCookieID(cookieStoreId);
		hostPlaceholder.appendChild(document.createTextNode(`\n${name}`));
	}
	return Promise.resolve();
}

browser.tabs.query({
	currentWindow: true,
	active: true
})
.then(fillPopup)
.catch(onError);

function animateSuccess(element) {
	element.classList.add("successAnimated");
	setTimeout(() => {
		element.classList.remove("successAnimated");
	}, 1500);
}

function animateFailure(element) {
	element.classList.add("failureAnimated");
	setTimeout(() => {
		element.classList.remove("failureAnimated");
	}, 1500);
}

// Setting Click Handling
document.getElementById("settings").addEventListener("click", () => {
	browser.runtime.openOptionsPage();
});<commit_msg>Forgot the parentheses around the container name<commit_after>// Initialize variables
let hostUrl;
let activeTab;
let cookieStoreId;
let page = browser.extension.getBackgroundPage().exposedFunctions;

// Logs the error
function onError(error) {
	console.error(`Error: ${error}`);
}

// Fills the popup page
function fillPopup(tabs) {
	browser.storage.local.get("activeMode")
	.then((items) => {
		document.getElementById("activeModeSwitch").checked = items.activeMode;
		return Promise.resolve();
	}).catch(onError);

	let notifyMessage = page.getNotifyMessage();
	if (notifyMessage !== "") {
		document.getElementById("notify").appendChild(document.createTextNode(notifyMessage));
	}
	// Fill the host site placeholder if it exists
	activeTab = tabs[0];
	if (!page.isAWebpage(activeTab.url)) {
		return Promise.resolve();
	}
	hostUrl = page.getHostname(activeTab.url);

	// Sets the checkbox depending on the if it exists in the set
	cookieStoreId = tabs[0].cookieStoreId;
	if (page.contextualIdentitiesEnabled) {
		document.getElementById("switchToWhiteList").checked = page.whiteList.hasHost(hostUrl, cookieStoreId);
	} else {
		document.getElementById("switchToWhiteList").checked = page.whiteList.hasHost(hostUrl);
	}

	// hostUrl = page.extractMainDomain(hostUrl);
	let hostPlaceholder = document.getElementById("hostwebsite");

	// Append the favicon image of the host site to the beggining of the URL

	if (activeTab.favIconUrl) {
		let faviconImage = new Image();
		faviconImage.src = activeTab.favIconUrl;
		faviconImage.style.width = "1em";
		faviconImage.style.height = "1em";
		hostPlaceholder.appendChild(faviconImage);
	}

	// Sets the Host site placeholder
	hostPlaceholder.appendChild(document.createTextNode(hostUrl));
	if (page.contextualIdentitiesEnabled) {
		let name = page.cache.getNameFromCookieID(cookieStoreId);
		hostPlaceholder.appendChild(document.createTextNode(`\n(${name})`));
	}
	return Promise.resolve();
}

browser.tabs.query({
	currentWindow: true,
	active: true
})
.then(fillPopup)
.catch(onError);

function animateSuccess(element) {
	element.classList.add("successAnimated");
	setTimeout(() => {
		element.classList.remove("successAnimated");
	}, 1500);
}

function animateFailure(element) {
	element.classList.add("failureAnimated");
	setTimeout(() => {
		element.classList.remove("failureAnimated");
	}, 1500);
}

// Setting Click Handling
document.getElementById("settings").addEventListener("click", () => {
	browser.runtime.openOptionsPage();
});
{'fraction_non_alphanumeric': 0.13756827837345742, 'fraction_numerical': 0.004855351001416144, 'mean_word_length': 5.690121786197564, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7186773', 'n_tokens_mistral': 1555, 'n_tokens_neox': 1482, 'n_words': 298}