Closed Bug 1267718 Opened 8 years ago Closed 8 years ago

Add a nsPIDOMWindow::GetScriptableParentOrNull method

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: jwatt, Assigned: jwatt)

Details

(Whiteboard: btpp-active)

Attachments

(1 file)

In bug 1162772 I've found myself twice writing;

  nsPIDOMWindowOuter* parentOuterWin = GetScriptableParent();
  MOZ_ASSERT(parentOuterWin, "How can we get here? No docShell somehow?");
  if (nsGlobalWindow::Cast(parentOuterWin) != this) {

which could be more simply written as:

  if (GetScriptableParentOrNull()) {

if that method existed.  There are a few other places in the code that might benefit from this function too, but to a lesser extent.
Attached patch patchSplinter Review
Attachment #8745436 - Flags: review?(bzbarsky)
Comment on attachment 8745436 [details] [diff] [review]
patch

nsPIDOMWindow.h needs documentation for the new method.  r=me with that.
Attachment #8745436 - Flags: review?(bzbarsky) → review+
Whiteboard: btpp-active
https://hg.mozilla.org/mozilla-central/rev/d7beb35b55c7
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
Target Milestone: mozilla48 → mozilla49
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: