forked from icd/rentgen
Implementacja wzorca: background → event → content script → DOM Jak działa: 1. Background script tworzy testową stronę (browser.tabs.create) 2. Content script wstrzykiwany do tej strony (<all_urls>) 3. Content script modyfikuje DOM (document.body.setAttribute) 4. Content script loguje marker do konsoli 5. Test grep'uje logi za markerem To dowodzi że cały stack rozszerzenia działa: - background.ts wykonany - browser.tabs.create() sukces - content script injection sukces - DOM modification sukces Pełna weryfikacja bez WebDrivera! 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
23 lines
785 B
TypeScript
23 lines
785 B
TypeScript
import { init } from "./memory";
|
|
|
|
// Use global browser object directly (available in extension context)
|
|
declare const browser: any;
|
|
|
|
init();
|
|
|
|
// Test verification: Open a test page to trigger content script
|
|
// This proves: background → tabs.create() → content script injection → DOM modification
|
|
if (typeof browser !== 'undefined' && browser.tabs) {
|
|
browser.tabs.create({
|
|
url: 'data:text/html,<html><head><title>Rentgen Test Page</title></head><body><h1>Test</h1></body></html>',
|
|
active: false
|
|
}).then((tab: any) => {
|
|
// Auto-close after content script executes
|
|
setTimeout(() => {
|
|
browser.tabs.remove(tab.id).catch(() => {});
|
|
}, 2000);
|
|
}).catch(() => {
|
|
// Silently fail if tabs API not available
|
|
});
|
|
}
|