Skip to content

Commit

Permalink
Re-add |source|
Browse files Browse the repository at this point in the history
  • Loading branch information
lukewarlow committed Apr 23, 2024
1 parent 961e959 commit e0e7778
Showing 1 changed file with 3 additions and 21 deletions.
24 changes: 3 additions & 21 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1442,32 +1442,14 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/
to determine whether such compilation ought to be blocked.

<h4 id="can-compile-strings" algorithm dfn export>
EnsureCSPDoesNotBlockStringCompilation(|realm|, |parameterStrings|, |bodyString|, |compilationType|, |parameterArgs|, |bodyArg|)
EnsureCSPDoesNotBlockStringCompilation(|realm|, |parameterStrings|, |bodyString|, |source|, |compilationType|, |parameterArgs|, |bodyArg|)
</h4>

Given a <a>realm</a> |realm|, a list of strings |parameterStrings|, a string |bodyString|, an enum (|compilationType|),
Given a <a>realm</a> |realm|, a list of strings |parameterStrings|, a string |bodyString|, a string |source|, an enum (|compilationType|),
a list of ECMAScript language values (|parameterArgs|), and an ECMAScript language value (|bodyArg|), this algorithm
returns normally if string compilation is allowed, and throws an "`EvalError`"
if not:

1. Let |source| be |bodyString|.

1. If |compilationType| is `*FUNCTION*`:

1. Set |source| to `"function anonymous("`

1. For each |arg| in |parameterStrings|:

1. Append |arg| to |source|.

1. If |arg| is not the last item of |parameterStrings|, append `","` to |source|.

1. Append `"\n) {\n"` to |source|.

1. Append |bodyString| to |source|.

1. Append `"\n}"` to |source|.

1. Let |result| be "`Allowed`".

2. Let |global| be |realm|'s [=realm/global object=].
Expand Down Expand Up @@ -1502,7 +1484,7 @@ spec: WebRTC; urlPrefix: https://www.w3.org/TR/webrtc/

4. If |result| is "`Blocked`", throw an `EvalError` exception.

Note: |parameterArgs| and |bodyArg| are currently unused. They are included for future use.
Note: |parameterStrings|, |parameterArgs|, |bodyArg| and |bodyString| are currently unused. They are included for future use.

<h3 id="wasm-integration">Integration with WebAssembly</h3>

Expand Down

0 comments on commit e0e7778

Please sign in to comment.