Closed Bug 697322 Opened 8 years ago Closed 8 years ago

Add easier to use reset method to CallReceiver

Categories

(Core :: JavaScript Engine, defect, trivial)

defect
Not set
trivial

Tracking

()

RESOLVED FIXED
mozilla11

People

(Reporter: terrence, Assigned: terrence)

Details

Attachments

(1 file, 1 obsolete file)

All users of InvokeArgsGuard that use calleeHasBeenReset use it before setting a new callee/this, frequently in a loop.  We should make it easier to use by combining the reset with the setup of the required parameters for the new call.
Attachment #569562 - Flags: review?(luke)
Comment on attachment 569562 [details] [diff] [review]
v1: Implements setupNewCall and removes calleeHasBeenReset

>-    ag.calleeHasBeenReset();
>-    ag.calleev() = ca->fval;
>-    ag.thisv() = UndefinedValue();
>+    ag.setupNewCall(ca->fval, UndefinedValue());

It makes sense to merge setting callee and clearing the debug flag, but I'd rather not set both this and callee since you now need to know the order of callee/this to read the call.  How about:

>-    ag.calleeHasBeenReset();
>-    ag.calleev() = ca->fval;
>+    ag.setCallee(ca->fval)
>     ag.thisv() = UndefinedValue();

?
You are right.  I got a bit over zealous in merging both of those.
Attachment #569562 - Attachment is obsolete: true
Attachment #569562 - Flags: review?(luke)
Attachment #569814 - Flags: review?(luke)
Comment on attachment 569814 [details] [diff] [review]
v2: With review feedback.

Great
Attachment #569814 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/131f751eedb1
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla11
You need to log in before you can comment on or make changes to this bug.