forked from icd/rentgen
feat(extension): dodaj console.error logi dla weryfikacji działania
Dodano console.error logi w kluczowych punktach extensiona: - Inicjalizacja extensiona (init()) - Konstruktor Memory (setup webRequest listeners) - Pierwszy przechwycony request **Uwaga:** Te logi są widoczne tylko w Firefox Browser Console (Ctrl+Shift+J), nie w web-ext stdout. To jest ograniczenie Firefox - background page console output nie trafia do stderr/stdout. Zaktualizowano też skrypt test_start_extension.sh aby szukał logów [RENTGEN] w przypadku gdy byłyby widoczne. Użycie podczas debugowania: - Otwórz Browser Console w Firefox - Szukaj "[RENTGEN]" aby zobaczyć logi inicjalizacji - Pierwszy request pokaże że webRequest listeners działają 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
732af33ded
commit
78fc30b804
11
memory.ts
11
memory.ts
@ -13,7 +13,14 @@ function setDomainsCount(counter: number, tabId: number) {
|
||||
|
||||
export default class Memory extends SaferEmitter {
|
||||
origin_to_history = {} as Record<string, Record<string, RequestCluster>>;
|
||||
private firstRequestLogged = false;
|
||||
|
||||
async register(request: ExtendedRequest) {
|
||||
// Log first intercepted request to confirm extension is working
|
||||
if (!this.firstRequestLogged) {
|
||||
console.error('[RENTGEN] First request intercepted!', request.url);
|
||||
this.firstRequestLogged = true;
|
||||
}
|
||||
await request.init();
|
||||
if (!request.isThirdParty()) {
|
||||
return;
|
||||
@ -45,6 +52,7 @@ export default class Memory extends SaferEmitter {
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
console.error('[RENTGEN] Memory constructor starting - setting up webRequest listeners...');
|
||||
|
||||
browser.webRequest.onBeforeRequest.addListener(
|
||||
async (request) => {
|
||||
@ -63,6 +71,7 @@ export default class Memory extends SaferEmitter {
|
||||
{ urls: ['<all_urls>'] },
|
||||
['requestHeaders']
|
||||
);
|
||||
console.error('[RENTGEN] Memory constructor complete - webRequest listeners registered for all URLs!');
|
||||
}
|
||||
|
||||
emit(eventName: string, data = 'any'): boolean {
|
||||
@ -100,9 +109,11 @@ export default class Memory extends SaferEmitter {
|
||||
}
|
||||
|
||||
export function init() {
|
||||
console.error('[RENTGEN] Extension initializing...');
|
||||
const memory = new Memory();
|
||||
|
||||
(window as any).memory = memory;
|
||||
console.error('[RENTGEN] Extension initialized successfully! Ready to intercept requests.');
|
||||
}
|
||||
|
||||
export function getMemory(): Memory {
|
||||
|
||||
@ -29,12 +29,23 @@ WEBEXT_PID=$!
|
||||
|
||||
# Wait for extension installation confirmation
|
||||
echo "Waiting for extension to install..."
|
||||
EXTENSION_CODE_EXECUTED=false
|
||||
for i in {1..30}; do
|
||||
if grep -q "Installed /app as a temporary add-on" /tmp/web-ext.log 2>/dev/null; then
|
||||
echo "========================================"
|
||||
echo "✓ SUCCESS: Extension installed!"
|
||||
echo "✓ Firefox is running in headless mode"
|
||||
echo "✓ Extension: rentgen@internet-czas-dzialac.pl"
|
||||
|
||||
# Check if extension code actually executed
|
||||
sleep 2
|
||||
if grep -q "\[RENTGEN\] Extension initialized successfully!" /tmp/web-ext.log 2>/dev/null; then
|
||||
echo "✓ Extension code executed - webRequest listeners active!"
|
||||
EXTENSION_CODE_EXECUTED=true
|
||||
else
|
||||
echo "⚠ Extension installed but code execution not confirmed yet..."
|
||||
fi
|
||||
|
||||
echo "✓ Process info:"
|
||||
ps aux | grep -E "(firefox|Xvfb)" | grep -v grep | head -3
|
||||
echo "========================================"
|
||||
@ -44,5 +55,13 @@ for i in {1..30}; do
|
||||
sleep 1
|
||||
done
|
||||
|
||||
# Show Rentgen-specific logs if found
|
||||
if [ "$EXTENSION_CODE_EXECUTED" = true ]; then
|
||||
echo ""
|
||||
echo "Extension initialization logs:"
|
||||
grep "\[RENTGEN\]" /tmp/web-ext.log 2>/dev/null | head -5 || true
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Keep container running and show logs
|
||||
wait $WEBEXT_PID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user