Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: error popup for image #370

Merged
merged 1 commit into from
Jan 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,7 @@ async function updateDebugContextMenu() {
}

function storeConnection(p: Runtime.Port) {
//console.debug("store Connection");
let id = p.sender?.tab?.id;
if (id) {
ports[id] = p;
Expand All @@ -371,6 +372,7 @@ function storeConnection(p: Runtime.Port) {
}
});
}
//console.debug("Store Connection ports", ports);
}

/*Enable the context menu options*/
Expand Down Expand Up @@ -491,8 +493,9 @@ browser.commands.onCommand.addListener((command) => {
});

browser.contextMenus.onClicked.addListener((info, tab) => {
console.debug(info);
if (tab?.id) {
//console.debug("Tab", tab);
//console.debug("ports", ports);
if (tab?.id && ports[tab.id]) {
// Request image from page
if (info.menuItemId === "mwe-item") {
ports[tab.id].postMessage({
Expand All @@ -512,6 +515,12 @@ browser.contextMenus.onClicked.addListener((info, tab) => {
}
} else {
console.error("No tab passed to context menu listener!");
windowsPanel ? browser.windows.create({
type: "panel",
url: "errors/http_error.html"
}) : browser.tabs.create({
url: "errors/http_error.html",
});
}
});

Expand Down
Loading