[Webkit-unassigned] [Bug 265526] New: Incorrect `with` statement behavior - function call breaks out of `with` 'scope'

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 29 08:45:49 PST 2023


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

            Bug ID: 265526
           Summary: Incorrect `with` statement behavior - function call
                    breaks out of `with` 'scope'
           Product: WebKit
           Version: Safari 17
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: niseg98160 at eimatro.com

(Obligatory: The `with` statement has long been deprecated, but unfortunately since there is a lot of legacy code which relies on it, one cannot always avoid interacting with code that relies on `with`.)

The following code works fine on all other browsers. Safari throws "ReferenceError: Can't find variable: abc".

```
with({abc:3}) {
  function foo() {
    console.log(abc);
  }
  foo();
}
```

I am managing a large-ish (~4M MAU) platform for which this has become an issue in certain situations, and currently I just have to tell users "Please use Firefox or Chrome". I'd like to eventually get my hands dirty and try to implement a hacky fix here (it involves interaction with user-land code, so it's not easy), but if the `with` behavior could be brought into line with other engines that would be excellent.

-- 
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/20231129/c84f46f4/attachment.htm>


More information about the webkit-unassigned mailing list