Fix line numbers in JavaScript stack traces

Instead of calling the function constructor to compile script in Sky, we now
concatenate strings. This has the advantage of making the line numbers
generated in error messages correct but the disadvantage of being a hack. I've
filed https://code.google.com/p/v8/issues/detail?id=3624 to request a proper
API for this purpose.

R=esprehn@chromium.org

Review URL: https://codereview.chromium.org/688033003
This commit is contained in:
Adam Barth 2014-10-29 14:00:57 -07:00
parent 676f8185ad
commit a93fd66157
3 changed files with 12 additions and 9 deletions

View File

@ -22,7 +22,7 @@ describe('Non-relevant properties on mutation records should be null, except for
var div = document.createElement('div');
observer.observe(div, {childList: true});
div.appendChild(document.createElement('span'));
record = observer.takeRecords()[0];
var record = observer.takeRecords()[0];
assert.isNull(record.attributeName);
assert.isNull(record.oldValue);
});
@ -30,7 +30,7 @@ describe('Non-relevant properties on mutation records should be null, except for
var div = document.createElement('div');
observer.observe(div, {attributes: true});
div.setAttribute('data-foo', 'bar');
record = observer.takeRecords()[0];
var record = observer.takeRecords()[0];
assert.isNull(record.oldValue);
assert.isNull(record.previousSibling);
assert.isNull(record.nextSibling);

View File

@ -195,8 +195,11 @@ describe('MutationObserver.observe on a subtree', function() {
it('should have correct behavior of transient observation with complex movement', function(done) {
var observer;
var text;
var subDiv;
var mutations;
var subDiv2;
var subDiv3;
function start() {
var div = document.createElement('div');

View File

@ -1,17 +1,17 @@
ERROR: Uncaught SyntaxError: Unexpected token <
SOURCE: http://127.0.0.1:8000/parser/script.sky:3
SOURCE: http://127.0.0.1:8000/parser/script.sky:6
ERROR: Uncaught SyntaxError: Unexpected token <
SOURCE: http://127.0.0.1:8000/parser/script.sky:3
SOURCE: http://127.0.0.1:8000/parser/script.sky:14
ERROR: Uncaught SyntaxError: Unexpected token <
SOURCE: http://127.0.0.1:8000/parser/script.sky:3
SOURCE: http://127.0.0.1:8000/parser/script.sky:21
ERROR: Uncaught ReferenceError: TEST is not defined
SOURCE: http://127.0.0.1:8000/parser/script.sky:2
SOURCE: http://127.0.0.1:8000/parser/script.sky:27
ERROR: Uncaught SyntaxError: Invalid regular expression: missing /
SOURCE: http://127.0.0.1:8000/parser/script.sky:2
SOURCE: http://127.0.0.1:8000/parser/script.sky:34
ERROR: Uncaught SyntaxError: Invalid regular expression: missing /
SOURCE: http://127.0.0.1:8000/parser/script.sky:2
SOURCE: http://127.0.0.1:8000/parser/script.sky:38
ERROR: Uncaught SyntaxError: Unexpected token }
SOURCE: http://127.0.0.1:8000/parser/script.sky:4
SOURCE: http://127.0.0.1:8000/parser/script.sky:43
<html>
<link rel="import" href="../resources/dump-as-markup.sky"></link>
<body>