Bug 1650562: Add missing null check for document BrowsingContext. r=nika

Differential Revision: https://phabricator.services.mozilla.com/D82988
This commit is contained in:
Kris Maglione 2020-07-13 18:39:52 +00:00
parent e0ac748fab
commit f57f59c446
2 changed files with 3 additions and 3 deletions

View File

@ -5562,9 +5562,8 @@ bool nsContentUtils::CheckForSubFrameDrop(nsIDragSession* aDragSession,
// 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) {
RefPtr<Document> doc(aDragSession->GetSourceDocument());
if (doc && doc->GetBrowsingContext()) {
// Get each successive parent of the source document and compare it to
// the drop document. If they match, then this is a drag from a child frame.
for (BrowsingContext* bc = doc->GetBrowsingContext()->GetParent(); bc;

View File

@ -49,6 +49,7 @@ interface nsIDragSession : nsISupports
* drag originated outside the application. Useful for determining if a drop
* originated in the same document.
*/
[infallible]
readonly attribute Document sourceDocument;
/**