Closed Bug 1733509 Opened 3 years ago Closed 7 days ago

PositionedEventTargeting.cpp calls GetResolution

Categories

(Core :: Panning and Zooming, defect, P3)

Unspecified
Android
defect

Tracking

()

RESOLVED FIXED
127 Branch
Tracking Status
firefox127 --- fixed

People

(Reporter: tnikkel, Assigned: ajakobi)

References

(Blocks 1 open bug)

Details

(Whiteboard: [fxdroid][foundation])

Attachments

(1 file)

Fission Milestone: --- → Future
Blocks: 1715932

(In reply to Timothy Nikkel (:tnikkel) from comment #0)

This code might need changes when fission comes to android.

In that case, I will tag this bug to be tracked for Android Fission.

Whiteboard: [fission:android:m4]
Severity: -- → S3
Priority: -- → P3
Fission Milestone: Future → ---

It turned out that the pres shell in AppUnitsFromMM in question is NOT the top level one, it's for the document where the event happens regardless of whether it's in OOP or not. So for example, even without Fission if I clicked inside an iframe element, the GetResolution always returns 1.0. So this bug is definitely valid, but it's not for Fission specific, it's been there since the beginning of our event retarget system. And as far as I can tell no one had reported this issue until Timothy found the code flaw.

With the reason I'd say this bug doesn't need to block Android Fission. Chris, what do you think?

Flags: needinfo?(cpeterson)

This code is only executed on Android, where we haven't enabled fission, so we wouldn't expect anyone to find it except my reading the code.

(In reply to Timothy Nikkel (:tnikkel) from comment #3)

This code is only executed on Android, where we haven't enabled fission, so we wouldn't expect anyone to find it except my reading the code.

So it sounds like this bug is still valid, but will only affect Android Fission. If that's correct, I'll still track this bug for Android Fission.

Flags: needinfo?(cpeterson)

This bug has already been there without enabling Fission on Android, that's what I meant.

(In reply to Hiroyuki Ikezoe (:hiro) from comment #5)

This bug has already been there without enabling Fission on Android, that's what I meant.

To be clear, Android users should be able to find this bug without enabling Fission by clicking somewhere inside an iframe on a zoomed in/out content. With the content, event-retargetting doesn't work as what the code is supposed to. I presume people isn't so severe where event re-targetting happened or not.

Thanks for the clarification. In that case, I won't track this bug as a blocker for Android Fission.

OS: Unspecified → Android
Whiteboard: [fission:android:m4]

My apologies Hiro, I didn't read comment 2 closely enough.

No longer blocks: gv-fission
See Also: → gv-fission
Assignee: nobody → ajakobi
Whiteboard: [fxdroid][foundation]
Attachment #9392596 - Attachment description: WIP: Bug 1733509 - Use TryInferEnclosingResolution for event retargeting. r=botond → Bug 1733509 - Use TryInferEnclosingResolution for event retargeting. r=botond
Pushed by bballo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/6affdb4f3016
Use TryInferEnclosingResolution for event retargeting. r=botond

Failure log -> PROCESS-CRASH | MOZ_ASSERT(!aShell->GetPresContext()->GetParentPresContext()) (TryInferEnclosingResolution can only be called for a root pres shell within a process)

I guess the in-process root content document (what we are passing to TryInferEnclosingResolution) is not necessarily always the root of the entire document hierarchy in the process (what TryInferEnclosingResolution is asserting), i.e. sometimes there is a chrome document enclosing the root content document.

(It's interesting to note the failure is in ExtensionActionTest#testOpenPopup, suggesting that the scenario where this doesn't hold is related to popups.)

Suggested fix: make an additional call to GetRootPresContext() before calling TryInferEnclosingResolution().

(Note: we don't want to replace the call to GetInProcessRootContentDocumentPresContext() with GetRootPresContext(), because for the resolution we do want the root content document.)

I think TryInferEnclosingResolution was originally supposed to be called in a content process.

And it looks like the JUnit test runs with extensions.webextensions.remote=false (which is not our default value), thus the popup document gets loaded in the parent process as a content document.

If we allow such situations, I think we can just drop the assertion entirely from the function, this IsTopLevel() check handles the situations properly.

Thanks, Hiro. Removing the assertion of course seems to be the easiest fix. Botond, what do you think?

Flags: needinfo?(ajakobi)

(In reply to Alex Jakobi [:ajakobi] from comment #14)

Removing the assertion of course seems to be the easiest fix. Botond, what do you think?

I think the assertion is helpful to catch the scenario where the caller passes in a subdocument in the content process of an OOP iframe. In that scenario, the OOP iframe may in fact be subject to an enclosing resolution, but the function would just silently return 1.0f instead.

As an alternative suggestion, perhaps we can add an early-return if (!XRE_IsContentProcess()) to the function (before the assertion)?

Pushed by bballo@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5fd9adde57f1
Use TryInferEnclosingResolution for event retargeting. r=botond
Status: NEW → RESOLVED
Closed: 7 days ago
Resolution: --- → FIXED
Target Milestone: --- → 127 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: