Bug 1587399 - Fix usage of nsIDocShellTreeItem in nsContentUtils::CheckForSubFrameDrop. r=kmag
authorKannan Vijayan <kvijayan@mozilla.com>
Tue, 10 Dec 2019 15:19:35 +0000
changeset 506267 906d635633c6d47dbaac47d32b43cd771c2879f8
parent 506266 37142aec03d7b990c2ae8ab0a05c19c97180587d
child 506268 d98fefa4ebb424281335b929c12713a5361ad400
push id102771
push userkvijayan@mozilla.com
push dateTue, 10 Dec 2019 15:21:10 +0000
treeherderautoland@906d635633c6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1587399
milestone73.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 1587399 - Fix usage of nsIDocShellTreeItem in nsContentUtils::CheckForSubFrameDrop. r=kmag Differential Revision: https://phabricator.services.mozilla.com/D56001
dom/base/nsContentUtils.cpp
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -5429,23 +5429,18 @@ bool nsContentUtils::CheckForSubFrameDro
   }
 
   Document* targetDoc = target->OwnerDoc();
   nsPIDOMWindowOuter* targetWin = targetDoc->GetWindow();
   if (!targetWin) {
     return true;
   }
 
-  nsCOMPtr<nsIDocShellTreeItem> tdsti = targetWin->GetDocShell();
-  if (!tdsti) {
-    return true;
-  }
-
   // Always allow dropping onto chrome shells.
-  if (tdsti->ItemType() == nsIDocShellTreeItem::typeChrome) {
+  if (targetWin->GetBrowsingContext()->IsChrome()) {
     return false;
   }
 
   // If there is no source node, then this is a drag from another
   // application, which should be allowed.
   RefPtr<Document> doc;
   aDragSession->GetSourceDocument(getter_AddRefs(doc));
   if (doc) {