diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 7b710e5f85a8..99cb2e007482 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1208,9 +1208,6 @@ void WebContents::EndFrameSubscription() { void WebContents::StartDrag(const mate::Dictionary& item, mate::Arguments* args) { - base::MessageLoop::ScopedNestableTaskAllower allow( - base::MessageLoop::current()); - base::FilePath file; std::vector files; if (!item.Get("files", &files) && item.Get("file", &file)) { @@ -1230,6 +1227,8 @@ void WebContents::StartDrag(const mate::Dictionary& item, // Start dragging. if (!files.empty()) { + base::MessageLoop::ScopedNestableTaskAllower allow( + base::MessageLoop::current()); DragFileItems(files, icon->image(), web_contents()->GetNativeView()); } else { args->ThrowError("There is nothing to drag");