<html>
    <head>
      <base href="https://bugs.webkit.org/">
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - beforeunload interoperability issues with a throwing return"
   href="https://bugs.webkit.org/show_bug.cgi?id=188696#c1">Comment # 1</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - beforeunload interoperability issues with a throwing return"
   href="https://bugs.webkit.org/show_bug.cgi?id=188696">bug 188696</a>
              from <span class="vcard"><a class="email" href="mailto:phistuck@chromium.org" title="PhistucK <phistuck@chromium.org>"> <span class="fn">PhistucK</span></a>
</span></b>
        <pre>I think the problem is either that convert<IDLNullable<IDLDOMString>>(*exec, retval)) is called but nothing checks whether it threw an exception in order to stop the execution, or that the conversion that convert<...> employs does not use toStringOrNull and so it gets the empty string instead of null when it fails.
handleBeforeUnloadEventReturnValue only checks -
if (returnValue.isNull())
<a href="https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/bindings/js/JSEventListener.cpp#L91">https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/bindings/js/JSEventListener.cpp#L91</a>
And preventDefault() otherwise.

Or maybe both.

Maybe the fix is a simple -
if (returnValue.isNull() || returnValue.isEmpty())</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>