tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

createdynfn-no-line-terminator-html-close-comment-params.js (1140B)


      1 // Copyright (C) 2019 Leo Balter. All rights reserved.
      2 // This code is governed by the BSD license found in the LICENSE file.
      3 
      4 /*---
      5 esid: sec-createdynamicfunction
      6 description: >
      7  Function parses the parameters text before forming the sourceText with the proper line feed.
      8 info: |
      9  The HTMLCloseComment requires a preceding line terminator.
     10 
     11  Runtime Semantics: CreateDynamicFunction(constructor, newTarget, kind, args)
     12  ...
     13  16. Set bodyText to ? ToString(bodyText).
     14  17. Let parameters be the result of parsing P, interpreted as UTF-16 encoded Unicode text as
     15  described in 6.1.4, using parameterGoal as the goal symbol. Throw a SyntaxError exception if the
     16  parse fails.
     17  18. Let body be the result of parsing bodyText, interpreted as UTF-16 encoded Unicode text as
     18  described in 6.1.4, using goal as the goal symbol. Throw a SyntaxError exception if the parse
     19  fails.
     20  ...
     21  41. Let sourceText be the string-concatenation of prefix, " anonymous(", P, 0x000A (LINE FEED),
     22  ") {", 0x000A (LINE FEED), bodyText, 0x000A (LINE FEED), and "}".
     23 ---*/
     24 
     25 assert.throws(SyntaxError, () => Function("-->", ""));
     26 
     27 reportCompare(0, 0);