Add CallArgs::hasDefined convenience method

RESOLVED FIXED in mozilla13

Status

()

Core
JavaScript Engine
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: jorendorff, Assigned: jorendorff)

Tracking

Other Branch
mozilla13
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Comment 1

6 years ago
Created attachment 600771 [details] [diff] [review]
v1
Assignee: general → jorendorff
Attachment #600771 - Flags: review?(luke)

Comment 2

6 years ago
Comment on attachment 600771 [details] [diff] [review]
v1

Review of attachment 600771 [details] [diff] [review]:
-----------------------------------------------------------------

Great

::: js/src/builtin/RegExp.cpp
@@ +344,5 @@
>           * See ECMAv5 15.10.3.1.
>           */
> +        if (args.length() >= 1 &&
> +            IsObjectWithClass(args[0], ESClass_RegExp, cx) &&
> +            !args.hasDefined(1))

How about
  args.hasDefined(0) &&
  IsObjectWithClass(args[0], ESClass_RegExp, cx) &&
  !args.hasDefined(1)
?  (Unnecessary 'undefined' test, but I think this shouldn't be significant here.)

::: js/src/jsobj.cpp
@@ +2400,3 @@
>      if (!obj)
> +        return false;
> +    args.rval().setObject(*obj); /* Root and prepare for eventual return. */

Pre-existing, but args.rval() should only be assigned to after the last observable operation.
Attachment #600771 - Flags: review?(luke) → review+
https://hg.mozilla.org/mozilla-central/rev/3b6ef7305164
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla13
You need to log in before you can comment on or make changes to this bug.