Index: src/inspector/inspected-context.cc |
diff --git a/src/inspector/inspected-context.cc b/src/inspector/inspected-context.cc |
index 1b5081ff334ac6be926a6fc0fe29a58e4342a358..82b5a1b5b4e25e5c6bc4f034da8fd8f80939b1db 100644 |
--- a/src/inspector/inspected-context.cc |
+++ b/src/inspector/inspected-context.cc |
@@ -75,9 +75,13 @@ v8::Isolate* InspectedContext::isolate() const { |
return m_inspector->isolate(); |
} |
-void InspectedContext::createInjectedScript() { |
+bool InspectedContext::createInjectedScript() { |
DCHECK(!m_injectedScript); |
- m_injectedScript = InjectedScript::create(this); |
+ std::unique_ptr<InjectedScript> injectedScript = InjectedScript::create(this); |
+ // InjectedScript::create can destroy |this|. |
+ if (!injectedScript) return false; |
+ m_injectedScript = std::move(injectedScript); |
+ return true; |
} |
void InspectedContext::discardInjectedScript() { m_injectedScript.reset(); } |