Check whether WebContents lives before using its methods

Close #2064.
This commit is contained in:
Cheng Zhao 2015-07-06 18:21:04 +08:00
parent 9cf09b8850
commit 54dac0f37a
2 changed files with 5 additions and 0 deletions

View file

@ -792,6 +792,10 @@ mate::ObjectTemplateBuilder WebContents::GetObjectTemplateBuilder(
isolate, v8::Local<v8::ObjectTemplate>::New(isolate, template_));
}
bool WebContents::IsDestroyed() const {
return !IsAlive();
}
void WebContents::OnRendererMessage(const base::string16& channel,
const base::ListValue& args) {
// webContents.emit(channel, new Event(), args...);

View file

@ -111,6 +111,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// mate::Wrappable:
mate::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;
bool IsDestroyed() const override;
// content::WebContentsDelegate:
bool AddMessageToConsole(content::WebContents* source,