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 1408f7a

Browse filesBrowse files
cjihrigMyles Borins
authored andcommitted
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 8a0cc64 commit 1408f7a
Copy full SHA for 1408f7a

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
@@ -942,7 +942,7 @@
942942
};
943943

944944
NativeModule.wrapper = [
945-
'(function (exports, require, module, __filename, __dirname) {\n',
945+
'(function (exports, require, module, __filename, __dirname) { ',
946946
'\n});'
947947
];
948948

@@ -952,7 +952,7 @@
952952

953953
var fn = runInThisContext(source, {
954954
filename: this.filename,
955-
lineOffset: -1
955+
lineOffset: 0
956956
});
957957
fn(this.exports, NativeModule.require, this, this.filename);
958958

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
@@ -285,9 +285,9 @@ assert.equal(42, require('../fixtures/utf8-bom.js'));
285285
assert.equal(42, require('../fixtures/utf8-bom.json'));
286286

287287
// Error on the first line of a module should
288-
// have the correct line and column number
288+
// have the correct line number
289289
assert.throws(function() {
290290
require('../fixtures/test-error-first-line-offset.js');
291291
}, function(err) {
292-
return /test-error-first-line-offset.js:1:1/.test(err.stack);
292+
return /test-error-first-line-offset.js:1:/.test(err.stack);
293293
}, '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.