Java Code Examples for com.gargoylesoftware.htmlunit.javascript.host.Window#executeEventLocally()
The following examples show how to use
com.gargoylesoftware.htmlunit.javascript.host.Window#executeEventLocally() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: History.java From htmlunit with Apache License 2.0 | 5 votes |
/** * Loads the URL at the current index into the window to which this navigation history belongs. * @throws IOException if an IO error occurs */ private void goToUrlAtCurrentIndex() throws IOException { final Boolean old = ignoreNewPages_.get(); ignoreNewPages_.set(Boolean.TRUE); try { final HistoryEntry entry = entries_.get(index_); final Page page = entry.getPage(); if (page == null) { window_.getWebClient().getPage(window_, entry.getWebRequest(), false); } else { window_.setEnclosedPage(page); page.getWebResponse().getWebRequest().setUrl(entry.getUrl()); } final Window jsWindow = window_.getScriptableObject(); if (jsWindow != null && jsWindow.hasEventHandlers("onpopstate")) { final Event event = new PopStateEvent(jsWindow, Event.TYPE_POPSTATE, entry.getState()); jsWindow.executeEventLocally(event); } } finally { ignoreNewPages_.set(old); } }
Example 2
Source File: History.java From HtmlUnit-Android with Apache License 2.0 | 5 votes |
/** * Loads the URL at the current index into the window to which this navigation history belongs. * @throws IOException if an IO error occurs */ private void goToUrlAtCurrentIndex() throws IOException { final Boolean old = ignoreNewPages_.get(); ignoreNewPages_.set(Boolean.TRUE); try { final HistoryEntry entry = entries_.get(index_); final Page page = entry.getPage(); if (page == null) { window_.getWebClient().getPage(window_, entry.getWebRequest(), false); } else { window_.setEnclosedPage(page); page.getWebResponse().getWebRequest().setUrl(entry.getUrl()); } final Window jsWindow = (Window) window_.getScriptableObject(); if (jsWindow.hasEventHandlers("onpopstate")) { final Event event = new PopStateEvent(jsWindow, Event.TYPE_POPSTATE, entry.getState()); jsWindow.executeEventLocally(event); } } finally { ignoreNewPages_.set(old); } }