Skip to content

Commit fd86f18

Browse files
committed
Reduce console spam by deferring the logging of messaging errors due to premature unloading (tor-browser#44673).
1 parent daf5182 commit fd86f18

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/content/staticNS.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@
108108
policy = await Messages.send(msg.id, msg) || this.domPolicy;
109109
debug("Asynchronous policy", policy);
110110
} catch (e) {
111-
error(e, "(Asynchronous policy fetch)");
111+
if (/An unexpected error occurred/.test(e)) {
112+
// This might be just the browser context unloading:
113+
// if that's the case, deferring suppresses the console spam
114+
setTimeout(() => error(e, "(deferred - Asynchronous policy fetch)"), 0);
115+
} else {
116+
error(e, "(Asynchronous policy fetch)");
117+
}
112118
}
113119
}
114120
setup(policy);

0 commit comments

Comments
 (0)