Many of the `WorkerPrivate::GetParent` uses look like this:
```
// Walk up to our containing page
WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
nsCOMPtr<nsPIDOMWindowInner> window = wp->GetWindow();
```
while we already have [`WorkerPrivate::GetAncestorWindow`](https://searchfox.org/mozilla-central/rev/3d03a3ca09f03f06ef46a511446537563f62a0c6/dom/workers/WorkerPrivate.cpp#1333). I assume we can use this even though it does an additional:
```
if (mLoadInfo.mWindow) {
return mLoadInfo.mWindow;
}
```
before walking the parents?
Bug 1744025 Comment 5 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
Many of the `WorkerPrivate::GetParent` uses look like this:
```
// Walk up to our containing page
WorkerPrivate* wp = aWorkerPrivate;
while (wp->GetParent()) {
wp = wp->GetParent();
}
nsCOMPtr<nsPIDOMWindowInner> window = wp->GetWindow();
```
while we already have [`WorkerPrivate::GetAncestorWindow`](https://searchfox.org/mozilla-central/rev/3d03a3ca09f03f06ef46a511446537563f62a0c6/dom/workers/WorkerPrivate.cpp#1333). I assume we can use this everywhere even though it does an additional:
```
if (mLoadInfo.mWindow) {
return mLoadInfo.mWindow;
}
```
before walking the parents?