This method of user agent detection was requested multiple times, and draft spec has it: <http://www.whatwg.org/specs/web-workers/current-work/#navigator0>.
<rdar://problem/6425805>
Created attachment 25888 [details] proposed patch
Comment on attachment 25888 [details] proposed patch > +JSValue* jsWorkerContextNavigator(JSC::ExecState* exec, const Identifier&, const PropertySlot& slot) > +{ > + WorkerContext* imp = static_cast<WorkerContext*>(static_cast<JSWorkerContext*>(asObject(slot.slotBase()))->impl()); > + return toJS(exec, imp->navigator()); > +} It's always irritating when we have to add a new DOM binding written by hand. I trust there's a good reason, and I will settle for just complaining about it rather than asking you to do something. > +2008-12-09 Alexey Proskuryakov <ap@webkit.org> > + > + Reviewed by NOBODY (OOPS!). > + > + https://bugs.webkit.org/show_bug.cgi?id=22719 > + Implement Navigator object in Workers > + > + * fast/workers/worker-navigator-expected.txt: Added. > + * fast/workers/worker-navigator.html: Added. > + > +2008-12-09 Alexey Proskuryakov <ap@webkit.org> > + > + Reviewed by NOBODY (OOPS!). > + > + <rdar://problem/5959165> Crash in a number of iExploder tests in WebCore::CachedImage::notifyObservers > + > + Add a test for a crash that is no longer reproducible. > + > + * fast/css/mask-missing-image-crash-expected.txt: Added. > + * fast/css/mask-missing-image-crash.html: Added. > + Change log entry here from the other bug fix. r=me
Committed revision 39138. I will look into auto-generating JSWorkerContext in the future - I couldn't find any way to do it before.
> +worker.postMessage("eval navigator.platform.length > 0"); This is failing on the Gtk+ buildbot and according to my version of the HTML5 draft platform may be the zero length. Maybe you should check the type to be a string?
(In reply to comment #5) > This is failing on the Gtk+ buildbot and according to my version of the HTML5 > draft platform may be the zero length. Maybe you should check the type to be a > string? Done, r39290.