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:
parent
84b41f6270
commit
45a87b1dbe
6 changed files with 36 additions and 1 deletions
|
|
@ -847,7 +847,8 @@ WebIDL::ExceptionOr<Document*> Document::open(Optional<String> const&, Optional<
|
|||
if (&entry_document != this)
|
||||
new_url.set_fragment({});
|
||||
|
||||
// FIXME: 3. Run the URL and history update steps with document and newURL.
|
||||
// 3. Run the URL and history update steps with document and newURL.
|
||||
HTML::perform_url_and_history_update_steps(*this, move(new_url));
|
||||
}
|
||||
|
||||
// 13. Set document's is initial about:blank to false.
|
||||
|
|
|
|||
|
|
@ -383,6 +383,7 @@ Text/input/wpt-import/html/the-xhtml-syntax/parsing-xhtml-documents/xhtml-mathml
|
|||
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/html/webappapis/dynamic-markup-insertion/opening-the-input-stream/url-entry-document-sync-call.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
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,8 @@
|
|||
Harness status: OK
|
||||
|
||||
Found 3 tests
|
||||
|
||||
3 Pass
|
||||
Pass document.open() changes document's URL to the entry global object's associate document's (sync call)
|
||||
Pass document.write() changes document's URL to the entry global object's associate document's (sync call)
|
||||
Pass document.writeln() changes document's URL to the entry global object's associate document's (sync call)
|
||||
|
|
@ -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)`);
|
||||
}
|
||||
Loading…
Reference in a new issue