[Webkit-unassigned] [Bug 187724] New: JSON.stringify on a DOM Exception behaves different to other browsers

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Jul 16 19:43:52 PDT 2018


https://bugs.webkit.org/show_bug.cgi?id=187724

            Bug ID: 187724
           Summary: JSON.stringify on a DOM Exception behaves different to
                    other browsers
           Product: WebKit
           Version: Safari 11
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: JavaScriptCore
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: zac.spitzer at gmail.com

The following test case produces an empty object in Webkit

https://jsbin.com/qiluqen/edit?js,console

Firefox, Edge and Chrome all output an object with three properties

function createSyntaxException() {
    try {
        // trigger a DOMException
        document.querySelectorAll("div:foo");
    } catch(e) {
        // this produces an empty object in webkit
        var err = JSON.parse(
          JSON.stringify(e, ['code','name','message'] )
        );      
        console.log(err);
        console.log(JSON.stringify(err));        
        var err2 = {
          code: e.code,
          name: e.name,
          message: e.message
        };
        console.log(err2);
    }
}
throw createSyntaxException();

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20180717/dcad788e/attachment.html>


More information about the webkit-unassigned mailing list