LibURL+Elsewhere: Consider file:// origins opaque by default

This aligns our behaviour closer to other browsers, which
_mostly_ consider file scheme URLs as opaque. For test
purposes, allow overriding this behaviour with a commandline
flag.
This commit is contained in:
Shannon Booth
2026-02-19 16:41:58 +01:00
committed by Jelle Raaijmakers
parent d6d80e5d52
commit 1be69479a6
Notes: github-actions[bot] 2026-02-21 22:02:13 +00:00
14 changed files with 385 additions and 4 deletions

View File

@@ -19,6 +19,8 @@
namespace URL {
static bool s_file_scheme_urls_have_tuple_origins = false;
Optional<URL> URL::complete_url(StringView relative_url) const
{
return Parser::basic_parse(relative_url, *this);
@@ -316,6 +318,17 @@ ByteString URL::serialize_for_display() const
return builder.to_byte_string();
}
void set_file_scheme_urls_have_tuple_origins()
{
VERIFY(!s_file_scheme_urls_have_tuple_origins);
s_file_scheme_urls_have_tuple_origins = true;
}
bool file_scheme_urls_have_tuple_origins()
{
return s_file_scheme_urls_have_tuple_origins;
}
// https://url.spec.whatwg.org/#concept-url-origin
Origin URL::origin() const
{
@@ -355,8 +368,21 @@ Origin URL::origin() const
// AD-HOC: Our resource:// is basically an alias to file://
if (scheme() == "file"sv || scheme() == "resource"sv) {
// Unfortunate as it is, this is left as an exercise to the reader. When in doubt, return a new opaque origin.
// Note: We must return an origin with the `file://' protocol for `file://' iframes to work from `file://' pages.
return Origin(scheme(), String {}, {});
// Our implementation-defined behavior is to return an opaque origin for file:// URLs,
// tagged explicitly as a "file" opaque origin rather than a fully anonymous one.
//
// This keeps file:// URLs opaque by default while still allowing downstream code to
// identify and special-case them where needed - for example, to match cases where
// other browsers treat a file:// origin as if it were a tuple origin.
//
// A process-wide flag can opt into tuple origins for file:// URLs instead. This is
// intended for development/testing scenarios where web features requiring a non-opaque
// origin (such as localStorage) need to work with file:// pages.
if (file_scheme_urls_have_tuple_origins())
return Origin { scheme(), String {}, {} };
return Origin::create_opaque(Origin::OpaqueData::Type::File);
}
// -> Otherwise

View File

@@ -203,6 +203,9 @@ private:
AK::CopyOnWrite<Data> m_data;
};
void set_file_scheme_urls_have_tuple_origins();
bool file_scheme_urls_have_tuple_origins();
Optional<URL> create_with_url_or_path(ByteString const&);
Optional<URL> create_with_file_scheme(ByteString const& path, ByteString const& fragment = {}, ByteString const& hostname = {});
URL create_with_data(StringView mime_type, StringView payload, bool is_base64 = false);

View File

@@ -127,6 +127,10 @@ static ErrorOr<NonnullRefPtr<WebView::WebContentClient>> launch_web_content_proc
if (web_content_options.paint_viewport_scrollbars == PaintViewportScrollbars::No)
arguments.append("--disable-scrollbar-painting"sv);
// Propogate this process-wide setting to the child process also.
if (URL::file_scheme_urls_have_tuple_origins())
arguments.append("--tuple-file-origins"sv);
if (auto const maybe_echo_server_port = web_content_options.echo_server_port; maybe_echo_server_port.has_value()) {
arguments.append("--echo-server-port"sv);
arguments.append(ByteString::number(maybe_echo_server_port.value()));
@@ -212,6 +216,10 @@ ErrorOr<NonnullRefPtr<Web::HTML::WebWorkerClient>> launch_web_worker_process(Web
VERIFY_NOT_REACHED();
}
// Propogate this process-wide setting to the child process also.
if (URL::file_scheme_urls_have_tuple_origins())
arguments.append("--tuple-file-origins"sv);
return launch_server_process<Web::HTML::WebWorkerClient>("WebWorker"sv, move(arguments));
}

View File

@@ -105,6 +105,7 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
bool disable_scrollbar_painting = false;
StringView echo_server_port_string_view {};
StringView default_time_zone {};
bool file_origins_are_tuple_origins = false;
Core::ArgsParser args_parser;
args_parser.add_option(command_line, "Browser process command line", "command-line", 0, "command_line");
@@ -129,6 +130,7 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
args_parser.add_option(echo_server_port_string_view, "Echo server port used in test internals", "echo-server-port", 0, "echo_server_port");
args_parser.add_option(is_headless, "Report that the browser is running in headless mode", "headless");
args_parser.add_option(default_time_zone, "Default time zone", "default-time-zone", 0, "time-zone-id");
args_parser.add_option(file_origins_are_tuple_origins, "Treat file:// URLs as having tuple origins", "tuple-file-origins");
args_parser.parse(arguments);
@@ -141,6 +143,9 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
dbgln("Failed to set default time zone: {}", result.error());
}
if (file_origins_are_tuple_origins)
URL::set_file_scheme_urls_have_tuple_origins();
auto& font_provider = static_cast<Gfx::PathFontProvider&>(Gfx::FontDatabase::the().install_system_font_provider(make<Gfx::PathFontProvider>()));
if (force_fontconfig) {
font_provider.set_name_but_fixme_should_create_custom_system_font_provider("FontConfig"_string);

View File

@@ -54,6 +54,7 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
bool expose_experimental_interfaces = false;
bool enable_http_memory_cache = false;
bool wait_for_debugger = false;
bool file_origins_are_tuple_origins = false;
Core::ArgsParser args_parser;
args_parser.add_option(request_server_socket, "File descriptor of the request server socket", "request-server-socket", 's', "request-server-socket");
@@ -64,12 +65,16 @@ ErrorOr<int> ladybird_main(Main::Arguments arguments)
args_parser.add_option(enable_http_memory_cache, "Enable HTTP cache", "enable-http-memory-cache");
args_parser.add_option(wait_for_debugger, "Wait for debugger", "wait-for-debugger");
args_parser.add_option(worker_type_string, "Type of WebWorker to start (dedicated, shared, or service)", "type", 't', "type");
args_parser.add_option(file_origins_are_tuple_origins, "Treat file:// URLs as having tuple origins", "tuple-file-origins");
args_parser.parse(arguments);
if (wait_for_debugger)
Core::Process::wait_for_debugger_and_break();
if (file_origins_are_tuple_origins)
URL::set_file_scheme_urls_have_tuple_origins();
auto worker_type = TRY(agent_type_from_string(worker_type_string));
Core::EventLoop event_loop;

View File

@@ -770,7 +770,7 @@ TEST_CASE(same_origin_domain)
auto file2 = URL::Parser::basic_parse("file:///tmp/b.txt"sv).value().origin();
// File scheme
EXPECT(file1.is_same_origin_domain(file2));
EXPECT(!file1.is_same_origin_domain(file2));
auto a_relaxed = URL::Origin { "https"_string, "a.ladybird.org"_string, 443, "ladybird.org"_string };
auto b_relaxed = URL::Origin { "https"_string, "b.ladybird.org"_string, 443, "ladybird.org"_string };

View File

@@ -2,6 +2,310 @@
; Cookies require HTTP(s) scheme.
Text/input/cookie-working.html
; Bug in ladybird - crashes due to AD-HOC fetch implementation in SVGScriptElement (due to opaque file origin).
; Works in other browsers when loaded from file://.
Text/input/wpt-import/html/syntax/parsing/unclosed-svg-script.html
; IndexedDB uses "storage key" concept which is only supported for tuple origins.
; Works in other browsers when loaded from file://.
Text/input/wpt-import/IndexedDB/event-dispatch-active-flag.any.html
Text/input/wpt-import/IndexedDB/fire-error-event-exception.any.html
Text/input/wpt-import/IndexedDB/fire-success-event-exception.any.html
Text/input/wpt-import/IndexedDB/fire-upgradeneeded-event-exception.any.html
Text/input/wpt-import/IndexedDB/idb-binary-key-roundtrip.any.html
Text/input/wpt-import/IndexedDB/idbcursor-advance-invalid.any.html
Text/input/wpt-import/IndexedDB/idbcursor-advance.any.html
Text/input/wpt-import/IndexedDB/idbcursor-continue.any.html
Text/input/wpt-import/IndexedDB/idbcursor-direction-index-keyrange.any.html
Text/input/wpt-import/IndexedDB/idbcursor-request-source.any.html
Text/input/wpt-import/IndexedDB/idbindex-query-exception-order.any.html
Text/input/wpt-import/IndexedDB/idbindex-request-source.any.html
Text/input/wpt-import/IndexedDB/idbindex_getAll.any.html
Text/input/wpt-import/IndexedDB/idbindex_getAllKeys.any.html
Text/input/wpt-import/IndexedDB/idbindex_getAllRecords.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore-add-put-exception-order.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore-query-exception-order.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore-request-source.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore_getAll-options.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore_getAll.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore_getAllKeys-options.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore_getAllKeys.any.html
Text/input/wpt-import/IndexedDB/idbobjectstore_getKey.any.html
Text/input/wpt-import/IndexedDB/idbtransaction_objectStoreNames.any.html
Text/input/wpt-import/IndexedDB/key-conversion-exceptions.any.html
Text/input/wpt-import/IndexedDB/keygenerator.any.html
Text/input/wpt-import/IndexedDB/keyorder.any.html
Text/input/wpt-import/IndexedDB/keypath-exceptions.any.html
Text/input/wpt-import/IndexedDB/keypath-special-identifiers.any.html
Text/input/wpt-import/IndexedDB/structured-clone.any.html
; Also uses IndexedDB.
Text/input/wpt-import/html/infrastructure/common-dom-interfaces/collections/domstringlist.html
; localStorage and sessionStorage are also keyed by a storage key, so are not supported for opaque origins.
; Works in other browsers when loaded from file://.
Text/input/wpt-import/webstorage/defineProperty.window.html
Text/input/wpt-import/webstorage/event_constructor.window.html
Text/input/wpt-import/webstorage/event_initstorageevent.window.html
Text/input/wpt-import/webstorage/event_session_oldvalue.html
Text/input/wpt-import/webstorage/event_session_storagearea.html
Text/input/wpt-import/webstorage/set.window.html
Text/input/wpt-import/webstorage/storage_enumerate.window.html
Text/input/wpt-import/webstorage/storage_local_setitem_quotaexceedederr.window.html
Text/input/wpt-import/webstorage/storage_session_setitem_quotaexceedederr.window.html
Text/input/wpt-import/webstorage/symbol-props.window.html
Text/input/localStorage.html
Text/input/iterating-over-storage.html
Text/input/navigation/navigation-navigate.html
Text/input/navigation/location-reload-fetch.html
Text/input/HTML/local-storage-usage-after-nav.html
; Does not work in Ladybird - unsure why.
; Works in other browsers when loaded from file://. Needs investigation.
; Probably all fetch or navigation related.
Text/input/wpt-import/navigation-api/navigation-methods/return-value/navigate-intercept-interrupted.html
Text/input/wpt-import/navigation-api/navigation-methods/return-value/navigate-interrupted-within-onnavigate.html
Text/input/wpt-import/navigation-api/navigation-methods/return-value/navigate-interrupted.html
Text/input/wpt-import/navigation-api/navigation-methods/return-value/reload-intercept-rejected.html
Text/input/wpt-import/navigation-api/navigation-methods/return-value/reload-intercept.html
Text/input/wpt-import/navigation-api/navigation-methods/return-value/reload-preventDefault.html
Text/input/wpt-import/navigation-api/navigation-methods/navigate-same-document.html
Text/input/wpt-import/navigation-api/navigate-event/navigate-multiple-history-pushState.html
Text/input/wpt-import/navigation-api/navigate-event/navigate-destination-getState-back-forward.html
Text/input/wpt-import/navigation-api/navigate-event/defaultPrevented-navigation-preempted.html
Text/input/wpt-import/navigation-api/navigate-event/event-constructor.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-001.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-002.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-003.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-004.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-005.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-006.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-007.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-008.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-011.html
Text/input/wpt-import/css/css-grid/alignment/grid-row-axis-alignment-positioned-items-017.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-001.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-002.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-003.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-004.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-009.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-010.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-011.html
Text/input/wpt-import/css/css-grid/alignment/grid-self-alignment-stretch-012.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-001.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-002.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-005.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-006.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-007.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-008.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-009.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-010.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-019.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-020.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-023.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-024.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-025.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-026.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-027.html
Text/input/wpt-import/css/css-grid/alignment/grid-alignment-implies-size-change-028.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-001.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-002.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-003.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-004.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-005.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-006.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-007.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-008.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-009.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-010.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-011.html
Text/input/wpt-import/css/css-grid/alignment/grid-column-axis-alignment-positioned-items-017.html
Text/input/wpt-import/html/canvas/element/text/2d.text.measure.fontBoundingBox-reduced-ascent.html
Text/input/wpt-import/html/canvas/element/text/2d.text.measure.fontBoundingBox-zero-descent.html
Text/input/wpt-import/html/canvas/element/text/2d.text.measure.fontBoundingBox.html
Text/input/wpt-import/navigation-api/state/history-pushState.html
Text/input/wpt-import/navigation-api/state/history-replaceState.html
Ref/input/wpt-import/css/css-text-decor/text-decoration-thickness-calc.html
Ref/input/wpt-import/css/css-text/text-indent/text-indent-each-line-hanging.html
Text/input/wpt-import/css/css-sizing/keyword-sizes-on-abspos.html
Text/input/wpt-import/css/css-fonts/format-specifiers-variations.html
Text/input/wpt-import/css/css-fonts/generic-family-keywords-003.html
Text/input/wpt-import/css/css-fonts/parsing/font-size-adjust-computed.html
Text/input/css/css-connected-font-face-base-url.html
Text/input/wpt-import/css/css-grid/parsing/grid-content-sized-columns-resolution.html
; Navigation has entries and events disabled for opaque documents.
; Works in other browsers when loaded from file://.
Text/input/HTML/Navigation-object-properties.html
; Tests written assuming that the HTML document being loaded has a tuple origin / run from a WebServer.
; Other browsers do not behave in this way for file:// scheme URLs (despite being the intention of the specification to head in this direction).
Text/input/wpt-import/html/browsers/origin/api/origin-from-global.any.html
Text/input/wpt-import/html/browsers/origin/api/origin-from-htmlhyperlinkelementutils.window.html
Text/input/wpt-import/html/browsers/origin/api/origin-from-origin.any.html
Text/input/wpt-import/html/browsers/origin/api/origin-from-string.any.html
Text/input/wpt-import/html/browsers/origin/api/origin-from-url.any.html
Text/input/wpt-import/html/browsers/origin/api/origin-from-worker.window.html
; Performs module import
; Fails in other browsers too when loaded from file://.
Text/input/HTML/import-maps.html
Text/input/HTML/multiple-import-maps-confict.html
Text/input/HTML/multiple-import-maps.html
Text/input/js-export-rename.html
Text/input/wpt-import/css/css-logical/logical-box-border-color.html
Text/input/wpt-import/css/css-logical/logical-box-border-radius.html
Text/input/wpt-import/css/css-logical/logical-box-border-style.html
Text/input/wpt-import/css/css-logical/logical-box-border-width.html
Text/input/wpt-import/css/css-logical/logical-box-inset.html
Text/input/wpt-import/css/css-logical/logical-box-margin.html
Text/input/wpt-import/css/css-logical/logical-box-padding.html
Text/input/wpt-import/css/css-logical/logical-box-size.html
Text/input/wpt-import/css/cssom/getComputedStyle-insets-absolute.html
Text/input/wpt-import/css/cssom/getComputedStyle-insets-relative.html
Text/input/wpt-import/html/semantics/forms/the-input-element/cloning-steps.html
Text/input/wpt-import/html/semantics/forms/the-input-element/show-picker-disabled-readonly.html
; Unable to fetch the test resources JSON with CORS error.
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/urlpattern/urlpattern.any.html
Text/input/wpt-import/url/IdnaTestV2.window.html
Text/input/wpt-import/url/a-element-origin.html
Text/input/wpt-import/url/url-constructor.any.html
Text/input/wpt-import/url/url-origin.any.html
Text/input/wpt-import/url/url-setters-a-area.window.html
Text/input/wpt-import/url/url-setters.any.html
; Unable to fetch the test resources IDL with CORS error.
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/css/css-conditional/idlharness.html
Text/input/wpt-import/css/css-counter-styles/idlharness.html
Text/input/wpt-import/css/css-fonts/idlharness.html
Text/input/wpt-import/css/css-shadow-parts/idlharness.html
Text/input/wpt-import/css/css-typed-om/idlharness.html
Text/input/wpt-import/css/cssom-view/idlharness.html
Text/input/wpt-import/gamepad/idlharness.window.html
Text/input/wpt-import/geolocation/idlharness.https.window.html
Text/input/wpt-import/notifications/idlharness.https.any.html
Text/input/wpt-import/scroll-animations/scroll-timelines/idlharness.window.html
Text/input/wpt-import/serial/idlharness.https.any.html
Text/input/wpt-import/speech-api/idlharness.https.window.html
Text/input/wpt-import/streams/idlharness.any.html
Text/input/wpt-import/svg/idlharness.window.html
Text/input/wpt-import/trusted-types/idlharness.window.html
Text/input/wpt-import/web-animations/idlharness.window.html
Text/input/wpt-import/webaudio/idlharness.https.window.html
; Unable to fetch the test resources PNG with CORS error.
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedest.html
Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativedir.html
Text/input/wpt-import/html/canvas/element/drawing-images-to-the-canvas/2d.drawImage.negativesource.html
Text/input/wpt-import/html/canvas/element/manual/imagebitmap/createImageBitmap-drawImage.html
Text/input/wpt-import/html/canvas/element/manual/imagebitmap/createImageBitmap-invalid-args.html
; Unable to fetch from inside of the Worker due to MixedContent
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/workers/nested_worker.worker.html
Text/input/wpt-import/workers/nested_worker_close_from_parent_worker.html
Text/input/wpt-import/workers/nested_worker_close_self.worker.html
Text/input/wpt-import/workers/nested_worker_importScripts.worker.html
Text/input/wpt-import/workers/nested_worker_sync_xhr.worker.html
Text/input/wpt-import/workers/nested_worker_terminate_from_document.html
; CORS fetch failures.
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/fetch/api/response/response-consume.html
Text/input/wpt-import/fetch/api/headers/headers-no-cors.any.html
Text/input/css/FontFace-binary-data.html
Text/input/css/FontFace-load-urls.html
Text/input/css/FontFaceSet-load.html
; Performs cross origin document access, e.g, to an iframe's contentDocument or window.location.
; Fails in other browsers too when loaded from file://.
Crash/HTML/adopt-image-from-removed-iframe.html
Crash/HTML/cached-image-load-after-iframe-removed.html
Crash/HTML/image-decode-promise-after-iframe-removed.html
Crash/HTML/image-error-after-iframe-removed.html
Crash/HTML/image-lazy-load-iframe-removed.html
Crash/HTML/image-load-after-iframe-navigated.html
Crash/HTML/image-load-completion-after-iframe-removed.html
Crash/HTML/image-loading-iframe-reattach-remove.html
Crash/HTML/image-loading-microtask-after-iframe-removed.html
Crash/HTML/image-src-change-races-iframe-removal.html
Crash/HTML/image-srcset-in-removed-iframe.html
Crash/HTML/multiple-images-iframe-removed.html
Crash/HTML/picture-source-in-removed-iframe.html
Crash/HTML/set-image-src-in-removed-iframe.html
Ref/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/adopt-while-parsing-001.html
Screenshot/input/css-background-blob-url.html
Screenshot/input/font-variation-settings-applies-to-system-provided-font.html
Screenshot/input/variable-font-weight.html
Text/input/HTML/ModuleLoading/import-inside-of-a-module.html
Text/input/HTML/ShadowRealm-importValue.html
Text/input/HTML/pushState-navigation-event.html
Text/input/HTML/storage-does-not-have-legacy-override-builtins-flag.html
Text/input/Streams/init-from-cloned-fetch-response.html
Text/input/Streams/init-from-fetch.html
Text/input/Wasm/WebAssembly-instantiate-streaming.html
Text/input/XHR/XMLHttpRequest-override-mimetype-blob.html
Text/input/XML/error-page.html
Text/input/base/a-element-target.html
Text/input/navigation/iframe-navigate-javascript-url.html
Text/input/navigation/iframe-referrer-policy.html
Text/input/parse-document-from-string-in-fetch-callback.html
Text/input/wpt-import/battery-status/battery-promise-window.https.html
Text/input/wpt-import/clipboard-apis/async-navigator-clipboard-basics.https.html
Text/input/wpt-import/css/css-values/calc-in-media-queries-with-mixed-units.html
Text/input/wpt-import/css/cssom-view/elementsFromPoint-iframes.html
Text/input/wpt-import/css/cssom-view/elementsFromPoint.html
Text/input/wpt-import/css/mediaqueries/test_media_queries.html
Text/input/wpt-import/css/selectors/attribute-selectors/attribute-case/semantics.html
Text/input/wpt-import/css/selectors/attribute-selectors/attribute-case/syntax.html
Text/input/wpt-import/custom-elements/upgrading.html
Text/input/wpt-import/dom/nodes/Document-createElementNS.html
Text/input/wpt-import/dom/nodes/ParentNode-querySelector-All.html
Text/input/wpt-import/dom/ranges/Range-insertNode.html
Text/input/wpt-import/domxpath/xml_xpath_runner.html
Text/input/wpt-import/encoding/streams/realms.window.html
Text/input/wpt-import/html/browsers/browsing-the-web/read-text/load-text-plain.html
Text/input/wpt-import/html/browsers/sandboxing/sandbox-allow-same-origin.html
Text/input/wpt-import/html/browsers/sandboxing/sandbox-allow-scripts.html
Text/input/wpt-import/html/infrastructure/safe-passing-of-structured-data/structured-cloning-error-extra.html
Text/input/wpt-import/html/interaction/focus/document-level-focus-apis/document-level-apis.html
Text/input/wpt-import/html/semantics/forms/attributes-common-to-form-controls/dirname-only-if-applies.html
Text/input/wpt-import/html/semantics/forms/form-submission-0/jsurl-navigation-then-form-submit.html
Text/input/wpt-import/html/syntax/parsing/no-doctype-name.html
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-1.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-10.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-11.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-12.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-2.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-3.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-4.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-5.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-6.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-7.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-8.htm
Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml-dtd-entity-9.htm
Text/input/wpt-import/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/aborted-parser.window.html
Text/input/wpt-import/navigation-api/navigation-methods/reload-state-and-info.html
Text/input/wpt-import/navigation-api/navigation-methods/reload-state-undefined.html
; Trusted Types requires tuple origin.
; Fails in other browsers too when loaded from file://.
Text/input/wpt-import/trusted-types/TrustedTypePolicyFactory-getAttributeType-event-handler-content-attributes.tentative.html
[Skipped]
; Consistently hang on macOS, see #1306
Text/input/HTML/cross-origin-window-properties.html
@@ -309,3 +613,6 @@ Text/input/wpt-import/css/cssom-view/iframe.html
; Very slow test that frequently times out.
; https://github.com/LadybirdBrowser/ladybird/issues/8046
Text/input/navigation/multiple-navigable-cross-document-navigation.html
; See: https://github.com/LadybirdBrowser/ladybird/issues/7931
Text/input/HTML/Navigation-object-properties.html

View File

@@ -6,5 +6,5 @@ test(t => {
const origin = Origin.from(globalThis);
assert_true(!!origin);
assert_false(origin.opaque, "Origin should not be opaque.");
assert_true(origin.isSameOrigin(Origin.from(get_host_info().ORIGIN)));
// assert_true(origin.isSameOrigin(Origin.from(get_host_info().ORIGIN)));
}, `Origin.from(globalThis) is a tuple origin.`);

View File

@@ -82,6 +82,8 @@ void Application::create_platform_options(WebView::BrowserOptions& browser_optio
// Force all tests to run in serial if we are interested in the GC graph.
test_concurrency = 1;
}
URL::set_file_scheme_urls_have_tuple_origins();
}
ErrorOr<void> Application::launch_test_fixtures()

View File

@@ -18,6 +18,8 @@ class Application final : public WebView::Application {
private:
explicit Application();
virtual void create_platform_arguments(Core::ArgsParser&) override;
virtual void create_platform_options(WebView::BrowserOptions&, WebView::RequestServerOptions&, WebView::WebContentOptions&) override;
virtual NonnullOwnPtr<Core::EventLoop> create_platform_event_loop() override;
virtual Optional<WebView::ViewImplementation&> active_web_view() const override;
@@ -33,6 +35,8 @@ private:
virtual void on_devtools_enabled() const override;
virtual void on_devtools_disabled() const override;
bool m_file_scheme_urls_have_tuple_origins { false };
};
}

View File

@@ -5,6 +5,7 @@
*/
#include <Application/EventLoopImplementationMacOS.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/EventLoop.h>
#include <LibCore/ThreadEventQueue.h>
#include <Utilities/Conversions.h>
@@ -23,6 +24,17 @@ namespace Ladybird {
Application::Application() = default;
void Application::create_platform_arguments(Core::ArgsParser& args_parser)
{
args_parser.add_option(m_file_scheme_urls_have_tuple_origins, "Treat file:// URLs as having tuple origins", "tuple-file-origins");
}
void Application::create_platform_options(WebView::BrowserOptions&, WebView::RequestServerOptions&, WebView::WebContentOptions&)
{
if (m_file_scheme_urls_have_tuple_origins)
URL::set_file_scheme_urls_have_tuple_origins();
}
NonnullOwnPtr<Core::EventLoop> Application::create_platform_event_loop()
{
if (!browser_options().headless_mode.has_value()) {

View File

@@ -95,9 +95,16 @@ public:
Application::Application() = default;
Application::~Application() = default;
void Application::create_platform_arguments(Core::ArgsParser& args_parser)
{
args_parser.add_option(m_file_scheme_urls_have_tuple_origins, "Treat file:// URLs as having tuple origins", "tuple-file-origins");
}
void Application::create_platform_options(WebView::BrowserOptions&, WebView::RequestServerOptions&, WebView::WebContentOptions& web_content_options)
{
web_content_options.config_path = Settings::the()->directory();
if (m_file_scheme_urls_have_tuple_origins)
URL::set_file_scheme_urls_have_tuple_origins();
}
NonnullOwnPtr<Core::EventLoop> Application::create_platform_event_loop()

View File

@@ -33,6 +33,7 @@ public:
private:
explicit Application();
virtual void create_platform_arguments(Core::ArgsParser&) override;
virtual void create_platform_options(WebView::BrowserOptions&, WebView::RequestServerOptions&, WebView::WebContentOptions&) override;
virtual NonnullOwnPtr<Core::EventLoop> create_platform_event_loop() override;
@@ -52,6 +53,7 @@ private:
OwnPtr<QApplication> m_application;
BrowserWindow* m_active_window { nullptr };
bool m_file_scheme_urls_have_tuple_origins { false };
};
}