mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
LibWeb: Update document URL to the entry document URL in document.open()
When document.open() is called from another window, the opened document's URL should be updated to match the calling document's URL.
This commit is contained in:
committed by
Jelle Raaijmakers
parent
84b41f6270
commit
45a87b1dbe
Notes:
github-actions[bot]
2026-03-23 08:01:42 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/45a87b1dbee Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8577 Reviewed-by: https://github.com/gmta ✅
@@ -0,0 +1,4 @@
|
||||
<!doctype html>
|
||||
<script>
|
||||
window.callDocumentMethod = methodName => document[methodName]();
|
||||
</script>
|
||||
@@ -0,0 +1,8 @@
|
||||
<!doctype html>
|
||||
<meta charset=utf-8>
|
||||
|
||||
<script src="../../../../resources/testharness.js"></script>
|
||||
<script src="../../../../resources/testharnessreport.js"></script>
|
||||
|
||||
<div id=log></div>
|
||||
<script src="../../../../html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.window.js"></script>
|
||||
@@ -0,0 +1,13 @@
|
||||
for (const methodName of ["open", "write", "writeln"]) {
|
||||
async_test(t => {
|
||||
const frame = document.body.appendChild(document.createElement("iframe"));
|
||||
t.add_cleanup(() => { frame.remove(); });
|
||||
const frameURL = new URL("resources/url-entry-document-incumbent-frame.html", document.URL).href;
|
||||
frame.onload = t.step_func_done(() => {
|
||||
assert_equals(frame.contentDocument.URL, frameURL);
|
||||
frame.contentWindow.callDocumentMethod(methodName);
|
||||
assert_equals(frame.contentDocument.URL, document.URL);
|
||||
});
|
||||
frame.src = frameURL;
|
||||
}, `document.${methodName}() changes document's URL to the entry global object's associate document's (sync call)`);
|
||||
}
|
||||
Reference in New Issue
Block a user