console.log("content.js loaded", window.wrappedJSObject); // setTimeout(() => { const getContextStack = () => window.wrappedJSObject.getContextStack(); const updateContextValue = (key, value, depth) => window.wrappedJSObject.updateContextValue(key, value, depth); console.log(getContextStack()); browser.runtime.onMessage.addListener((message, sender, sendResponse) => { if (message.type === "GET_CONTEXT_STACK") { const contextStack = getContextStack(); sendResponse({ contextStack }); } else if (message.type === "UPDATE_CONTEXT_VALUE") { const { key, value, depth } = message; if (glowindow.updateContextValue) { updateContextValue(key, value, depth); sendResponse({ success: true }); } else { sendResponse({ success: false, error: "updateContextValue not defined", }); } } }); // }, 0);