MCPcopy Index your code
hub / github.com/HtmlUnit/htmlunit / addPage

Method addPage

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

Adds a new page to the navigation history. @param page the page to add to the navigation history @return the created history entry

(final Page page)

Source from the content-addressed store, hash-verified

248 * @return the created history entry
249 */
250 protected HistoryEntry addPage(final Page page) {
251 final Boolean ignoreNewPages = ignoreNewPages_.get();
252 if (ignoreNewPages != null && ignoreNewPages.booleanValue()) {
253 return null;
254 }
255
256 final int sizeLimit = window_.getWebClient().getOptions().getHistorySizeLimit();
257 if (sizeLimit <= 0) {
258 entries_.clear();
259 index_ = -1;
260 return null;
261 }
262
263 index_++;
264 while (entries_.size() > index_) {
265 entries_.remove(index_);
266 }
267 while (entries_.size() >= sizeLimit) {
268 entries_.remove(0);
269 index_--;
270 }
271
272 final HistoryEntry entry = new HistoryEntry(page);
273 entries_.add(entry);
274
275 final int cacheLimit = Math.max(window_.getWebClient().getOptions().getHistoryPageCacheLimit(), 0);
276 if (entries_.size() > cacheLimit) {
277 entries_.get(entries_.size() - cacheLimit - 1).clearPage();
278 }
279
280 return entry;
281 }
282
283 /**
284 * Loads the URL at the current index into the window to which this navigation history belongs.

Callers 4

pushStateMethod · 0.95
setEnclosedPageMethod · 0.80
getPageMethod · 0.80
processOnlyHashChangeMethod · 0.80

Calls 11

getHistorySizeLimitMethod · 0.80
maxMethod · 0.80
clearPageMethod · 0.80
getWebClientMethod · 0.65
getMethod · 0.45
getOptionsMethod · 0.45
clearMethod · 0.45
sizeMethod · 0.45
removeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected