Closed Bug 1433883 Opened 6 years ago Closed 6 years ago

Remove the weak pres context pointer from ContentEventHandler.

Categories

(Core :: DOM: Events, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: emilio, Assigned: emilio)

Details

Attachments

(1 file)

Holding a weak pres context pointer across stuff that does flushes is dangerous.

Hopefully, we just poke at it when we find a frame (thus a pres context should be around, and it rather be the one that we started poking at).

I think it'd be better to just not keep the member around, since frames can reach the pres context easily.
Comment on attachment 8946220 [details]
Bug 1433883: Remove weak pres context pointer from ContentEventHandler.

https://reviewboard.mozilla.org/r/216194/#review221994

::: dom/events/ContentEventHandler.cpp:519
(Diff revision 1)
>    NS_ENSURE_SUCCESS(rv, rv);
>  
> +  nsPresContext* presContext = frame->PresContext();
> +
>    // account for any additional frames
> -  while ((frame = frame->GetNextContinuation()) != nullptr) {
> +  while ((frame = frame->GetNextContinuation())) {

nit: remove unnecessary ().

::: dom/events/ContentEventHandler.cpp:2181
(Diff revision 1)
>        rect = LayoutDeviceIntRect::FromUnknownRect(
> -               charRect.ToOutsidePixels(mPresContext->AppUnitsPerDevPixel()));
> +               charRect.ToOutsidePixels(baseFrame->PresContext()->AppUnitsPerDevPixel()));

nit: over 80 characters. please fix it before landing.
Attachment #8946220 - Flags: review?(masayuki) → review+
Comment on attachment 8946220 [details]
Bug 1433883: Remove weak pres context pointer from ContentEventHandler.

https://reviewboard.mozilla.org/r/216194/#review221994

> nit: remove unnecessary ().

I cannot remove this one because clang warns with -Werror it asks you to put the double parens to disambiguate from `frame == frame->GetNextContinuation()`.

> nit: over 80 characters. please fix it before landing.

Done, thanks a lot for the review! :)
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/0255a42c0eb9
Remove weak pres context pointer from ContentEventHandler. r=masayuki
https://hg.mozilla.org/mozilla-central/rev/0255a42c0eb9
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: