mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibURL+LibWeb: Add a helper to check if a URL is a WebUI URL
Let's not have to know off-hand that we need to update Environments.cpp when adding a new WebUI. It's more obvious just below where we define the URLs.
This commit is contained in:
Notes:
github-actions[bot]
2026-04-09 14:09:52 +00:00
Author: https://github.com/trflynn89 Commit: https://github.com/LadybirdBrowser/ladybird/commit/2f3199adbf3 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8825
@@ -283,10 +283,8 @@ bool is_scripting_enabled(EnvironmentSettingsObject const& settings)
|
||||
// The user has not disabled scripting for realm at this time. (User agents may provide users with the option to disable scripting globally, or in a finer-grained manner, e.g., on a per-origin basis, down to the level of individual realms.)
|
||||
auto const& document = as<HTML::Window>(settings.global_object()).associated_document();
|
||||
|
||||
// NB: about:settings and about:processes are internal pages using javascript, so we do not consider user configuration for these pages.
|
||||
if (document.url() != URL::about_settings()
|
||||
&& document.url() != URL::about_processes()
|
||||
&& !document.page().is_scripting_enabled())
|
||||
// NB: WebUI pages are internal pages requiring javascript, so we do not consider user configuration for these.
|
||||
if (!document.page().is_scripting_enabled() && !URL::is_webui_url(document.url()))
|
||||
return false;
|
||||
|
||||
// Either settings's global object is not a Window object, or settings's global object's associated Document's active sandboxing flag set does not have its sandboxed scripts browsing context flag set.
|
||||
|
||||
Reference in New Issue
Block a user