Closed Bug 1265273 Opened 8 years ago Closed 8 years ago

Add two missing get_PBrowserParent() null checks

Categories

(Core :: IPC, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla48
Tracking Status
firefox48 --- fixed

People

(Reporter: n.nethercote, Assigned: n.nethercote)

Details

(Whiteboard: btpp-active)

Attachments

(1 file)

Most calls to get_PBrowserParent() have their return value null checked, but
two don't. This patch adds checks for those two calls.
Comment on attachment 8742167 [details] [diff] [review]
Add two missing get_PBrowserParent() null checks

Review of attachment 8742167 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/ipc/nsIContentParent.cpp
@@ +136,5 @@
>      // type PopupIPCTabContext, and that the opener TabParent is
>      // reachable.
>      const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
>      auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
> +    if (!opener) {

I think we already check this in CanOpenBrowser.
Whiteboard: btpp-active
Comment on attachment 8742167 [details] [diff] [review]
Add two missing get_PBrowserParent() null checks

Review of attachment 8742167 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/ipc/TabContext.cpp
@@ +253,5 @@
> +        if (!context) {
> +          mInvalidReason = "Child is-browser process tried to "
> +                           "open a null tab.";
> +          return;
> +        }

looks like a good check to add afaict.

::: dom/ipc/nsIContentParent.cpp
@@ +138,5 @@
>      const PopupIPCTabContext& popupContext = aContext.get_PopupIPCTabContext();
>      auto opener = TabParent::GetFrom(popupContext.opener().get_PBrowserParent());
> +    if (!opener) {
> +      return nullptr;
> +    }

yep, looks like someone recently added this check.
Attachment #8742167 - Flags: review?(jmathies) → review+
Oh, I forgot to update the commit message. The landed patch only added the one check.
https://hg.mozilla.org/mozilla-central/rev/8b29568cb7e2
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.