Loads the URL at the current index into the window to which this navigation history belongs. @throws IOException if an IO error occurs
()
| 285 | * @throws IOException if an IO error occurs |
| 286 | */ |
| 287 | private void goToUrlAtCurrentIndex() throws IOException { |
| 288 | final Boolean old = ignoreNewPages_.get(); |
| 289 | ignoreNewPages_.set(Boolean.TRUE); |
| 290 | try { |
| 291 | |
| 292 | final HistoryEntry entry = entries_.get(index_); |
| 293 | |
| 294 | final Page page = entry.getPage(); |
| 295 | if (page == null) { |
| 296 | window_.getWebClient().getPage(window_, entry.getWebRequest(), false); |
| 297 | } |
| 298 | else { |
| 299 | window_.setEnclosedPage(page); |
| 300 | page.getWebResponse().getWebRequest().setUrl(entry.getUrl()); |
| 301 | } |
| 302 | |
| 303 | final Window jsWindow = window_.getScriptableObject(); |
| 304 | if (jsWindow != null && jsWindow.hasEventHandlers("onpopstate")) { |
| 305 | final Event event = new PopStateEvent(jsWindow, Event.TYPE_POPSTATE, entry.getState()); |
| 306 | jsWindow.executeEventLocally(event); |
| 307 | } |
| 308 | } |
| 309 | finally { |
| 310 | ignoreNewPages_.set(old); |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | /** |
| 315 | * Allows to change history state and url if provided. |
no test coverage detected