removed will-navigate and did-navigate events
This commit is contained in:
parent
05be71e9bc
commit
18b3dfa350
8 changed files with 5 additions and 48 deletions
|
@ -310,8 +310,6 @@ void WebContents::WebContentsDestroyed() {
|
|||
|
||||
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());
|
||||
}
|
||||
|
@ -400,8 +398,7 @@ gfx::Image WebContents::GetFavicon() const {
|
|||
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 {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
|
||||
#include "atom/browser/api/event_emitter.h"
|
||||
#include "brightray/browser/default_web_contents_delegate.h"
|
||||
|
|
|
@ -6,7 +6,6 @@ supportedWebViewEvents = [
|
|||
'did-finish-load'
|
||||
'did-fail-load'
|
||||
'did-frame-finish-load'
|
||||
'did-navigate'
|
||||
'did-start-loading'
|
||||
'did-stop-loading'
|
||||
'did-get-response-details'
|
||||
|
|
|
@ -7,7 +7,6 @@ WEB_VIEW_EVENTS =
|
|||
'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',
|
||||
|
|
|
@ -154,14 +154,6 @@ class SrcAttribute extends WebViewAttribute
|
|||
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
|
||||
|
@ -169,10 +161,9 @@ class SrcAttribute extends WebViewAttribute
|
|||
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
|
||||
|
|
|
@ -632,12 +632,6 @@ cancelled, e.g. `window.stop()` is invoked.
|
|||
|
||||
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.
|
||||
|
|
|
@ -279,13 +279,6 @@ examples.
|
|||
|
||||
## 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
|
||||
|
@ -305,10 +298,6 @@ cancelled, e.g. `window.stop()` is invoked.
|
|||
|
||||
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.
|
||||
|
|
|
@ -152,19 +152,6 @@ describe '<webview> tag', ->
|
|||
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) ->
|
||||
|
|
Loading…
Add table
Reference in a new issue