fix some browser bug

This commit is contained in:
Face
2025-09-08 20:19:50 +03:00
parent 3b87ab39c9
commit ac261e7d18
6 changed files with 30 additions and 17 deletions

View File

@@ -1,4 +1,20 @@
extends Control
@onready var console: DevToolsConsole = $DevTools/TabContainer/Console
func _ready():
connect_console_signals()
func connect_console_signals():
if console:
Trace.get_instance().log_message.connect(_on_trace_log_message)
func get_console() -> DevToolsConsole:
return console
func _on_trace_log_message(message: String, level: String, timestamp: float):
if console:
console.add_log_entry(message, level, timestamp)
func _on_close_button_pressed():
Engine.get_main_loop().current_scene._toggle_dev_tools()

View File

@@ -86,7 +86,8 @@ func create_log_item(entry: Dictionary) -> Control:
"scroll_fit_content_height": true,
"transparent_background": true,
"syntax_highlighter": input_line.syntax_highlighter.duplicate(),
"block_editing_signals": true
"block_editing_signals": true,
"size_flags_vertical": Control.SIZE_SHRINK_CENTER
})
message_code_edit.gui_input.connect(_on_log_code_edit_gui_input)

View File

@@ -48,6 +48,12 @@ static func resolve_url(base_url: String, relative_url: String) -> String:
else:
host = remainder.substr(0, first_slash)
var path = remainder.substr(first_slash + 1)
# Remove query parameters from the path for URL resolution
var query_start = path.find("?")
if query_start != -1:
path = path.substr(0, query_start)
if not path.is_empty():
current_path_parts = path.split("/")

View File

@@ -485,7 +485,12 @@ func render_content(html_bytes: PackedByteArray) -> void:
if scripts.size() > 0 and lua_api:
parser.process_scripts(lua_api, null)
if parse_result.external_scripts and not parse_result.external_scripts.is_empty():
await parser.process_external_scripts(lua_api, null, current_domain)
# Extract base URL without query parameters for script resolution
var base_url_for_scripts = current_domain
var query_pos = base_url_for_scripts.find("?")
if query_pos != -1:
base_url_for_scripts = base_url_for_scripts.substr(0, query_pos)
await parser.process_external_scripts(lua_api, null, base_url_for_scripts)
var postprocess_element = parser.process_postprocess()
if postprocess_element: