From 06ea8e899e48f1f2f396b70e63fae369f2f23232 Mon Sep 17 00:00:00 2001 From: Kristian Monsen Date: Mon, 28 Jun 2010 16:42:48 +0100 Subject: Merge WebKit at r61871: Initial merge by git. Change-Id: I6cff43abca9cc4782e088a469ad4f03f166a65d5 --- .../bom-in-file-retains-correct-offset.js | 2 +- .../fast/js/resources/script-line-number.js | 26 ++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 LayoutTests/fast/js/resources/script-line-number.js (limited to 'LayoutTests/fast') diff --git a/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js b/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js index b62a250..c4870d2 100644 --- a/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js +++ b/LayoutTests/fast/js/resources/bom-in-file-retains-correct-offset.js @@ -1,2 +1,2 @@ description("This ensures that BOM's scattered through a source file do not break parsing"); -function f(){successfullyReparsed=true;shouldBeTrue('successfullyReparsed');successfullyParsed=true}f(); +function g(){function f(){successfullyReparsed=true;shouldBeTrue('successfullyReparsed');successfullyParsed=true}f();} g() diff --git a/LayoutTests/fast/js/resources/script-line-number.js b/LayoutTests/fast/js/resources/script-line-number.js new file mode 100644 index 0000000..09d9b1a --- /dev/null +++ b/LayoutTests/fast/js/resources/script-line-number.js @@ -0,0 +1,26 @@ +description( +"This test checks that line numbers are correctly reported for both inline scripts and inline event handlers." +); + +function getLineFromError(e) +{ + // JSC + if (e.line) + return e.line; + + // V8 + if (e.stack) { + // ErrorName: ErrorDescription at FileName:LineNumber:ColumnNumber + parts = e.stack.split(":"); + return parts[parts.length - 2]; + } + + return -1; +} + +function assertErrorOnLine(error, expectedLine) +{ + shouldBe(stringify(getLineFromError(error)), stringify(expectedLine)); +} + +var successfullyParsed = true; -- cgit v1.1