From 86234795fbae9ec95d299848fe50e7bd8139cd8a Mon Sep 17 00:00:00 2001 From: Witold Filipczyk Date: Sat, 22 Jun 2024 12:29:07 +0200 Subject: [PATCH] [ecmascript] reset_document before rewrite --- src/ecmascript/ecmascript.c | 3 +++ src/ecmascript/spidermonkey/element.cpp | 1 - src/viewer/text/draw.c | 3 ++- test/ecmascript/ajax.html | 3 +-- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ecmascript/ecmascript.c b/src/ecmascript/ecmascript.c index 6979dca84..0a375f2a9 100644 --- a/src/ecmascript/ecmascript.c +++ b/src/ecmascript/ecmascript.c @@ -266,6 +266,9 @@ delayed_reload(void *data) assert(rel); object_unlock(rel->document); + + reset_document(rel->document); + rel->document->links_sorted = 0; dump_xhtml(rel->cached, rel->document, 1 + rel->was_write); sort_links(rel->document); draw_formatted(ses, 2); diff --git a/src/ecmascript/spidermonkey/element.cpp b/src/ecmascript/spidermonkey/element.cpp index f98741acc..95a6ee531 100644 --- a/src/ecmascript/spidermonkey/element.cpp +++ b/src/ecmascript/spidermonkey/element.cpp @@ -4619,7 +4619,6 @@ element_getElementsByTagName(JSContext *ctx, unsigned int argc, JS::Value *vp) args.rval().setNull(); return true; } - exc = dom_element_get_elements_by_tag_name(el, tagname, &nlist); dom_string_unref(tagname); diff --git a/src/viewer/text/draw.c b/src/viewer/text/draw.c index 7e758bb3d..07b32f8da 100644 --- a/src/viewer/text/draw.c +++ b/src/viewer/text/draw.c @@ -585,8 +585,9 @@ draw_formatted(struct session *ses, int rerender) if (rerender) { rerender--; /* Mind this when analyzing @rerender. */ - if (!(rerender & 2) && session_is_loading(ses)) + if (!(rerender & 2) && session_is_loading(ses)) { rerender |= 2; + } render_document_frames(ses, rerender); /* Rerendering kills the document refreshing so restart it. */ diff --git a/test/ecmascript/ajax.html b/test/ecmascript/ajax.html index 0d7a5a5d6..076f3a6c0 100644 --- a/test/ecmascript/ajax.html +++ b/test/ecmascript/ajax.html @@ -11,8 +11,7 @@ function loadDoc() { var xhttp = new XMLHttpRequest(); xhttp.onload = function() { - document.getElementById("demo").innerHTML = - xhttp.responseText; + document.getElementById("demo").innerHTML = xhttp.responseText; } xhttp.open("GET", "ajax_info.txt"); xhttp.send();