From 6b59e31c9d44094bf02c5c3adc7dd5c68bb9e0b3 Mon Sep 17 00:00:00 2001 From: Alastor Wu Date: Tue, 15 Jan 2019 17:06:12 +0000 Subject: [PATCH] Bug 1520037 - Reuse 'BrowsingContext::TopLevelBrowsingContext()'. r=nika GetTop() can simply wrap the result from TopLevelBrowsingContext(). Differential Revision: https://phabricator.services.mozilla.com/D16511 --HG-- extra : moz-landing-system : lando --- docshell/base/BrowsingContext.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/docshell/base/BrowsingContext.cpp b/docshell/base/BrowsingContext.cpp index 59fde94ceab1..99f3235def66 100644 --- a/docshell/base/BrowsingContext.cpp +++ b/docshell/base/BrowsingContext.cpp @@ -424,12 +424,7 @@ void BrowsingContext::Blur(ErrorResult& aError) { Nullable BrowsingContext::GetTop(ErrorResult& aError) { // We never return null or throw an error, but the implementation in // nsGlobalWindow does and we need to use the same signature. - BrowsingContext* bc = this; - BrowsingContext* parent; - while ((parent = bc->mParent)) { - bc = parent; - } - return WindowProxyHolder(bc); + return WindowProxyHolder(TopLevelBrowsingContext()); } void BrowsingContext::GetOpener(JSContext* aCx,