Skip to content

Commit 1a06986

Browse files
committed
add some comments
1 parent 17ec918 commit 1a06986

3 files changed

Lines changed: 11 additions & 4 deletions

File tree

src/main/java/org/htmlunit/html/BaseFrameElement.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ protected BaseFrameElement(final String qualifiedName, final SgmlPage page,
7777
// if created by the HTMLParser the src attribute is not set via setAttribute() or some other method but is
7878
// part of the given attributes already.
7979
final String src = getSrcAttribute();
80-
if (ATTRIBUTE_NOT_DEFINED != src && !UrlUtils.ABOUT_BLANK.equals(src)) {
80+
81+
// src-less IFrame or src='about:blank'
82+
// these are loaded sync
83+
if (ATTRIBUTE_NOT_DEFINED != src && !UrlUtils.ABOUT_BLANK.equals(src.trim())) {
8184
loadSrcWhenAddedToPage_ = true;
8285
}
8386
}

src/main/java/org/htmlunit/html/HtmlPage.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,14 @@ public void initialize() throws IOException, FailingHttpStatusCodeException {
261261
executeEventHandlersIfNeeded(Event.TYPE_READY_STATE_CHANGE);
262262
}
263263

264-
executePostponedScriptsIfNeeded();
265-
266264
executeDeferredScriptsIfNeeded();
267265

268266
executeEventHandlersIfNeeded(Event.TYPE_DOM_DOCUMENT_LOADED);
269267

268+
// postponed actions are more or less the async scripts,
269+
// they are running in real browsers whenever the download is done
270+
processPostponedActionsIfNeeded();
271+
270272
loadFrames();
271273

272274
// don't set the ready state if we really load the blank page into the window
@@ -1480,7 +1482,7 @@ private String getRefreshStringOrNull() {
14801482
return getWebResponse().getResponseHeaderValue("Refresh");
14811483
}
14821484

1483-
private void executePostponedScriptsIfNeeded() {
1485+
private void processPostponedActionsIfNeeded() {
14841486
if (!getWebClient().isJavaScriptEnabled()) {
14851487
return;
14861488
}

src/main/java/org/htmlunit/html/ScriptElementSupport.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ public static void onAllChildrenAddedToPage(final ScriptElement script, final bo
8484
final String srcAttrib = script.getScriptSource();
8585
final boolean hasNoSrcAttrib = ATTRIBUTE_NOT_DEFINED == srcAttrib;
8686
if (!hasNoSrcAttrib && script.isDeferred()) {
87+
// HtmlPage.executeDeferredScriptsIfNeeded() will process these
88+
// directly after the load
8789
return;
8890
}
8991

0 commit comments

Comments
 (0)