mirror of
https://github.com/servo/servo.git
synced 2025-09-30 16:49:16 +01:00
Don't run scripts while DOM tree is undergoing mutations (#34505)
* script: Implement node insertion post-connection hook. Ensure script elements only run scripts when the DOM has stabilized. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Make iframe element use post-connection steps when handling initial document insertion. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Use a delayed task when running post-connection steps. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * script: Add explanatory comment. Signed-off-by: Josh Matthews <josh@joshmatthews.net> * Tidy. Signed-off-by: Josh Matthews <josh@joshmatthews.net> --------- Signed-off-by: Josh Matthews <josh@joshmatthews.net>
This commit is contained in:
parent
20d67bdc44
commit
981616f918
10 changed files with 117 additions and 51 deletions
|
@ -1,3 +0,0 @@
|
|||
[Node-appendChild-three-scripts-from-fragment.tentative.html]
|
||||
[Node.appendChild: inserting three scripts from a document fragment]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[Node-appendChild-three-scripts.tentative.html]
|
||||
[Node.appendChild: inserting three scripts from a div]
|
||||
expected: FAIL
|
|
@ -1,3 +0,0 @@
|
|||
[147.html]
|
||||
[scheduler: insert multiple inline scripts; first script moves subsequent scripts ]
|
||||
expected: FAIL
|
|
@ -1,13 +1,7 @@
|
|||
[Document-prototype-currentScript.html]
|
||||
expected: TIMEOUT
|
||||
expected: ERROR
|
||||
[document.currentScript must not be set to a script element that loads an external script in an open shadow tree]
|
||||
expected: TIMEOUT
|
||||
expected: FAIL
|
||||
|
||||
[document.currentScript must not be set to a script element that loads an external script in a closed shadow tree]
|
||||
expected: NOTRUN
|
||||
|
||||
[document.currentScript must be set to a script element that loads an external script that was in an open shadow tree and then removed]
|
||||
expected: NOTRUN
|
||||
|
||||
[document.currentScript must be set to a script element that loads an external script that was in a closed shadow tree and then removed]
|
||||
expected: NOTRUN
|
||||
expected: FAIL
|
||||
|
|
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
7
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -13529,6 +13529,13 @@
|
|||
{}
|
||||
]
|
||||
],
|
||||
"layout_blocker_operations.html": [
|
||||
"2df68bf1c13179688708c97eab19361608b0de82",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
]
|
||||
],
|
||||
"lenient_this.html": [
|
||||
"960c74613f3c2809bb1f2ee6121bf14f28267051",
|
||||
[
|
||||
|
|
34
tests/wpt/mozilla/tests/mozilla/layout_blocker_operations.html
vendored
Normal file
34
tests/wpt/mozilla/tests/mozilla/layout_blocker_operations.html
vendored
Normal file
|
@ -0,0 +1,34 @@
|
|||
<html>
|
||||
<head>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="foo"></div>
|
||||
|
||||
<script>
|
||||
function verifyLayoutAllowed(t) {
|
||||
t.step(() => {
|
||||
assert_equals(getComputedStyle(document.querySelector('#foo')).display, "block");
|
||||
t.done();
|
||||
})
|
||||
}
|
||||
|
||||
var insertionTest;
|
||||
async_test(function(t) {
|
||||
insertionTest = t;
|
||||
let script = document.createElement('script');
|
||||
document.body.appendChild(script);
|
||||
script.appendChild(document.createTextNode("verifyLayoutAllowed(insertionTest)"));
|
||||
}, "Insertion");
|
||||
|
||||
var replacementTest;
|
||||
async_test(function(t) {
|
||||
replacementTest = t;
|
||||
let script = document.createElement('script');
|
||||
document.body.appendChild(script);
|
||||
script.innerHTML = "verifyLayoutAllowed(replacementTest)";
|
||||
}, "Replace");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Add table
Add a link
Reference in a new issue