aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/globalscope.rs
diff options
context:
space:
mode:
authorkarenher <karenher@seas.upenn.edu>2016-12-21 10:40:13 -0500
committerJosh Matthews <josh@joshmatthews.net>2017-01-11 21:11:00 -0500
commitdb2082bc6e0edc0028f287d4acc203e7c3bc829f (patch)
treee9f737449599ef928321d8f338e955680ebde851 /components/script/dom/globalscope.rs
parentd1bc1a4f1b66ab9f63fa37f649eaf79035e12f8e (diff)
downloadservo-db2082bc6e0edc0028f287d4acc203e7c3bc829f.tar.gz
servo-db2082bc6e0edc0028f287d4acc203e7c3bc829f.zip
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.
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r--components/script/dom/globalscope.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs
index fca829c9904..4203d0e724c 100644
--- a/components/script/dom/globalscope.rs
+++ b/components/script/dom/globalscope.rs
@@ -339,13 +339,13 @@ impl GlobalScope {
/// Evaluate JS code on this global scope.
pub fn evaluate_js_on_global_with_result(
&self, code: &str, rval: MutableHandleValue) {
- self.evaluate_script_on_global_with_result(code, "", rval)
+ self.evaluate_script_on_global_with_result(code, "", rval, 1)
}
/// Evaluate a JS script on this global scope.
#[allow(unsafe_code)]
pub fn evaluate_script_on_global_with_result(
- &self, code: &str, filename: &str, rval: MutableHandleValue) {
+ &self, code: &str, filename: &str, rval: MutableHandleValue, line_number: u32) {
let metadata = time::TimerMetadata {
url: if filename.is_empty() {
self.get_url().as_str().into()
@@ -367,7 +367,7 @@ impl GlobalScope {
let _ac = JSAutoCompartment::new(cx, globalhandle.get());
let _aes = AutoEntryScript::new(self);
- let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), 1);
+ let options = CompileOptionsWrapper::new(cx, filename.as_ptr(), line_number);
unsafe {
if !Evaluate2(cx, options.ptr, code.as_ptr(),
code.len() as libc::size_t,