<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><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">161534</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression(r197648): JSObject::setPrototypeWithCycleCheck() allows for cycles but the rest of the code base does not
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cdumez&#64;apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>ggaren&#64;apple.com, mark.lam&#64;apple.com, sbarati&#64;apple.com
          </td>
        </tr>

        <tr>
          <th>Blocks</th>
          <td>155002
          </td>
        </tr></table>
      <p>
        <div>
        <pre>JSObject::setPrototypeWithCycleCheck() allows for cycles but the rest of the code base does not deal properly with cycles.

This is because of the following check that was added:
if (UNLIKELY(asObject(nextPrototype)-&gt;methodTable(vm)-&gt;getPrototype != defaultGetPrototype)) 
  break;

This was added to match the EcmaScript spec:
- <a href="https://tc39.github.io/ecma262/#sec-ordinarysetprototypeof">https://tc39.github.io/ecma262/#sec-ordinarysetprototypeof</a> (step 8)

However, if you create a cycles, we end up with an infinite loop later on under:
Structure::anyObjectInChainMayInterceptIndexedAccesses()

This is likely not the only place we traverse the prototype chain and except there is no cycle.

I noticed this when running html/browsers/history/the-location-interface/allow_prototype_cycle_through_location.sub.html with the patch for <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED - Align proto getter / setter behavior with other browsers"
   href="show_bug.cgi?id=161455">Bug 161455</a> applied.</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>