Closed Bug 1553957 Opened 6 years ago Closed 6 years ago

Add missing include of WindowProxyHolder.h (was incorrect: EventTarget.h needs to include WindowProxyHolder.h)

Categories

(Core :: DOM: Events, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla69
Tracking Status
firefox69 --- fixed

People

(Reporter: jorgk-bmo, Assigned: jorgk-bmo)

Details

Attachments

(4 files, 1 obsolete file)

Forward reference is not sufficient due to Nullable<WindowProxyHolder> GetOwnerGlobalForBindings();

That busts the Thunderbird compile.

Attached patch 1553957.patch (obsolete) — Splinter Review
Assignee: nobody → jorgk
Status: NEW → ASSIGNED
Comment on attachment 9067172 [details] [diff] [review] 1553957.patch Want to remove template <typename> struct Nullable; since Nullable.h is included anyhow
Attachment #9067172 - Flags: review+
Attached patch 1553957.patchSplinter Review
Pushed by mozilla@jorgk.com: https://hg.mozilla.org/mozilla-central/rev/9a89e2b0fa9d Include WindowProxyHolder.h in EventTarget.h. r=smaug a=Aryx
Attachment #9067172 - Attachment is obsolete: true

Boris, in bug 1353867 comment #39 we already landed the same patch and reverted it later.

This time the compile errors were:
9:30.01 c:/mozilla-source/comm-central/obj-x86_64-pc-mingw32/dist/include\mozilla/Maybe.h(158,51): error: invalid application of 'sizeof' to an incomplete type 'mozilla::dom::WindowProxyHolder'
9:30.01 MOZ_ALIGNAS_IN_STRUCT(T) unsigned char mStorage[sizeof(T)];
9:30.01 ^~~~~~~~~
9:30.01 c:/mozilla-source/comm-central/obj-x86_64-pc-mingw32/dist/include/mozilla/dom/Nullable.h(26,12): note: in instantiation of template class 'mozilla::Maybe<mozilla::dom::WindowProxyHolder>' requested here
9:30.03 Maybe<T> mValue;

So I believe this not comes from Nullable<WindowProxyHolder> GetOwnerGlobalForBindings(); and the forward declaration isn't enough.

However, I've just noticed the it should have been #include "mozilla/dom/WindowProxyHolder.h", right?

Flags: needinfo?(bzbarsky)
Target Milestone: --- → mozilla69
Version: unspecified → Trunk

we already landed the same patch and reverted it later

Yes, because it wasn't needed to fix the compile... A much more targeted fix was fine.

This time the compile errors were:

What were all the errors, not just the last two lines? That information should have been attached to this bug (as an attachment; don't paste all that into a comment, please) when it was opened. It's really hard to say whether the fix in this bug is right given that you're withholding that information, for reasons I don't understand.

Flags: needinfo?(bzbarsky)

Sorry, Boris. The error I quoted from Maybe.h seemed to imply that a forward reference was not enough any more. I think Olli dug through the include files in question and seemed to agree:

22:52:16 - smaug: but I don't know if there is any other fix

(or maybe I misunderstood).

I didn't intentionally withhold information, I'll provide the full compilation log with all the errors (as an attachment) in the course of the day (other stuff is burning hotter right now).

Here are the compile errors after backing out the fix locally. Search for Maybe.h or jump to line 377.

Flags: needinfo?(bzbarsky)

Yeah, that's the same situation as in bug 1353867, exactly. The .cpp file involved is dom/ipc/JSWindowActorChild.cpp. It has:

Nullable<WindowProxyHolder> JSWindowActorChild::GetContentWindow(

so instantiates that template, and hence needs to include WindowProxyHolder.h, but does not. At risk of sounding like a broken record, let me just repeat bug 1353867 comment 49 verbatim:

The right answer is presumably for all the files that implement a function that returns Nullable<WindowProxyHolder> to include WindowProxyHolder.h. Some of them (e.g. docshell/base/BrowsingContext.cpp) are calling the WindowProxyHolder ctor, so really should be including that header anyway but aren't obviously doing so...

That's the right fix for this bug, not changing EventTarget.h.

I'll note that JSWindowActorChild.cpp is even calling the WindowProxyHolder constructor without including WindowProxyHolder.h, so it's clearly incorrect code.

Flags: needinfo?(bzbarsky) → needinfo?(jorgk)

Oh, and that last bit is very clearly in the compile error log too, by the way:

17:43.13 c:/mozilla-source/comm-central/dom/ipc/JSWindowActorChild.cpp(121,12): error: 'mozilla::dom::WindowProxyHolder' is an incomplete type
17:43.13     return WindowProxyHolder(bc);
17:43.13            ^

I'll fix it later today, afk right now. Should the

-template <typename>
-struct Nullable;

be restored given that mozilla/dom/Nullable.h is included?

Flags: needinfo?(jorgk) → needinfo?(bzbarsky)

No, no need for that forward-decl if Nullable.h is included.

Flags: needinfo?(bzbarsky)
Attached patch Follow-up.patchSplinter Review

Follow-up patch, same patch as in Phabricator.

Carrying over Boris' r+, hence r=bz.

Attachment #9067493 - Flags: review+

Dear Sheriff, please land the "follow-up" patch which can't be landed via Lando since it was uploaded via the Phab web UI.

Keywords: checkin-needed

Pushed by nbeleuzu@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a3ce21755353
Follow-up: Revert changeset 9a89e2b0fa9d and include WindowProxyHolder.h in JSWindowActorChild.cpp. r=bzbarsky

Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Summary: EventTarget.h needs to include WindowProxyHolder.h → Add missing include of WindowProxyHolder.h (was incorrectl: EventTarget.h needs to include WindowProxyHolder.h)
Summary: Add missing include of WindowProxyHolder.h (was incorrectl: EventTarget.h needs to include WindowProxyHolder.h) → Add missing include of WindowProxyHolder.h (was incorrect: EventTarget.h needs to include WindowProxyHolder.h)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: