mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-24 19:21:52 +00:00
LibWeb: Allow executing scripts for iframes with src=about:blank
Fixes https://github.com/SerenityOS/serenity/issues/23836
This commit is contained in:
parent
c07d18c017
commit
94d72c174a
Notes:
sideshowbarker
2024-07-17 02:39:10 +09:00
Author: https://github.com/kalenikaliaksandr
Commit: 94d72c174a
Pull-request: https://github.com/SerenityOS/serenity/pull/23891
Issue: https://github.com/SerenityOS/serenity/issues/23836
4 changed files with 24 additions and 1 deletions
|
@ -0,0 +1 @@
|
||||||
|
message from test iframe
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<body>
|
||||||
|
<iframe id="target" src="about:blank"></iframe>
|
||||||
|
<script>
|
||||||
|
asyncTest(done => {
|
||||||
|
window.addEventListener("message", event => {
|
||||||
|
println(event.data);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
var script = target.contentDocument.createElement("script");
|
||||||
|
script.innerHTML = `parent.postMessage("message from test iframe", "*");`;
|
||||||
|
target.contentDocument.body.appendChild(script);
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</body>
|
|
@ -583,6 +583,7 @@ public:
|
||||||
void ensure_animation_timer();
|
void ensure_animation_timer();
|
||||||
|
|
||||||
bool ready_to_run_scripts() const { return m_ready_to_run_scripts; }
|
bool ready_to_run_scripts() const { return m_ready_to_run_scripts; }
|
||||||
|
void set_ready_to_run_scripts() { m_ready_to_run_scripts = true; }
|
||||||
|
|
||||||
JS::GCPtr<HTML::SessionHistoryEntry> latest_entry() const { return m_latest_entry; }
|
JS::GCPtr<HTML::SessionHistoryEntry> latest_entry() const { return m_latest_entry; }
|
||||||
void set_latest_entry(JS::GCPtr<HTML::SessionHistoryEntry> e) { m_latest_entry = e; }
|
void set_latest_entry(JS::GCPtr<HTML::SessionHistoryEntry> e) { m_latest_entry = e; }
|
||||||
|
|
|
@ -219,7 +219,12 @@ Optional<URL::URL> NavigableContainer::shared_attribute_processing_steps_for_ifr
|
||||||
|
|
||||||
// 4. If url matches about:blank and initialInsertion is true, then perform the URL and history update steps given element's content navigable's active document and url.
|
// 4. If url matches about:blank and initialInsertion is true, then perform the URL and history update steps given element's content navigable's active document and url.
|
||||||
if (url_matches_about_blank(url) && initial_insertion) {
|
if (url_matches_about_blank(url) && initial_insertion) {
|
||||||
perform_url_and_history_update_steps(*m_content_navigable->active_document(), url);
|
auto& document = *m_content_navigable->active_document();
|
||||||
|
|
||||||
|
perform_url_and_history_update_steps(document, url);
|
||||||
|
|
||||||
|
// Spec issue: https://github.com/whatwg/html/issues/10261
|
||||||
|
document.set_ready_to_run_scripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
// 5. Return url.
|
// 5. Return url.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue