Delay the page-title-set event to next tick

This commit is contained in:
Cheng Zhao 2015-12-01 18:34:58 +08:00
parent 83ee78451a
commit c95117fb22
2 changed files with 6 additions and 2 deletions

View file

@ -520,9 +520,9 @@ void WebContents::DidNavigateMainFrame(
void WebContents::TitleWasSet(content::NavigationEntry* entry,
bool explicit_set) {
if (entry)
Emit("page-title-set", entry->GetTitle(), explicit_set);
Emit("-page-title-set", entry->GetTitle(), explicit_set);
else
Emit("page-title-set", "", explicit_set);
Emit("-page-title-set", "", explicit_set);
}
void WebContents::DidUpdateFaviconURL(

View file

@ -76,6 +76,10 @@ wrapWebContents = (webContents) ->
# until next tick.
setImmediate => @emit 'did-fail-load', args...
# Delays the page-title-set event to next tick.
webContents.on '-page-title-set', (args...) ->
setImmediate => @emit 'page-title-set', args...
# Deprecated.
deprecate.rename webContents, 'loadUrl', 'loadURL'
deprecate.rename webContents, 'getUrl', 'getURL'