Port Bug 1543564 part 3. Remove use of nsPIDOMWindowOuter::GetOuterWindow()

RESOLVED FIXED

Status

task
RESOLVED FIXED
3 months ago
3 months ago

People

(Reporter: jorgk, Assigned: jorgk)

Tracking

Trunk

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

This should do it.

Attachment #9057825 - Flags: review?(bzbarsky)
Summary: Port Bug 1543564 part 3. Get rid of pointless nsPIDOMWindowOuter::GetOuterWindow method → Port Bug 1543564 part 3. Remove use of nsPIDOMWindowOuter::GetOuterWindow()

Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/cd367a28aeb9
Port bug 1543564, part 3: Remove use of nsPIDOMWindowOuter::GetOuterWindow(). rs=bustage-fix DONTBUILD

Status: ASSIGNED → RESOLVED
Closed: 3 months ago
Resolution: --- → FIXED
Comment on attachment 9057825 [details] [diff] [review]
1543943-GetOuterWindow.patch

r=me, but this is leaving some unneeded NS_ENSURE_ARG_POINTER bits around, right?
Attachment #9057825 - Flags: review?(bzbarsky) → review+

I asked myself that question. The code pattern is this:

1    nsCOMPtr<nsPIDOMWindowOuter> parentWindow = nsPIDOMWindowOuter::From(domWindow);
2 -  parentWindow = parentWindow->GetOuterWindow();
3    NS_ENSURE_ARG_POINTER(parentWindow);

So surely, after line 1 `parentWindow` was never null, otherwise line 2 would have crashed. If the behaviour of line 1 hasn't changed, then line 3 can go after line 2 is gone. I left them in for now, since they don't hurt.

I'm not really familiar with what's going on here, so if your suggestion is to remove the checks, I'll remove them. Please let me know.
Flags: needinfo?(bzbarsky)

So surely, after line 1 parentWindow was never null

Correct.

then line 3 can go after line 2 is gone

Yep. Removing them makes the code clearer and a tiny bit faster...

Flags: needinfo?(bzbarsky)
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/e1c03b7fdd86
Follow-up: Remove needless null checks as suggested by :bz. r=me
Type: defect → task
You need to log in before you can comment on or make changes to this bug.