This code retrieves *appWindow* and then calls some properties on it. But *_getAppWindow* doesn't assume that *appWindow* exists, and it returns *null* if it doesn't, which means the two code blocks disagree about whether or not *appWindow* must exist. One way or another, they should agree, so either this code should check that *appWindow* really exists, or the code in *_getAppWindow* shouldn't check its existence.

Leaving the code unrefactored, so the code that retrieves *appWindow* and the code that uses it live right next to each other in the same block, would have avoided this discrepancy. Which is a good example of why it's useful to avoid premature  generalization! ;-)