mozilla/source-map — Issue #6: Null check should be undefined check?
Author: johnjbarton
Created: 2012-02-24 00:58:08+00:00
State: open

In source-node.js:

if (aChunks !== null) this.add(aChunks);

from

function SourceNode(aLine, aColumn, aSource, aChunks) {
this.children = [];
this.line = aLine;
this.column = aColumn;
this.source = aSource;
if (aChunks !== null) this.add(aChunks);
}

If we call this function thus:
var n = new SourceNode(l, c, s);
the code calls add with 'undefined'.

This causes test-source-node.js to fail.

================================================================================
run-tests-in-browser.html:86test-source-node.js: test .add()
run-tests-in-browser.html:87--------------------------------------------------------------------------------
run-tests-in-browser.html:88TypeError: Expected a SourceNode, string, or an array of SourceNodes and strings. Got undefined
at SourceNode.SourceNode_add [as add] (http://localhost:8080/file/c/lib/source-map/source-node.js:57:13)
at new SourceNode (http://localhost:8080/file/c/lib/source-map/source-node.js:38:32)
at Object.test .add() (http://localhost:8080/file/c/test/test-source-node.js:61:16)
at run (http://localhost:8080/file/c/test/run-tests-in-browser.html:66:31)
at http://localhost:8080/file/c/test/run-tests-in-browser.html:123:10
at Function.execCb (http://requirejs.org/docs/release/1.0.6/minified/require.js:28:478)
at p (http://requirejs.org/docs/release/1.0.6/minified/require.js:11:3)
at http://requirejs.org/docs/release/1.0.6/minified/require.js:12:242
at p (http://requirejs.org/docs/release/1.0.6/minified/require.js:12:133)
at http://requirejs.org/docs/release/1.0.6/minified/require.js:12:242