<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression(r197648): JSObject::setPrototypeWithCycleCheck() allows for cycles but the rest of the code base does not"
   href="https://bugs.webkit.org/show_bug.cgi?id=161534#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression(r197648): JSObject::setPrototypeWithCycleCheck() allows for cycles but the rest of the code base does not"
   href="https://bugs.webkit.org/show_bug.cgi?id=161534">bug 161534</a>
              from <span class="vcard"><a class="email" href="mailto:cdumez&#64;apple.com" title="Chris Dumez &lt;cdumez&#64;apple.com&gt;"> <span class="fn">Chris Dumez</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=161534#c4">comment #4</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=161534#c3">comment #3</a>)
&gt; &gt; (In reply to <a href="show_bug.cgi?id=161534#c2">comment #2</a>)
&gt; &gt; &gt; &gt; Yeah, we should teach the rest of the engine that it's OK to have cycles
&gt; &gt; &gt; &gt; in the &quot;getPrototypeDirect&quot; chain.
&gt; &gt; &gt; &gt; Currently, inside JSC itself, this will never happen. However, I guess we
&gt; &gt; &gt; &gt; need to
&gt; &gt; &gt; &gt; teach it this w.r.t the HTML spec.
&gt; &gt; &gt; 
&gt; &gt; &gt; That's a pretty big change. Are we sure we need to allow cycles? What's the
&gt; &gt; &gt; expected behavior if you find a cycle? Is it specified?
&gt; &gt; 
&gt; &gt; Note that even without my patch, it is fairly trivial to end up with an
&gt; &gt; infinite loop since r197648 allows for cycles:
&gt; &gt; 
&gt; &gt; &lt;script&gt;
&gt; &gt; var target = {
&gt; &gt;   __proto__: null
&gt; &gt; };
&gt; &gt; var proxy = new Proxy(target, {});
&gt; &gt; Object.prototype.__proto__ = {
&gt; &gt;    __proto__: proxy,
&gt; &gt; };
&gt; &gt; 
&gt; &gt; var a = {};
&gt; &gt; a.test;
&gt; &gt; &lt;/script&gt;
&gt; &gt; 
&gt; &gt; This seems to infinite loop for me on ToT, no DOM involved.
&gt; 
&gt; I believe the bug here is having ProxyObject's structure's prototype field
&gt; be Object.prototype. That's wrong.</span >

FYI, I tried fixing proxy.__proto__ to be null like so:
<a href="http://pastebin.com/69HRjvPb">http://pastebin.com/69HRjvPb</a>

But this causes some JSC test failures though:
Tools/Scripts/run-jsc JSTests/stress/proxy-set-prototype-of.js
Running 1 time(s): DYLD_FRAMEWORK_PATH=/Volumes/Data/WebKit/OpenSource/WebKitBuild/Release /Volumes/Data/WebKit/OpenSource/WebKitBuild/Release/jsc JSTests/stress/proxy-set-prototype-of.js
Exception: Error: Bad assertion!
assert&#64;JSTests/stress/proxy-set-prototype-of.js:3:24
global code&#64;JSTests/stress/proxy-set-prototype-of.js:31:19</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>