[Webkit-unassigned] [Bug 235880] New: WeakRef deref can return null instead of undefined

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jan 31 01:51:25 PST 2022


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

            Bug ID: 235880
           Summary: WeakRef deref can return null instead of undefined
           Product: WebKit
           Version: Safari 15
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: stef.busking at gmail.com

Seen in Safari 15.1, 15.2 (macOS) and Epiphany 41.3 (Linux)

According to the ECMAScript specification (https://tc39.es/ecma262/multipage/managing-memory.html#sec-weakrefderef), a WeakRef's deref method should either return the referenced object or `undefined`. This behaves as expected in Chrome, Firefox and Edge, but it seems that in WebKit browsers this method may return `null` instead.

I've confirmed this behavior using the following in the dev tools console:

```
a = new WeakRef(new ArrayBuffer(10000000))
// wait a while to allow GC to clean up the ArrayBuffer
a.deref()
```

I'm not sure if Webkit browsers have a way to force garbage collection, but waiting a while or using other tabs seems to work for triggering this issue most of the time. Firefox allows forcing GC on about:memory, Chrome and Edge provide a button for this on the Memory tab of their dev tools. 

Expected behavior: a.deref() returns undefined (happens in Chrome, Firefox and Edge)
Actual behavior: a.deref() returns null in Safari and Epiphany

-- 
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/20220131/6dcf115b/attachment.htm>


More information about the webkit-unassigned mailing list