[Webkit-unassigned] [Bug 258683] New: Function defined within a `with` statement, but called from outside it - cannot access variables exposed by `with`

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Jun 29 10:29:09 PDT 2023


https://bugs.webkit.org/show_bug.cgi?id=258683

            Bug ID: 258683
           Summary: Function defined within a `with` statement, but called
                    from outside it - cannot access variables exposed by
                    `with`
           Product: WebKit
           Version: Safari 17
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: niseg98160 at eimatro.com

`with` is deprecated, but there is still a bunch of legacy code that uses it.

This code works fine in Firefox and Chrome but throws "Can't find variable: foo" in Safari:

```js
let obj = {foo:"bar"};
with(obj) {
  function test() {
    console.log(foo);
  }
}
test();
```

Perchance.org, for example, uses `with` as part of its DSL, and so a subset of 'generators' are broken for Safari users.

Possibly related: https://bugs.webkit.org/show_bug.cgi?id=231166

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20230629/47b8a4ca/attachment.htm>


More information about the webkit-unassigned mailing list