summaryrefslogtreecommitdiffstats
path: root/browser/actors
diff options
context:
space:
mode:
Diffstat (limited to 'browser/actors')
-rw-r--r--browser/actors/ClickHandlerParent.sys.mjs3
-rw-r--r--browser/actors/ContentSearchParent.sys.mjs6
-rw-r--r--browser/actors/ContextMenuChild.sys.mjs17
-rw-r--r--browser/actors/ScreenshotsComponentChild.sys.mjs53
-rw-r--r--browser/actors/SearchSERPTelemetryChild.sys.mjs16
5 files changed, 58 insertions, 37 deletions
diff --git a/browser/actors/ClickHandlerParent.sys.mjs b/browser/actors/ClickHandlerParent.sys.mjs
index 4078c6404f..bdb722d958 100644
--- a/browser/actors/ClickHandlerParent.sys.mjs
+++ b/browser/actors/ClickHandlerParent.sys.mjs
@@ -6,6 +6,7 @@
const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
+ BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
PlacesUIUtils: "resource:///modules/PlacesUIUtils.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
@@ -99,7 +100,7 @@ export class ClickHandlerParent extends JSWindowActorParent {
}
// This part is based on handleLinkClick.
- var where = window.whereToOpenLink(data);
+ var where = lazy.BrowserUtils.whereToOpenLink(data);
if (where == "current") {
return;
}
diff --git a/browser/actors/ContentSearchParent.sys.mjs b/browser/actors/ContentSearchParent.sys.mjs
index 73b881881b..3b27eabd14 100644
--- a/browser/actors/ContentSearchParent.sys.mjs
+++ b/browser/actors/ContentSearchParent.sys.mjs
@@ -6,6 +6,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
BrowserSearchTelemetry: "resource:///modules/BrowserSearchTelemetry.sys.mjs",
+ BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
FormHistory: "resource://gre/modules/FormHistory.sys.mjs",
PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.sys.mjs",
SearchSuggestionController:
@@ -216,7 +217,7 @@ export let ContentSearch = {
// message and the time we handle it.
return;
}
- let where = win.whereToOpenLink(data.originalEvent);
+ let where = lazy.BrowserUtils.whereToOpenLink(data.originalEvent);
// There is a chance that by the time we receive the search message, the user
// has switched away from the tab that triggered the search. If, based on the
@@ -510,10 +511,11 @@ export let ContentSearch = {
lazy.UrlbarPrefs.get("shouldHandOffToSearchMode")
);
break;
- default:
+ default: {
let state = await this.currentStateObj();
this._broadcast("CurrentState", state);
break;
+ }
}
},
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,
diff --git a/browser/actors/ScreenshotsComponentChild.sys.mjs b/browser/actors/ScreenshotsComponentChild.sys.mjs
index 06d7204803..b578dfe7fa 100644
--- a/browser/actors/ScreenshotsComponentChild.sys.mjs
+++ b/browser/actors/ScreenshotsComponentChild.sys.mjs
@@ -48,6 +48,11 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
return this.removeEventListeners();
case "Screenshots:AddEventListeners":
return this.addEventListeners();
+ case "Screenshots:MoveFocusToContent":
+ return this.focusOverlay();
+ case "Screenshots:ClearFocus":
+ Services.focus.clearFocus(this.contentWindow);
+ return null;
}
return null;
}
@@ -64,6 +69,7 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
case "pointerup":
case "keyup":
case "keydown":
+ case "selectionchange":
if (!this.overlay?.initialized) {
return;
}
@@ -98,8 +104,8 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
this.requestDownloadScreenshot(event.detail.region);
break;
case "Screenshots:OverlaySelection": {
- let { hasSelection } = event.detail;
- this.sendOverlaySelection({ hasSelection });
+ let { hasSelection, overlayState } = event.detail;
+ this.sendOverlaySelection({ hasSelection, overlayState });
break;
}
case "Screenshots:RecordEvent": {
@@ -108,10 +114,13 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
break;
}
case "Screenshots:ShowPanel":
- this.showPanel();
+ this.sendAsyncMessage("Screenshots:ShowPanel");
break;
case "Screenshots:HidePanel":
- this.hidePanel();
+ this.sendAsyncMessage("Screenshots:HidePanel");
+ break;
+ case "Screenshots:FocusPanel":
+ this.sendAsyncMessage("Screenshots:MoveFocusToParent", event.detail);
break;
}
}
@@ -150,14 +159,6 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
this.endScreenshotsOverlay({ doNotResetMethods: true });
}
- showPanel() {
- this.sendAsyncMessage("Screenshots:ShowPanel");
- }
-
- hidePanel() {
- this.sendAsyncMessage("Screenshots:HidePanel");
- }
-
getDocumentTitle() {
return this.document.title;
}
@@ -172,6 +173,11 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
return methodsUsed;
}
+ focusOverlay() {
+ this.contentWindow.focus();
+ this.#overlay.focus();
+ }
+
/**
* Resolves when the document is ready to have an overlay injected into it.
*
@@ -220,6 +226,7 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
for (let event of ScreenshotsComponentChild.OVERLAY_EVENTS) {
chromeEventHandler.addEventListener(event, this, true);
}
+ this.document.addEventListener("selectionchange", this);
}
/**
@@ -257,6 +264,7 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
for (let event of ScreenshotsComponentChild.OVERLAY_EVENTS) {
chromeEventHandler.removeEventListener(event, this, true);
}
+ this.document.removeEventListener("selectionchange", this);
}
/**
@@ -308,8 +316,8 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
let rect = {
left: scrollMinX,
top: scrollMinY,
- right: scrollWidth,
- bottom: scrollHeight,
+ right: scrollMinX + scrollWidth,
+ bottom: scrollMinY + scrollHeight,
width: scrollWidth,
height: scrollHeight,
devicePixelRatio,
@@ -341,13 +349,18 @@ export class ScreenshotsComponentChild extends JSWindowActorChild {
* The height of the content window.
*/
getVisibleBounds() {
- let { scrollX, scrollY, clientWidth, clientHeight, devicePixelRatio } =
- this.#overlay.windowDimensions.dimensions;
+ let {
+ pageScrollX,
+ pageScrollY,
+ clientWidth,
+ clientHeight,
+ devicePixelRatio,
+ } = this.#overlay.windowDimensions.dimensions;
let rect = {
- left: scrollX,
- top: scrollY,
- right: scrollX + clientWidth,
- bottom: scrollY + clientHeight,
+ left: pageScrollX,
+ top: pageScrollY,
+ right: pageScrollX + clientWidth,
+ bottom: pageScrollY + clientHeight,
width: clientWidth,
height: clientHeight,
devicePixelRatio,
diff --git a/browser/actors/SearchSERPTelemetryChild.sys.mjs b/browser/actors/SearchSERPTelemetryChild.sys.mjs
index e845f589b0..b2b78941ad 100644
--- a/browser/actors/SearchSERPTelemetryChild.sys.mjs
+++ b/browser/actors/SearchSERPTelemetryChild.sys.mjs
@@ -13,13 +13,6 @@ ChromeUtils.defineESModuleGetters(lazy, {
XPCOMUtils.defineLazyPreferenceGetter(
lazy,
- "serpEventsEnabled",
- "browser.search.serpEventTelemetry.enabled",
- true
-);
-
-XPCOMUtils.defineLazyPreferenceGetter(
- lazy,
"serpEventTelemetryCategorization",
"browser.search.serpEventTelemetryCategorization.enabled",
false
@@ -1396,7 +1389,6 @@ export class SearchSERPTelemetryChild extends JSWindowActorChild {
}
if (
- lazy.serpEventsEnabled &&
providerInfo.components?.length &&
(eventType == "load" || eventType == "pageshow")
) {
@@ -1524,17 +1516,13 @@ export class SearchSERPTelemetryChild extends JSWindowActorChild {
// so that we remain consistent with the *.in-content:sap* count for the
// SEARCH_COUNTS histogram.
if (event.persisted) {
+ this.#checkForPageImpressionComponents();
this.#check(event.type);
- if (lazy.serpEventsEnabled) {
- this.#checkForPageImpressionComponents();
- }
}
break;
}
case "DOMContentLoaded": {
- if (lazy.serpEventsEnabled) {
- this.#checkForPageImpressionComponents();
- }
+ this.#checkForPageImpressionComponents();
this.#check(event.type);
break;
}