Skip to content

Commit

Permalink
Merge pull request #370 from Shared-Reality-Lab/error-popup
Browse files Browse the repository at this point in the history
fix: error popup for image
  • Loading branch information
jaydeepsingh25 committed Jan 4, 2024
2 parents 04bf19c + 8b5f1a0 commit 9e5f03e
Showing 1 changed file with 11 additions and 2 deletions.
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

0 comments on commit 9e5f03e

Please sign in to comment.