summaryrefslogtreecommitdiffstats
path: root/src/core/devtools_frontend_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/devtools_frontend_qt.cpp')
-rw-r--r--src/core/devtools_frontend_qt.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/core/devtools_frontend_qt.cpp b/src/core/devtools_frontend_qt.cpp
index 154b275b5..bd9e0ebe7 100644
--- a/src/core/devtools_frontend_qt.cpp
+++ b/src/core/devtools_frontend_qt.cpp
@@ -446,7 +446,16 @@ void DevToolsFrontendQt::HandleMessageFromDevToolsFrontend(const std::string &me
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui::PAGE_TRANSITION_LINK,
false);
- m_frontendDelegate->OpenURLFromTab(nullptr, openParams);
+ // OpenURL will (via WebContentsDelegateQt::OpenURLFromTab) call
+ // application code, which may decide to close this devtools view (see
+ // quicknanobrowser for example).
+ //
+ // Chromium always calls SendMessageAck through a callback bound to a
+ // WeakPtr, we do the same here, except without the callback.
+ base::WeakPtr<DevToolsFrontendQt> weakThis = m_weakFactory.GetWeakPtr();
+ web_contents()->OpenURL(openParams);
+ if (!weakThis)
+ return;
} else if (method == "bringToFront") {
Activate();
} else {