🐛 Fix #9231: Don't load url when detached.
This commit is contained in:
parent
8a62d81fc5
commit
42cb3461af
3 changed files with 16 additions and 0 deletions
|
@ -993,6 +993,10 @@ void WebContents::LoadURL(const GURL& url, const mate::Dictionary& options) {
|
|||
return;
|
||||
}
|
||||
|
||||
if (guest_delegate_ && !guest_delegate_->Attached()) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::NavigationController::LoadURLParams params(url);
|
||||
|
||||
GURL http_referrer;
|
||||
|
|
|
@ -110,7 +110,12 @@ void WebViewGuestDelegate::DidFinishNavigation(
|
|||
}
|
||||
}
|
||||
|
||||
void WebViewGuestDelegate::DidDetach() {
|
||||
attached_ = false;
|
||||
}
|
||||
|
||||
void WebViewGuestDelegate::DidAttach(int guest_proxy_routing_id) {
|
||||
attached_ = true;
|
||||
api_web_contents_->Emit("did-attach");
|
||||
embedder_zoom_controller_ =
|
||||
WebContentsZoomController::FromWebContents(embedder_web_contents_);
|
||||
|
|
|
@ -47,6 +47,9 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
|||
// and normal sizes.
|
||||
void SetSize(const SetSizeParams& params);
|
||||
|
||||
// Return true if attached.
|
||||
bool Attached() const { return attached_; }
|
||||
|
||||
protected:
|
||||
// content::WebContentsObserver:
|
||||
void DidFinishNavigation(
|
||||
|
@ -54,6 +57,7 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
|||
|
||||
// content::BrowserPluginGuestDelegate:
|
||||
void DidAttach(int guest_proxy_routing_id) final;
|
||||
void DidDetach() final;
|
||||
content::WebContents* GetOwnerWebContents() const final;
|
||||
void GuestSizeChanged(const gfx::Size& new_size) final;
|
||||
void SetGuestHost(content::GuestHost* guest_host) final;
|
||||
|
@ -116,6 +120,9 @@ class WebViewGuestDelegate : public content::BrowserPluginGuestDelegate,
|
|||
// Whether the guest view is inside a plugin document.
|
||||
bool is_full_page_plugin_;
|
||||
|
||||
// Whether attached.
|
||||
bool attached_;
|
||||
|
||||
api::WebContents* api_web_contents_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebViewGuestDelegate);
|
||||
|
|
Loading…
Reference in a new issue