JSON.stringify(window.navigator) doesn't follow the spec

RESOLVED INVALID

Status

()

Core
DOM
RESOLVED INVALID
9 years ago
6 years ago

People

(Reporter: Oliver Hunt, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

9 years ago
I noticed a bug in mozilla while working on a webkit bug, JSON stringification of the navigator object doesn't match the spec.

JSON.stringify(window.navigator) produces '{}'

Technically it should throw an exception due to the Plugin->MimeType->Plugin cycle, but even if that was prevented the navigator object has string properties, etc which should appear in the output.

Honestly I have no idea what's actually being done here -- is navigator being special cased? or is their a general idiom mozilla applies to serialising dom objects?

Comment 1

9 years ago
Created attachment 420669 [details]
Testcase

What's happening here is that the properties of Mozilla's window.navigator are from the prototype and so they are excluded. It's basically what's happening in the attached test case. I'm not sure if any spec defines from whence navigator's properties should come.

Comment 2

9 years ago
I guess the attachment title "Testcase" is a bit deceiving in this case...
This is a WebKit bug.
Assignee: general → nobody
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Component: JavaScript Engine → DOM
QA Contact: general → general
Resolution: --- → INVALID
> I'm not sure if any spec defines from whence navigator's properties should come.

At this point, WebIDL does, and they come from the prototype.
You need to log in before you can comment on or make changes to this bug.