Bug 108611 - Web Inspector: Refactor InspectorDOMStorageAgent::getDOMStorageEntries to report the error messages
Summary: Web Inspector: Refactor InspectorDOMStorageAgent::getDOMStorageEntries to rep...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Vivek Galatage
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 03:53 PST by Vivek Galatage
Modified: 2013-02-02 04:56 PST (History)
10 users (show)

See Also:


Attachments
Patch (3.30 KB, patch)
2013-02-01 03:59 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff
Patch (4.07 KB, patch)
2013-02-01 16:21 PST, Vivek Galatage
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Vivek Galatage 2013-02-01 03:53:08 PST
Refactor InspectorDOMStorageAgent::getDOMStorageEntries to report the error messages.

Patch follows.
Comment 1 Vivek Galatage 2013-02-01 03:59:43 PST
Created attachment 186004 [details]
Patch
Comment 2 Alexander Pavlov (apavlov) 2013-02-01 04:15:52 PST
Comment on attachment 186004 [details]
Patch

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

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:116
> +        *errorString = "Storage resource not found for the provided storage Id";

id -> identifier

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:132
> +        if (ec) {

Does this (and below) check structure mean you bail out of the method without providing any errorString for the other ec values? You have retained the pre-existing behavior for the other cases, but the code was unable to provide ANY errorString previously :)

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:133
> +            switch (ec) {

Not quite sure, but I remember some compilers complain about not all the enum cases being handled if not all of them are enumerated and the switch does not contain the "default:" case.
Comment 3 Yury Semikhatsky 2013-02-01 04:16:54 PST
Comment on attachment 186004 [details]
Patch

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

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:126
> +    entries = TypeBuilder::Array<TypeBuilder::Array<String> >::create();

You shouldn't write to the output parameters partial results in cases there is an error below. You can use local variable to collect the entries and on success assign it to |entries| after the loop below.

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:136
> +                break;

Is it the only type of error? If not you should either process all cases or add default: section here providing some generic error message.

> Source/WebCore/inspector/InspectorDOMStorageAgent.cpp:145
> +                *errorString = "Security error";

ditto, also consider extracting the error handling into a separate function:

if (hadException(ec, errorString))
    return;
Comment 4 Vivek Galatage 2013-02-01 16:21:23 PST
Created attachment 186182 [details]
Patch
Comment 5 Vivek Galatage 2013-02-02 04:52:41 PST
Comment on attachment 186182 [details]
Patch

Thank you!
Comment 6 WebKit Review Bot 2013-02-02 04:56:08 PST
Comment on attachment 186182 [details]
Patch

Clearing flags on attachment: 186182

Committed r141690: <http://trac.webkit.org/changeset/141690>
Comment 7 WebKit Review Bot 2013-02-02 04:56:11 PST
All reviewed patches have been landed.  Closing bug.