mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Store parser's current line when script elements are created.
Use the newly stored line as the starting line number when evaluating JS. This ensures that inline scripts will report errors with meaningful line numbers.
This commit is contained in:
parent
d1bc1a4f1b
commit
db2082bc6e
11 changed files with 61 additions and 22 deletions
|
@ -145,10 +145,25 @@ impl fmt::Debug for Element {
|
|||
|
||||
#[derive(PartialEq, HeapSizeOf)]
|
||||
pub enum ElementCreator {
|
||||
ParserCreated,
|
||||
ParserCreated(u64),
|
||||
ScriptCreated,
|
||||
}
|
||||
|
||||
impl ElementCreator {
|
||||
pub fn is_parser_created(&self) -> bool {
|
||||
match *self {
|
||||
ElementCreator::ParserCreated(_) => true,
|
||||
ElementCreator::ScriptCreated => false,
|
||||
}
|
||||
}
|
||||
pub fn return_line_number(&self) -> u64 {
|
||||
match *self {
|
||||
ElementCreator::ParserCreated(l) => l,
|
||||
ElementCreator::ScriptCreated => 1,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub enum AdjacentPosition {
|
||||
BeforeBegin,
|
||||
AfterEnd,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue