summaryrefslogtreecommitdiffstats
path: root/browser/actors/ContextMenuChild.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/actors/ContextMenuChild.sys.mjs')
-rw-r--r--browser/actors/ContextMenuChild.sys.mjs17
1 files changed, 17 insertions, 0 deletions
diff --git a/browser/actors/ContextMenuChild.sys.mjs b/browser/actors/ContextMenuChild.sys.mjs
index 5ecbcb22e9..2b98bea65e 100644
--- a/browser/actors/ContextMenuChild.sys.mjs
+++ b/browser/actors/ContextMenuChild.sys.mjs
@@ -535,6 +535,23 @@ export class ContextMenuChild extends JSWindowActorChild {
}
let doc = aEvent.composedTarget.ownerDocument;
+ if (!doc && Cu.isInAutomation) {
+ // doc has been observed to be null for many years, causing intermittent
+ // test failures all over the place (bug 1478596). The rate of failures
+ // is too low to debug locally, but frequent enough to be a nuisance.
+ // TODO bug 1478596: use these diagnostic logs to resolve the bug.
+ dump(
+ `doc is unexpectedly null (bug 1478596), composedTarget=${aEvent.composedTarget}\n`
+ );
+ // A potential fix is to fall back to aEvent.target.ownerDocument, per
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1478596#c1
+ // Let's print potentially viable alternatives to see what we should use.
+ for (let k of ["target", "originalTarget", "explicitOriginalTarget"]) {
+ dump(
+ ` Alternative: ${k}=${aEvent[k]} and its doc=${aEvent[k]?.ownerDocument}\n`
+ );
+ }
+ }
let {
mozDocumentURIIfNotForErrorPages: docLocation,
characterSet: charSet,