Bug 22719 - Implement Navigator object in Workers
Summary: Implement Navigator object in Workers
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Enhancement
Assignee: Alexey Proskuryakov
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2008-12-07 03:16 PST by Alexey Proskuryakov
Modified: 2008-12-14 02:08 PST (History)
1 user (show)

See Also:


Attachments
proposed patch (43.65 KB, patch)
2008-12-09 08:57 PST, Alexey Proskuryakov
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Proskuryakov 2008-12-07 03:16:09 PST
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>.
Comment 1 Alexey Proskuryakov 2008-12-07 03:57:48 PST
<rdar://problem/6425805>
Comment 2 Alexey Proskuryakov 2008-12-09 08:57:24 PST
Created attachment 25888 [details]
proposed patch
Comment 3 Darin Adler 2008-12-09 09:11:10 PST
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
Comment 4 Alexey Proskuryakov 2008-12-09 09:59:22 PST
Committed revision 39138.

I will look into auto-generating JSWorkerContext in the future - I couldn't find any way to do it before.
Comment 5 Holger Freyther 2008-12-13 15:34:35 PST
> +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?
Comment 6 Alexey Proskuryakov 2008-12-14 02:08:00 PST
(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.