Bug 1585079 - Part 1: Support Document::GetBrowsingContext early during Document lifecycle, r=smaug
authorNika Layzell <nika@thelayzells.com>
Thu, 09 Jan 2020 21:46:06 +0000
changeset 509760 ae770c4a16b0059511a20a445e7b8ab622654e41
parent 509759 fbd48f9ff2d3a05bba5230a46de28888e99d162d
child 509761 58c51eb6a09536429701478350c957582804953e
push id37004
push usershindli@mozilla.com
push dateSat, 11 Jan 2020 09:48:29 +0000
treeherdermozilla-central@fb64636dad2c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1585079
milestone74.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585079 - Part 1: Support Document::GetBrowsingContext early during Document lifecycle, r=smaug Differential Revision: https://phabricator.services.mozilla.com/D59394
dom/base/Document.cpp
--- a/dom/base/Document.cpp
+++ b/dom/base/Document.cpp
@@ -14903,18 +14903,18 @@ void Document::SetUserHasInteracted() {
     nsCOMPtr<nsILoadInfo> loadInfo = mChannel->LoadInfo();
     loadInfo->SetDocumentHasUserInteracted(true);
   }
 
   MaybeAllowStorageForOpenerAfterUserInteraction();
 }
 
 BrowsingContext* Document::GetBrowsingContext() const {
-  nsPIDOMWindowOuter* outer = GetWindow();
-  return outer ? outer->GetBrowsingContext() : nullptr;
+  nsCOMPtr<nsIDocShell> docshell(mDocumentContainer);
+  return docshell ? docshell->GetBrowsingContext() : nullptr;
 }
 
 void Document::NotifyUserGestureActivation() {
   for (RefPtr<BrowsingContext> bc = GetBrowsingContext(); bc;
        bc = bc->GetParent()) {
     bc->NotifyUserGestureActivation();
   }
 }