Open Bug 1142832 Opened 9 years ago Updated 2 years ago

Fix ExecuteInGlobalAndReturnScope to not put random objects on a scope chain

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: bzbarsky, Unassigned)

References

Details

Attachments

(1 file)

Kinda spun off from bug 1097987.  

ExecuteInGlobalAndReturnScope sets up a random object on the scope chain right now.  When I try to wrap it in With, I hit an assert in this code in SetNameOperation:

319     if (scope->isUnqualifiedVarObj()) {
320         MOZ_ASSERT(!scope->getOps()->setProperty);
321         ok = NativeSetProperty(cx, scope.as<NativeObject>(), scope.as<NativeObject>(), id,
322                                Unqualified, &valCopy, result);
323     } else {
324         ok = SetProperty(cx, scope, scope, id, &valCopy, result);
325     }

because ExecuteInGlobalAndReturnScope does in fact want the scope to be an unqualified var obj, but a With object has a setProperty op.

I guess the best option we have here is to add a special case for non-syntactic With to SetNameOperation or something?
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
OK, I think I'm just going to work around this for parent removal (see the modified assert in js::CloneFunctionObject that should be fixed up when this code is fixed), but this is still blocking bug 679939 comment 29 step 1 as far as I can tell.

Oh, and this is violating the invariants we want to assert in step 2 there.  :(
Assignee: bzbarsky → nobody
Blocks: 679939
No longer blocks: 805052, 1142310
No longer blocks: 679939
No assignee, updating the status.
Status: ASSIGNED → NEW
No assignee, updating the status.

ExecuteInGlobalAndReturnScope is gone, but its replacement is ExecuteInFrameScriptEnvironment and it seems to be doing similar things....

That said, we clearly fixed bug 679939 without fixing this, so maybe this is not an issue.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: