mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 20:37:34 +00:00
LibWeb: Implement the window.opener
attribute
This returns a reference to the window that opened the current window.
This commit is contained in:
parent
5713c2ffdd
commit
fc1f037cd1
5 changed files with 63 additions and 0 deletions
5
Tests/LibWeb/Text/expected/HTML/Window-opener.txt
Normal file
5
Tests/LibWeb/Text/expected/HTML/Window-opener.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
window.opener initial value: null
|
||||
window.opener after setting to "test": test
|
||||
iframe contentWindow.opener initial value is the current window object: true
|
||||
iframe contentWindow.opener after setting to null: null
|
||||
iframe contentWindow.opener after setting to "test": test
|
20
Tests/LibWeb/Text/input/HTML/Window-opener.html
Normal file
20
Tests/LibWeb/Text/input/HTML/Window-opener.html
Normal file
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<iframe name="testFrame"></iframe>
|
||||
<script>
|
||||
asyncTest(done => {
|
||||
println(`window.opener initial value: ${window.opener}`);
|
||||
window.opener = "test";
|
||||
println(`window.opener after setting to "test": ${window.opener}`);
|
||||
const frame = document.querySelector("iframe");
|
||||
frame.onload = () => {
|
||||
println(`iframe contentWindow.opener initial value is the current window object: ${frame.contentWindow.opener === window}`);
|
||||
frame.contentWindow.opener = null;
|
||||
println(`iframe contentWindow.opener after setting to null: ${frame.contentWindow.opener}`);
|
||||
frame.contentWindow.opener = "test";
|
||||
println(`iframe contentWindow.opener after setting to "test": ${frame.contentWindow.opener}`);
|
||||
done();
|
||||
}
|
||||
window.open("about:srcdoc", "testFrame");
|
||||
});
|
||||
</script>
|
Loading…
Add table
Add a link
Reference in a new issue