Bug 147966 - Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will hang the console
Summary: Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will han...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-08-12 20:29 PDT by ziyunfei
Modified: 2015-08-13 14:31 PDT (History)
8 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (15.76 KB, patch)
2015-08-13 13:22 PDT, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[IMAGE] After - Cyclic Set (23.49 KB, image/png)
2015-08-13 13:22 PDT, Joseph Pecoraro
no flags Details
[IMAGE] After - Cyclic Map (18.75 KB, image/png)
2015-08-13 13:23 PDT, Joseph Pecoraro
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description ziyunfei 2015-08-12 20:29:53 PDT
Run this code in the console:

wm = new WeakMap
wm.set(wm, wm)
Comment 1 Joseph Pecoraro 2015-08-13 11:51:47 PDT
Good find!
Comment 2 Joseph Pecoraro 2015-08-13 13:21:55 PDT
In may case, the console is not hanging. It just didn't output anything for the object. You can continue to use the console. What actually happened is the backend generated an "error" trying to generate the RemoteObject for the object (specifically the preview).

That said, this still stinks. I have a fix, that gets this working, and fixes a few other possible subtle issues (propagating lossless to the top).
Comment 3 Joseph Pecoraro 2015-08-13 13:22:20 PDT
Created attachment 258923 [details]
[PATCH] Proposed Fix
Comment 4 Joseph Pecoraro 2015-08-13 13:22:49 PDT
Created attachment 258924 [details]
[IMAGE] After - Cyclic Set
Comment 5 Joseph Pecoraro 2015-08-13 13:23:07 PDT
Created attachment 258925 [details]
[IMAGE] After - Cyclic Map
Comment 6 WebKit Commit Bot 2015-08-13 14:30:37 PDT
Comment on attachment 258923 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 258923

Committed r188403: <http://trac.webkit.org/changeset/188403>
Comment 7 WebKit Commit Bot 2015-08-13 14:30:41 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2015-08-13 14:31:05 PDT
<rdar://problem/22276141>