removed will-navigate and did-navigate events

This commit is contained in:
deepak1556 2015-04-25 09:50:11 +05:30
parent 05be71e9bc
commit 18b3dfa350
8 changed files with 5 additions and 48 deletions

View file

@ -310,8 +310,6 @@ void WebContents::WebContentsDestroyed() {
void WebContents::NavigationEntryCommitted( void WebContents::NavigationEntryCommitted(
const content::LoadCommittedDetails& load_details) { const content::LoadCommittedDetails& load_details) {
if (load_details.is_navigation_to_different_page())
Emit("did-navigate");
auto entry = web_contents()->GetController().GetLastCommittedEntry(); auto entry = web_contents()->GetController().GetLastCommittedEntry();
entry->SetVirtualURL(load_details.entry->GetOriginalRequestURL()); entry->SetVirtualURL(load_details.entry->GetOriginalRequestURL());
} }
@ -400,8 +398,7 @@ gfx::Image WebContents::GetFavicon() const {
auto entry = web_contents()->GetController().GetLastCommittedEntry(); auto entry = web_contents()->GetController().GetLastCommittedEntry();
if (!entry) if (!entry)
return gfx::Image(); return gfx::Image();
auto favicon_status = entry->GetFavicon(); return entry->GetFavicon().image;
return favicon_status.image;
} }
bool WebContents::IsLoading() const { bool WebContents::IsLoading() const {

View file

@ -7,6 +7,7 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include <set>
#include "atom/browser/api/event_emitter.h" #include "atom/browser/api/event_emitter.h"
#include "brightray/browser/default_web_contents_delegate.h" #include "brightray/browser/default_web_contents_delegate.h"

View file

@ -6,7 +6,6 @@ supportedWebViewEvents = [
'did-finish-load' 'did-finish-load'
'did-fail-load' 'did-fail-load'
'did-frame-finish-load' 'did-frame-finish-load'
'did-navigate'
'did-start-loading' 'did-start-loading'
'did-stop-loading' 'did-stop-loading'
'did-get-response-details' 'did-get-response-details'

View file

@ -7,7 +7,6 @@ WEB_VIEW_EVENTS =
'did-finish-load': [] 'did-finish-load': []
'did-fail-load': ['errorCode', 'errorDescription'] 'did-fail-load': ['errorCode', 'errorDescription']
'did-frame-finish-load': ['isMainFrame'] 'did-frame-finish-load': ['isMainFrame']
'did-navigate': []
'did-start-loading': [] 'did-start-loading': []
'did-stop-loading': [] 'did-stop-loading': []
'did-get-response-details': ['status', 'newUrl', 'originalUrl', 'did-get-response-details': ['status', 'newUrl', 'originalUrl',

View file

@ -154,14 +154,6 @@ class SrcAttribute extends WebViewAttribute
not @.getValue() not @.getValue()
return 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? unless @webViewImpl.guestInstanceId?
if @webViewImpl.beforeFirstNavigation if @webViewImpl.beforeFirstNavigation
@webViewImpl.beforeFirstNavigation = false @webViewImpl.beforeFirstNavigation = false
@ -169,10 +161,9 @@ class SrcAttribute extends WebViewAttribute
return return
# Navigate to |this.src|. # Navigate to |this.src|.
if @getValue() httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue()
httpreferrer = @webViewImpl.attributes[webViewConstants.ATTRIBUTE_HTTPREFERRER].getValue() urlOptions = if httpreferrer then {httpreferrer} else {}
urlOptions = if httpreferrer then {httpreferrer} else {} remote.getGuestWebContents(@webViewImpl.guestInstanceId).loadUrl @getValue(), urlOptions
remote.getGuestWebContents(@webViewImpl.guestInstanceId).loadUrl @getValue(), urlOptions
# Attribute specifies HTTP referrer. # Attribute specifies HTTP referrer.
class HttpReferrerAttribute extends WebViewAttribute class HttpReferrerAttribute extends WebViewAttribute

View file

@ -632,12 +632,6 @@ cancelled, e.g. `window.stop()` is invoked.
Emitted when a frame has done navigation. 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' ### Event: 'did-start-loading'
Corresponds to the points in time when the spinner of the tab starts spinning. Corresponds to the points in time when the spinner of the tab starts spinning.

View file

@ -279,13 +279,6 @@ examples.
## DOM events ## DOM events
### will-navigate
* `url` String
Fired when view is about to navigate , calling `event.preventDefault()` will
cancel the navigation.
### did-finish-load ### did-finish-load
Fired when the navigation is done, i.e. the spinner of the tab will stop 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. Fired when a frame has done navigation.
### did-navigate
Fired when a frame navigation has been committed to history.
### did-start-loading ### did-start-loading
Corresponds to the points in time when the spinner of the tab starts spinning. Corresponds to the points in time when the spinner of the tab starts spinning.

View file

@ -152,19 +152,6 @@ describe '<webview> tag', ->
webview.src = "file://#{fixtures}/pages/a.html" webview.src = "file://#{fixtures}/pages/a.html"
document.body.appendChild webview 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', -> describe 'page-favicon-updated event', ->
it 'emits when favicon urls are received', (done) -> it 'emits when favicon urls are received', (done) ->
webview.addEventListener 'page-favicon-updated', (e) -> webview.addEventListener 'page-favicon-updated', (e) ->