diff --git a/Libraries/LibWeb/DOM/Document.cpp b/Libraries/LibWeb/DOM/Document.cpp index 3b4bfb880f6..6670e9a3260 100644 --- a/Libraries/LibWeb/DOM/Document.cpp +++ b/Libraries/LibWeb/DOM/Document.cpp @@ -708,14 +708,14 @@ WebIDL::ExceptionOr Document::close() if (!m_parser) return {}; - // FIXME: 4. Insert an explicit "EOF" character at the end of the parser's input stream. + // 4. Insert an explicit "EOF" character at the end of the parser's input stream. m_parser->tokenizer().insert_eof(); // 5. If there is a pending parsing-blocking script, then return. if (pending_parsing_blocking_script()) return {}; - // FIXME: 6. Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the tokenizer reaches the explicit "EOF" character or spins the event loop. + // 6. Run the tokenizer, processing resulting tokens as they are emitted, and stopping when the tokenizer reaches the explicit "EOF" character or spins the event loop. m_parser->run(); // AD-HOC: This ensures that a load event is fired if the node navigable's container is an iframe. diff --git a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 7bb582d5fe9..d2bee446985 100644 --- a/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -191,10 +191,6 @@ void HTMLParser::run(HTMLTokenizer::StopAtInsertionPoint stop_at_insertion_point m_stop_parsing = false; for (;;) { - // FIXME: Find a better way to say that we come from Document::close() and want to process EOF. - if (!m_tokenizer.is_eof_inserted() && m_tokenizer.is_insertion_point_reached()) - break; - auto optional_token = m_tokenizer.next_token(stop_at_insertion_point); if (!optional_token.has_value()) break; diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.txt new file mode 100644 index 00000000000..a27c0d0a317 --- /dev/null +++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.txt @@ -0,0 +1,22 @@ +Summary + +Harness status: OK + +Rerun + +Found 12 tests + +12 Pass +Details +Result Test Name MessagePass for='window' event='onload()' parser inserted executes immediately +Pass for='window' event='onload' parser inserted executes immediately +Pass for=' WINdow ' event='ONload ' parser inserted executes immediately +Pass for='window' event='load' parser inserted does not execute +Pass for='window' event='onpageshow' parser inserted does not execute +Pass for='document' event='onload' parser inserted does not execute +Pass for='window' event='onload()' dom inserted executes immediately +Pass for='window' event='onload' dom inserted executes immediately +Pass for=' WINdow ' event='ONload ' dom inserted executes immediately +Pass for='window' event='load' dom inserted does not execute +Pass for='window' event='onpageshow' dom inserted does not execute +Pass for='document' event='onload' dom inserted does not execute \ No newline at end of file diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_scripted_webkit01.txt b/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_scripted_webkit01.txt index a993b4573ea..7b572d2ed50 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_scripted_webkit01.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/html/syntax/parsing/html5lib_scripted_webkit01.txt @@ -6,8 +6,7 @@ Rerun Found 2 tests -1 Pass -1 Fail +2 Pass Details Result Test Name MessagePass html5lib_scripted_webkit01.html 3ff6ec1125852c7933bf6d89ecb375354e6e1b40 -Fail html5lib_scripted_webkit01.html 46ae362de712eb9c55916de93110299dbbcb5726 \ No newline at end of file +Pass html5lib_scripted_webkit01.html 46ae362de712eb9c55916de93110299dbbcb5726 \ No newline at end of file diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.html b/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.html new file mode 100644 index 00000000000..27b989b9a0e --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/149.html @@ -0,0 +1,59 @@ + + + scheduler: event/for attribute on script + + + + + +
+ + + + + + diff --git a/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/testlib/testlib.js b/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/testlib/testlib.js new file mode 100644 index 00000000000..a6fd39426b9 --- /dev/null +++ b/Tests/LibWeb/Text/input/wpt-import/html/semantics/scripting-1/the-script-element/execution-timing/testlib/testlib.js @@ -0,0 +1,43 @@ +/* +* Utility functions for script scheduler test +*/ +(function(){ /* namespace hiding local variables like arOrderOfAllEvents from global scope */ + window.testlib = {}; + window.eventOrder = []; + var arNumberOfScriptsParsedPerEvent=[]; + window.log = function (str){ + eventOrder.push(str); + arNumberOfScriptsParsedPerEvent.push(document.getElementsByTagName('script').length); + } + + window.testlib.addScript = function(source, attributes, parent, firstInParent,funcPrepare) { + try{ + parent = parent||document.body; + var script = document.createElement('script'); + if(funcPrepare) { + funcPrepare(script); + } + if(source)script.appendChild( document.createTextNode(source) ); + for( var name in attributes){ + if(/^on/i.test(name)) { + script[name] = attributes[name]; + } else { + script.setAttribute(name, attributes[name]); + } + } + if (firstInParent && parent.firstChild) { + parent.insertBefore(script, parent.firstChild); + } else { + parent.appendChild(script); + } + } catch(e) { + log('ERROR when adding script to DOM!'); + alert(e); + } + return script; + } + + window.testlib.urlParam = function(relativeURL) { + return location.href.replace( /\d*\.html$/, relativeURL); + } +})();