Hi Ben,
Here's the example I have been using:
I have two mjs files:
sample.mjs:
import {a} from '/testmod.mjs';
let p = 9;
var t1 = 1;
var t2 = 2;
var t3 = 3;
var t4 = 4;
var temp = 1;
temp = 2* temp;
temp = 3* temp;
temp
testmod.mjs:
export var a = 10;
export var b = 20;
export var c = 30;
Once I start debugging sample.mjs, I step over a little and reach line 5 and I get the following notification from inspector:
{
"method": "Debugger.paused",
"params": {
"callFrames": [
{
"callFrameId": "{\"ordinal\":0,\"injectedScriptId\":1}",
"functionName": "",
"functionLocation": {
"scriptId": "11",
"lineNumber": 0,
"columnNumber": 0
},
"location": {
"scriptId": "11",
"lineNumber": 5,
"columnNumber": 9
},
"url": "/sample.mjs",
"scopeChain": [
{
"type": "module",
"object": {
"type": "object",
"className": "Object",
"description": "Object",
"objectId": "{\"injectedScriptId\":1,\"id\":19}"
},
"startLocation": {
"scriptId": "11",
"lineNumber": 0,
"columnNumber": 0
},
"endLocation": {
"scriptId": "11",
"lineNumber": 10,
"columnNumber": 0
}
},
{
"type": "global",
"object": {
"type": "object",
"className": "global",
"description": "global",
"objectId": "{\"injectedScriptId\":1,\"id\":20}"
}
}
],
"this": {
"type": "undefined"
}
}
],
"reason": "other",
"hitBreakpoints": []
}
}
At this point I want to inspect variable "p". A Debugger.evaluateOnCallFrame request to inspector with the parameter "p" returns:
{"id": 12,
"result": {"result": {"type": "object",
"subtype": "error",
"className": "ReferenceError",
"description": "ReferenceError: p is not defined\n at eval (eval at <anonymous> (/sample.mjs:6:10), <anonymous>:1:1)\n at /sample.mjs:6:10",
"objectId": "{\"injectedScriptId\":1,\"id\":21}"
} , "exceptionDetails": {"exceptionId": 1,
"text": "Uncaught",
"lineNumber": 0,
"columnNumber": 0,
"scriptId": "14",
"stackTrace": {"callFrames": [{"functionName": "",
"scriptId": "14",
"url": "",
"lineNumber": 0,
"columnNumber": 0
} , {"functionName": "",
"scriptId": "11",
"url": "/sample.mjs",
"lineNumber": 5,
"columnNumber": 9
} ] } , "exception": {"type": "object",
"subtype": "error",
"className": "ReferenceError",
"description": "ReferenceError: p is not defined\n at eval (eval at <anonymous> (/sample.mjs:6:10), <anonymous>:1:1)\n at /sample.mjs:6:10",
"objectId": "{\"injectedScriptId\":1,\"id\":22}"
} } } }
The expected outcome here would have been to see the actual value of variable "p". I am seeing similar response for all variables declared in sample.mjs and that is unexpected. However, the imported object "a" can does not yield the same response. Inspector returns the right value for "a".
At the same point if I send Runtime.getProperties request to V8 with the current module scope's object id: '{\"injectedScriptId\":1,\"id\":19}' as parameter, I only see the following:
{"id": 15,
"result": {"result": [{"name": "a",
"value": {"type": "number",
"value": 10,
"description": "10"
} , "writable": true,
"configurable": true,
"enumerable": true,
"isOwn": true
} ] } }
I do not see the other variables in sample.mjs in the above response.
Do you still think this is expected behavior or do you suspect there is another issue here?
Please let me know. Any help will be great!
Thanks,
Nupoor