void WebContents::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) {
- if (load_details.is_navigation_to_different_page())
- Emit("did-navigate");
auto entry = web_contents()->GetController().GetLastCommittedEntry();
entry->SetVirtualURL(load_details.entry->GetOriginalRequestURL());
}
auto entry = web_contents()->GetController().GetLastCommittedEntry();
if (!entry)
return gfx::Image();
- auto favicon_status = entry->GetFavicon();
- return favicon_status.image;
+ return entry->GetFavicon().image;
}
bool WebContents::IsLoading() const {
#include <string>
#include <vector>
+#include <set>
#include "atom/browser/api/event_emitter.h"
#include "brightray/browser/default_web_contents_delegate.h"
'did-finish-load'
'did-fail-load'
'did-frame-finish-load'
- 'did-navigate'
'did-start-loading'
'did-stop-loading'
'did-get-response-details'
'did-finish-load': []
'did-fail-load': ['errorCode', 'errorDescription']
'did-frame-finish-load': ['isMainFrame']
- 'did-navigate': []
'did-start-loading': []
'did-stop-loading': []
'did-get-response-details': ['status', 'newUrl', 'originalUrl',
not @.getValue()
return
- # Allow users to cancel webview navigation.
- domEvent = new Event('will-navigate')
- domEvent['url'] = @getValue()
- domEvent.cancelable = true
- domEvent.preventDefault = () =>
- @setValueIgnoreMutation ''
- @webViewImpl.webviewNode.dispatchEvent domEvent
-
unless @webViewImpl.guestInstanceId?
if @webViewImpl.beforeFirstNavigation
@webViewImpl.beforeFirstNavigation = false
return
# Navigate to |this.src|.
- if @getValue()
- httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
- urlOptions = if httpreferrer then {httpreferrer} else {}
- remote.getGuestWebContents(@webViewImpl.guestInstanceId).loadUrl @getValue(), urlOptions
+ httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
+ urlOptions = if httpreferrer then {httpreferrer} else {}
+ remote.getGuestWebContents(@webViewImpl.guestInstanceId).loadUrl @getValue(), urlOptions
# Attribute specifies HTTP referrer.
class HttpReferrerAttribute extends WebViewAttribute
Emitted when a frame has done navigation.
-### Event: 'did-navigate'
-
-* `event` Event
-
-Emitted when a frame navigation has been committed to history.
-
### Event: 'did-start-loading'
Corresponds to the points in time when the spinner of the tab starts spinning.
## DOM events
-### will-navigate
-
-* `url` String
-
-Fired when view is about to navigate , calling `event.preventDefault()` will
-cancel the navigation.
-
### did-finish-load
Fired when the navigation is done, i.e. the spinner of the tab will stop
Fired when a frame has done navigation.
-### did-navigate
-
-Fired when a frame navigation has been committed to history.
-
### did-start-loading
Corresponds to the points in time when the spinner of the tab starts spinning.
webview.src = "file://#{fixtures}/pages/a.html"
document.body.appendChild webview
- describe 'will-navigate event', ->
- it 'is emitted before navigation', (done) ->
- view = new WebView
- view.addEventListener 'will-navigate', (e) ->
- e.preventDefault()
- assert.equal webview.src, ''
- view.addEventListener 'did-navigate', (e) ->
- document.body.removeChild view
- done()
- view.src = "file://#{fixtures}/pages/a.html"
- document.body.appendChild view
- document.body.appendChild webview
-
describe 'page-favicon-updated event', ->
it 'emits when favicon urls are received', (done) ->
webview.addEventListener 'page-favicon-updated', (e) ->