-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent.js
More file actions
22 lines (19 loc) · 878 Bytes
/
content.js
File metadata and controls
22 lines (19 loc) · 878 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// content.js - ISOLATED WORLD
console.log('[Sentience] Bridge loaded.');
// 1. Pass Extension ID to Main World (So WASM knows where to load from)
document.documentElement.dataset.sentienceExtensionId = chrome.runtime.id;
// 2. Proxy for Screenshots (The only thing Isolated World needs to do)
window.addEventListener('message', (event) => {
// Security check: only accept messages from same window
if (event.source !== window || event.data.type !== 'SENTIENCE_SCREENSHOT_REQUEST') return;
chrome.runtime.sendMessage(
{ action: 'captureScreenshot', options: event.data.options },
(response) => {
window.postMessage({
type: 'SENTIENCE_SCREENSHOT_RESULT',
requestId: event.data.requestId,
screenshot: response?.success ? response.screenshot : null
}, '*');
}
);
});