Delay the did-fail-provisional-load event to next tick
Chrome is doing some stuff after the DidFailProvisionalLoad event, if we call LoadURL at this time crash would happen.
This commit is contained in:
parent
0f17a0163d
commit
1b3eb1cc5d
2 changed files with 8 additions and 3 deletions
|
@ -460,14 +460,13 @@ void WebContents::DidFinishLoad(content::RenderFrameHost* render_frame_host,
|
||||||
Emit("did-finish-load");
|
Emit("did-finish-load");
|
||||||
}
|
}
|
||||||
|
|
||||||
// this error occurs when host could not be found
|
|
||||||
void WebContents::DidFailProvisionalLoad(
|
void WebContents::DidFailProvisionalLoad(
|
||||||
content::RenderFrameHost* render_frame_host,
|
content::RenderFrameHost* render_frame_host,
|
||||||
const GURL& validated_url,
|
const GURL& url,
|
||||||
int error_code,
|
int error_code,
|
||||||
const base::string16& error_description,
|
const base::string16& error_description,
|
||||||
bool was_ignored_by_handler) {
|
bool was_ignored_by_handler) {
|
||||||
Emit("did-fail-load", error_code, error_description, validated_url);
|
Emit("did-fail-provisional-load", error_code, error_description, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
|
void WebContents::DidFailLoad(content::RenderFrameHost* render_frame_host,
|
||||||
|
|
|
@ -70,6 +70,12 @@ wrapWebContents = (webContents) ->
|
||||||
menu = Menu.buildFromTemplate params.menu
|
menu = Menu.buildFromTemplate params.menu
|
||||||
menu.popup params.x, params.y
|
menu.popup params.x, params.y
|
||||||
|
|
||||||
|
# This error occurs when host could not be found.
|
||||||
|
webContents.on 'did-fail-provisional-load', (args...) ->
|
||||||
|
# Calling loadURL during this event might cause crash, so delay the event
|
||||||
|
# until next tick.
|
||||||
|
setImmediate => @emit 'did-fail-load', args...
|
||||||
|
|
||||||
# Deprecated.
|
# Deprecated.
|
||||||
deprecate.rename webContents, 'loadUrl', 'loadURL'
|
deprecate.rename webContents, 'loadUrl', 'loadURL'
|
||||||
deprecate.rename webContents, 'getUrl', 'getURL'
|
deprecate.rename webContents, 'getUrl', 'getURL'
|
||||||
|
|
Loading…
Reference in a new issue