Bug 147966

Summary: Web Inspector: A {Map, WeakMap, Set, WeakSet} object contains itself will hang the console
Product: WebKit Reporter: ziyunfei <446240525>
Component: Web InspectorAssignee: Joseph Pecoraro <joepeck>
Status: RESOLVED FIXED    
Severity: Normal CC: bburg, commit-queue, graouts, joepeck, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
[PATCH] Proposed Fix
none
[IMAGE] After - Cyclic Set
none
[IMAGE] After - Cyclic Map none

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>