mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Document's current script should not be updated when executing script elements inside shadow trees (#34787)
* check if node is in shadow tree Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * Removed meta ini related file Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> * refactored as_parent()'s calls Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com> --------- Signed-off-by: Domenico Rizzo <domenico.rizzo@gmail.com>
This commit is contained in:
parent
fd39d0d658
commit
d1de3cc407
2 changed files with 9 additions and 8 deletions
|
@ -34,6 +34,7 @@ use style::str::{StaticStringVec, HTML_SPACE_CHARACTERS};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
use crate::document_loader::LoadType;
|
use crate::document_loader::LoadType;
|
||||||
|
use crate::dom::activation::Activatable;
|
||||||
use crate::dom::attr::Attr;
|
use crate::dom::attr::Attr;
|
||||||
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||||
use crate::dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods;
|
use crate::dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods;
|
||||||
|
@ -66,6 +67,7 @@ use crate::script_module::{
|
||||||
use crate::script_runtime::CanGc;
|
use crate::script_runtime::CanGc;
|
||||||
use crate::task_source::{TaskSource, TaskSourceName};
|
use crate::task_source::{TaskSource, TaskSourceName};
|
||||||
use crate::unminify::{unminify_js, ScriptSource};
|
use crate::unminify::{unminify_js, ScriptSource};
|
||||||
|
use crate::HasParent;
|
||||||
|
|
||||||
impl ScriptSource for ScriptOrigin {
|
impl ScriptSource for ScriptOrigin {
|
||||||
fn unminified_dir(&self) -> Option<String> {
|
fn unminified_dir(&self) -> Option<String> {
|
||||||
|
@ -946,7 +948,13 @@ impl HTMLScriptElement {
|
||||||
let old_script = document.GetCurrentScript();
|
let old_script = document.GetCurrentScript();
|
||||||
|
|
||||||
match script.type_ {
|
match script.type_ {
|
||||||
ScriptType::Classic => document.set_current_script(Some(self)),
|
ScriptType::Classic => {
|
||||||
|
if self.upcast::<Node>().is_in_shadow_tree() {
|
||||||
|
document.set_current_script(None)
|
||||||
|
} else {
|
||||||
|
document.set_current_script(Some(self))
|
||||||
|
}
|
||||||
|
},
|
||||||
ScriptType::Module => document.set_current_script(None),
|
ScriptType::Module => document.set_current_script(None),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
[Document-prototype-currentScript.html]
|
|
||||||
expected: ERROR
|
|
||||||
[document.currentScript must not be set to a script element that loads an external script in an open shadow tree]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[document.currentScript must not be set to a script element that loads an external script in a closed shadow tree]
|
|
||||||
expected: FAIL
|
|
Loading…
Add table
Add a link
Reference in a new issue