Skip to content

Commit

Permalink
Normative: Coerce evaluate's argument to string
Browse files Browse the repository at this point in the history
Ref #318
  • Loading branch information
leobalter committed Jul 12, 2021
1 parent ebafcea commit a7728d9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,12 +292,15 @@ <h1>Realm.prototype.evaluate ( _sourceText_ )</h1>
<emu-alg>
1. Let _O_ be *this* value.
1. Perform ? ValidateRealmObject(_O_).
1. If Type(_sourceText_) is not String, throw a *TypeError* exception.
1. Let _sourceStr_ be ? ToString(_sourceText_).
1. Let _callerRealm_ be the current Realm Record.
1. Let _evalRealm_ be _O_.[[Realm]].
1. Return ? PerformRealmEval(_sourceText_, _callerRealm_, _evalRealm_).
1. Return ? PerformRealmEval(_sourceStr_, _callerRealm_, _evalRealm_).
</emu-alg>

<emu-note type=editor>
The argument _sourceText_ is coerced to a string value and this behavior differs from <emu-xref href="#sec-eval-x"></emu-xref>, which has a different behavior for non-String arguments. `eval(x)` returns `x` - with no evaluation - if `x` is not a String.
</emu-note>
<emu-note type=editor>
Extensible web: This is the dynamic equivalent of a &lt;script&gt; in HTML.
</emu-note>
Expand Down

0 comments on commit a7728d9

Please sign in to comment.