]> khamidou — GitHub mirrors - electron.git/commitdiff
removed will-navigate and did-navigate events
authordeepak1556 <hop2deep@gmail.com>
Sat, 25 Apr 2015 04:20:11 +0000 (09:50 +0530)
committerdeepak1556 <hop2deep@gmail.com>
Sat, 25 Apr 2015 04:20:28 +0000 (09:50 +0530)
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/atom_api_web_contents.h
atom/browser/lib/guest-view-manager.coffee
atom/renderer/lib/web-view/guest-view-internal.coffee
atom/renderer/lib/web-view/web-view-attributes.coffee
docs/api/browser-window.md
docs/api/web-view-tag.md
spec/webview-spec.coffee

index c0d4dd615a089375dca3944cb3eb5c0691a73a70..fb867795fbcf959c6261d7c417ac277ce6a245c7 100644 (file)
@@ -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 {
index ea05715e58c72a48c899e88b3c23d60f9a851c81..484501df41aaaf9270ba1d2cf1192f98184118e8 100644 (file)
@@ -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"
index 255349082299bff7cf39a63e7e2cd502a2eca748..6fc70131decb116ffa67840c132064f0b5cdb673 100644 (file)
@@ -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'
index 004dfa98fb22bbd7ebb612d85d5c4e745c4aaa56..402bb5c7fa008a3a7e7fdac11a4cc51b758a1645 100644 (file)
@@ -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',
index 0eff63d4b26287c6a3aec9e9b046fbe26f52f7bc..e4b5dcb45bda268328be10e1152211e9fefb744c 100644 (file)
@@ -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
index 75540493d37fbce866c2e459efdb38d2a7a6cac9..8e6262e9275a0e4c7825d6c69768d2410746ef1f 100644 (file)
@@ -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.
index 3bd49c9605d3dfd8afa759a8a8bd7633bd57d5d1..ca8c024ccc4794ddb4eb9b241562cee6ff281671 100644 (file)
@@ -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.
index 402d8094219bb938638c2bea03b93f7f5ccc31cb..1936731f3541d42e46cc50fc5c3e89a097a6a061 100644 (file)
@@ -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) ->