|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
(function() {
|
|
|
'use strict';
|
|
|
|
|
|
|
|
|
const originalError = console.error;
|
|
|
const originalWarn = console.warn;
|
|
|
|
|
|
|
|
|
const suppressedPatterns = [
|
|
|
|
|
|
/Failed to fetch.*via SSE/i,
|
|
|
/SSE Stream ended with error/i,
|
|
|
/BodyStreamBuffer was aborted/i,
|
|
|
/SpaceHeader.*\.js/i,
|
|
|
/AbortError.*BodyStreamBuffer/i,
|
|
|
|
|
|
|
|
|
/Unrecognized feature.*permissions-policy/i,
|
|
|
/Unrecognized feature: 'ambient-light-sensor'/i,
|
|
|
/Unrecognized feature: 'battery'/i,
|
|
|
/Unrecognized feature: 'document-domain'/i,
|
|
|
/Unrecognized feature: 'layout-animations'/i,
|
|
|
/Unrecognized feature: 'legacy-image-formats'/i,
|
|
|
/Unrecognized feature: 'oversized-images'/i,
|
|
|
/Unrecognized feature: 'vr'/i,
|
|
|
/Unrecognized feature: 'wake-lock'/i,
|
|
|
|
|
|
|
|
|
/index\.js.*SSE/i,
|
|
|
/onStateChange.*SSE/i
|
|
|
];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function shouldSuppress(message) {
|
|
|
if (!message) return false;
|
|
|
|
|
|
const messageStr = typeof message === 'string' ? message : String(message);
|
|
|
|
|
|
return suppressedPatterns.some(pattern => {
|
|
|
try {
|
|
|
return pattern.test(messageStr);
|
|
|
} catch (e) {
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.error = function(...args) {
|
|
|
const message = args[0];
|
|
|
|
|
|
|
|
|
if (shouldSuppress(message)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
originalError.apply(console, args);
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
console.warn = function(...args) {
|
|
|
const message = args[0];
|
|
|
|
|
|
|
|
|
if (shouldSuppress(message)) {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
|
|
|
originalWarn.apply(console, args);
|
|
|
};
|
|
|
|
|
|
|
|
|
window.addEventListener('error', function(event) {
|
|
|
if (shouldSuppress(event.message)) {
|
|
|
event.preventDefault();
|
|
|
event.stopPropagation();
|
|
|
return false;
|
|
|
}
|
|
|
}, true);
|
|
|
|
|
|
|
|
|
window.addEventListener('unhandledrejection', function(event) {
|
|
|
const reason = event.reason;
|
|
|
const message = reason?.message || reason?.toString() || '';
|
|
|
|
|
|
if (shouldSuppress(message)) {
|
|
|
event.preventDefault();
|
|
|
return false;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
console.log('[Error Suppressor] External service error filtering enabled');
|
|
|
})();
|
|
|
|
|
|
|