MCPcopy Create free account
hub / github.com/HtmlUnit/htmlunit / goToUrlAtCurrentIndex

Method goToUrlAtCurrentIndex

src/main/java/org/htmlunit/History.java:287–312  ·  view source on GitHub ↗

Loads the URL at the current index into the window to which this navigation history belongs. @throws IOException if an IO error occurs

()

Source from the content-addressed store, hash-verified

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.

Callers 3

backMethod · 0.95
forwardMethod · 0.95
goMethod · 0.95

Calls 14

getPageMethod · 0.95
getWebRequestMethod · 0.95
getWebResponseMethod · 0.95
getUrlMethod · 0.95
getStateMethod · 0.95
getPageMethod · 0.65
getWebClientMethod · 0.65
setEnclosedPageMethod · 0.65
getScriptableObjectMethod · 0.65
getMethod · 0.45
setMethod · 0.45
setUrlMethod · 0.45

Tested by

no test coverage detected