|
@@ -268,7 +268,9 @@ struct WebContents::FrameDispatchHelper {
|
|
|
|
|
|
WebContents::WebContents(v8::Isolate* isolate,
|
|
|
content::WebContents* web_contents)
|
|
|
- : content::WebContentsObserver(web_contents), type_(REMOTE) {
|
|
|
+ : content::WebContentsObserver(web_contents),
|
|
|
+ type_(REMOTE),
|
|
|
+ weak_factory_(this) {
|
|
|
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
|
|
|
false);
|
|
|
Init(isolate);
|
|
@@ -283,7 +285,9 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|
|
WebContents::WebContents(v8::Isolate* isolate,
|
|
|
std::unique_ptr<content::WebContents> web_contents,
|
|
|
Type type)
|
|
|
- : content::WebContentsObserver(web_contents.get()), type_(type) {
|
|
|
+ : content::WebContentsObserver(web_contents.get()),
|
|
|
+ type_(type),
|
|
|
+ weak_factory_(this) {
|
|
|
DCHECK(type != REMOTE) << "Can't take ownership of a remote WebContents";
|
|
|
auto session = Session::CreateFrom(isolate, GetBrowserContext());
|
|
|
session_.Reset(isolate, session.ToV8());
|
|
@@ -291,8 +295,8 @@ WebContents::WebContents(v8::Isolate* isolate,
|
|
|
mate::Dictionary::CreateEmpty(isolate));
|
|
|
}
|
|
|
|
|
|
-WebContents::WebContents(v8::Isolate* isolate,
|
|
|
- const mate::Dictionary& options) {
|
|
|
+WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
|
|
|
+ : weak_factory_(this) {
|
|
|
// Read options.
|
|
|
options.Get("backgroundThrottling", &background_throttling_);
|
|
|
|