Fix up context check

This commit is contained in:
Mario Zechner
2025-10-11 21:41:24 +02:00
parent 8a96741441
commit 63bfe95c18
5 changed files with 19 additions and 29 deletions

View File

@@ -28,13 +28,6 @@ export class RuntimeMessageBridge {
// Returns stringified function that uses window.parent.postMessage
return `
window.__completionCallbacks = [];
// Check if we're in an extension context by examining the URL
window.__isExtensionContext = () => {
const url = window.location.href;
return url.startsWith('chrome-extension://') ||
url.startsWith('moz-extension://') ||
url === 'about:srcdoc';
};
window.sendRuntimeMessage = async (message) => {
const messageId = 'msg_' + Date.now() + '_' + Math.random().toString(36).substring(2, 9);
@@ -75,13 +68,6 @@ window.onCompleted = (callback) => {
// Returns stringified function that uses chrome.runtime.sendMessage
return `
window.__completionCallbacks = [];
// Check if we're in an extension context by examining the URL
window.__isExtensionContext = () => {
const url = window.location.href;
return url.startsWith('chrome-extension://') ||
url.startsWith('moz-extension://') ||
url === 'about:srcdoc';
};
window.sendRuntimeMessage = async (message) => {
return await chrome.runtime.sendMessage({
...message,