<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ASSERT on SES selftest page when loading the page while WebInspector is open in debug builds"
   href="https://bugs.webkit.org/show_bug.cgi?id=154403#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - ASSERT on SES selftest page when loading the page while WebInspector is open in debug builds"
   href="https://bugs.webkit.org/show_bug.cgi?id=154403">bug 154403</a>
              from <span class="vcard"><a class="email" href="mailto:joepeck&#64;webkit.org" title="Joseph Pecoraro &lt;joepeck&#64;webkit.org&gt;"> <span class="fn">Joseph Pecoraro</span></a>
</span></b>
        <pre>This exception is thrown by user code.

It seems like the page's code overrides `Object.prototype.__proto__`. InjectedScript, traversing the prototype chain using __proto__, encounters an error it doesn't expect caused by this code throwing.

Here is where the TypeError is defined:

<span class="quote">&gt;  /**
&gt;   * Repairs both getter and setter. If either are vulnerable, I don't
&gt;   * care if the other seemed to pass the test. Better to make them
&gt;   * both safe.
&gt;   */
&gt;  function repair_UNDERBAR_PROTO_accessors_USE_GLOBAL() {
&gt;    var gopd = Object.getOwnPropertyDescriptor;</span >
&gt;
<span class="quote">&gt;    var oldDesc = gopd(Object.prototype, '__proto__');
&gt;    var oldGetter = oldDesc.get;
&gt;    var oldSetter = oldDesc.set;
&gt;    function newGetter() {
&gt;      if (this === null || this === void 0) {
&gt;        throw new TypeError('Cannot convert null or undefined to object');
&gt;      } else {
&gt;        return oldGetter.call(this);
&gt;      }
&gt;    }
&gt;    function newSetter(newProto) {
&gt;      if (this === null || this === void 0) {
&gt;        throw new TypeError('Cannot convert null or undefined to object');
&gt;      } else {
&gt;        oldSetter.call(this, newProto);
&gt;      }
&gt;    }
&gt;    Object.defineProperty(Object.prototype, '__proto__', {
&gt;      get: oldGetter ? newGetter : void 0,
&gt;      set: oldSetter ? newSetter : void 0
&gt;    });
&gt;  }</span >

And here is code that exercises it with a description (there is code exercising the getter and setter)

<span class="quote">&gt;  /**
&gt;   * Detects <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED"
   href="show_bug.cgi?id=141865">https://bugs.webkit.org/show_bug.cgi?id=141865</a>
&gt;   *
&gt;   * &lt;p&gt;On Safari 7.0.5 (9537.77.4), the getter of the
&gt;   * Object.prototype.__proto__ property, if applied to undefined,
&gt;   * acts like a sloppy function would, coercing the undefined to the
&gt;   * global object and returning the global object's [[Prototype]].
&gt;   */
&gt;  function test_UNDERBAR_PROTO_GETTER_USES_GLOBAL() {
&gt;    var gopd = Object.getOwnPropertyDescriptor;
&gt;    var getProto = Object.getPrototypeOf;</span >
&gt;
<span class="quote">&gt;    var desc = gopd(Object.prototype, '__proto__');
&gt;    if (!desc) { return false; }
&gt;    var getter = desc.get;
&gt;    if (!getter) { return false; }
&gt;    var globalProto = void 0;
&gt;    try {
&gt;      globalProto = getter();
&gt;    } catch (ex) {
&gt;      if (ex instanceof TypeError &amp;&amp; globalProto === void 0) {
&gt;          return false;
&gt;      }
&gt;      return 'unexpected error: ' + ex;
&gt;    }
&gt;    if (getProto(global) === globalProto) { return true; }
&gt;    return 'unexpected global.__proto__: ' + globalProto;
&gt;  }</span >

That said, I did not investigate what code in InjectedScriptSource encounters this.

I do think moving InjectedScriptSource to a builtin, and using &#64;Object.&#64;getPrototypeOf() instead of __proto__ would probably solve this.</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>