mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00: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 crate::document_loader::LoadType;
|
||||
use crate::dom::activation::Activatable;
|
||||
use crate::dom::attr::Attr;
|
||||
use crate::dom::bindings::codegen::Bindings::DocumentBinding::DocumentMethods;
|
||||
use crate::dom::bindings::codegen::Bindings::HTMLScriptElementBinding::HTMLScriptElementMethods;
|
||||
|
@ -66,6 +67,7 @@ use crate::script_module::{
|
|||
use crate::script_runtime::CanGc;
|
||||
use crate::task_source::{TaskSource, TaskSourceName};
|
||||
use crate::unminify::{unminify_js, ScriptSource};
|
||||
use crate::HasParent;
|
||||
|
||||
impl ScriptSource for ScriptOrigin {
|
||||
fn unminified_dir(&self) -> Option<String> {
|
||||
|
@ -946,7 +948,13 @@ impl HTMLScriptElement {
|
|||
let old_script = document.GetCurrentScript();
|
||||
|
||||
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),
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue