Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2a60e2a

Browse filesBrowse files
committed
module,src: do not wrap modules with -1 lineOffset
In b799a74 and dfee4e3 the module wrapping mechanism was changed for better error reporting. However, the changes causes issues with debuggers and profilers. This commit reverts the wrapping changes. Fixes: #4297 PR-URL: #4298 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
1 parent 4b267df commit 2a60e2a
Copy full SHA for 2a60e2a

File tree

Expand file treeCollapse file tree

3 files changed

+5
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+5
-5
lines changed
Open diff view settings
Collapse file

‎lib/module.js‎

Copy file name to clipboardExpand all lines: lib/module.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ Module.prototype._compile = function(content, filename) {
372372
var wrapper = Module.wrap(content);
373373

374374
var compiledWrapper = runInThisContext(wrapper,
375-
{ filename: filename, lineOffset: -1 });
375+
{ filename: filename, lineOffset: 0 });
376376
if (global.v8debug) {
377377
if (!resolvedArgv) {
378378
// we enter the repl if we're not given a filename argument.
Collapse file

‎src/node.js‎

Copy file name to clipboardExpand all lines: src/node.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@
958958
};
959959

960960
NativeModule.wrapper = [
961-
'(function (exports, require, module, __filename, __dirname) {\n',
961+
'(function (exports, require, module, __filename, __dirname) { ',
962962
'\n});'
963963
];
964964

@@ -968,7 +968,7 @@
968968

969969
var fn = runInThisContext(source, {
970970
filename: this.filename,
971-
lineOffset: -1
971+
lineOffset: 0
972972
});
973973
fn(this.exports, NativeModule.require, this, this.filename);
974974

Collapse file

‎test/sequential/test-module-loading.js‎

Copy file name to clipboardExpand all lines: test/sequential/test-module-loading.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,9 @@ assert.equal(42, require('../fixtures/utf8-bom.js'));
281281
assert.equal(42, require('../fixtures/utf8-bom.json'));
282282

283283
// Error on the first line of a module should
284-
// have the correct line and column number
284+
// have the correct line number
285285
assert.throws(function() {
286286
require('../fixtures/test-error-first-line-offset.js');
287287
}, function(err) {
288-
return /test-error-first-line-offset.js:1:1/.test(err.stack);
288+
return /test-error-first-line-offset.js:1:/.test(err.stack);
289289
}, 'Expected appearance of proper offset in Error stack');

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.