Bug 122402 - Tighten AbstractWorker and subclasses a bit.
Summary: Tighten AbstractWorker and subclasses a bit.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Andreas Kling
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-05 20:41 PDT by Andreas Kling
Modified: 2013-10-06 11:46 PDT (History)
2 users (show)

See Also:


Attachments
Patch (8.57 KB, patch)
2013-10-05 20:42 PDT, Andreas Kling
no flags Details | Formatted Diff | Diff
Patch (12.30 KB, patch)
2013-10-05 21:05 PDT, Andreas Kling
darin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Kling 2013-10-05 20:41:20 PDT
Tighten AbstractWorker and subclasses a bit.
Comment 1 Andreas Kling 2013-10-05 20:42:26 PDT
Created attachment 213487 [details]
Patch
Comment 2 Andreas Kling 2013-10-05 21:05:43 PDT
Created attachment 213490 [details]
Patch
Comment 3 WebKit Commit Bot 2013-10-05 21:08:29 PDT
Attachment 213490 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/bindings/js/JSSharedWorkerCustom.cpp', u'Source/WebCore/bindings/js/JSWorkerCustom.cpp', u'Source/WebCore/workers/AbstractWorker.cpp', u'Source/WebCore/workers/AbstractWorker.h', u'Source/WebCore/workers/SharedWorker.cpp', u'Source/WebCore/workers/SharedWorker.h', u'Source/WebCore/workers/Worker.cpp', u'Source/WebCore/workers/Worker.h']" exit_code: 1
Source/WebCore/workers/SharedWorker.h:41:  Code inside a namespace should not be indented.  [whitespace/indent] [4]
Total errors found: 1 in 9 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Darin Adler 2013-10-06 09:30:35 PDT
Comment on attachment 213490 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=213490&action=review

> Source/WebCore/workers/SharedWorker.cpp:61
> +    // We don't currently support nested workers, so workers can only be created from documents.
> +    ASSERT_WITH_SECURITY_IMPLICATION(context.isDocument());
> +    Document& document = static_cast<Document&>(context);

Is having the argument stay a ScriptExecutionContext& truly a helpful forward-looking step? I guess so, but it’s a little annoying.

> Source/WebCore/workers/SharedWorker.cpp:63
> +    FeatureObserver::observe(static_cast<Document&>(context).domWindow(), FeatureObserver::SharedWorkerStart);

document, not static_cast<Document&>(context)

> Source/WebCore/workers/Worker.cpp:81
> -    FeatureObserver::observe(static_cast<Document*>(context)->domWindow(), FeatureObserver::WorkerStart);
> +    FeatureObserver::observe(static_cast<Document&>(context).domWindow(), FeatureObserver::WorkerStart);

Where’s the assertion that goes with this cast?
Comment 5 Andreas Kling 2013-10-06 11:46:15 PDT
Committed r157000: <http://trac.webkit.org/changeset/157000>