Closed Bug 1283534 Opened 4 years ago Closed 1 year ago

Debugger.Environment expects all bindings to be aliased on ModuleEnvObject

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED DUPLICATE of bug 1518308

People

(Reporter: jonco, Unassigned)

References

(Blocks 1 open bug)

Details

As reported by shu on IRC.

From DebugScope::handleUnaliasedAccess:

        if (scope->is<ModuleEnvironmentObject>()) {
            /* Everything is aliased and stored in the environment object. */
            return true;
        }

This has not been true since bug 1233109.
I'm trying to write a test to exercise this but I'm having trouble working out how to do it.

From the comments in ScopeObject.cpp it seems like I need to have a DebugScopeObject for a module that is no longer executing.  Is that right?  

I tried this:

    var g = newGlobal();
    var dbg = Debugger(g);
    var env;

    dbg.onDebuggerStatement = function (frame) {
        env = frame.environment;
    };

    g.eval(
    `
        let m = parseModule(
        \`
            var a = 1;
            debugger;
        \`);
        m.declarationInstantiation();
        m.evaluation();
    `);

     assertEq(env.getVariable('a'), 1);

I saw a DebugScopeObject being created, but none of the proxy handler methods for it got called and the test passes.  Any ideas how to do this?
Flags: needinfo?(shu)
Blocks: modules-0
Flags: needinfo?(shu)
The method in the description is called DebugEnvironmentProxyHandler::handleUnaliasedAccess now.
Jim, do you know how to proceed here?  I don't understand how debug scopes work enough to work out how to trigger this.
Flags: needinfo?(jimb)
Blocks: harmony:modules
No longer blocks: modules-0
See Also: → 1518308

bhackett pointed out that the debugger statement marks all variables in scope as aliased which explains why the test didn't work. The bug itself will be fixed by bug 1518308.

Status: NEW → RESOLVED
Closed: 1 year ago
Flags: needinfo?(jimb)
Resolution: --- → DUPLICATE
Duplicate of bug: 1518308
You need to log in before you can comment on or make changes to this bug.