New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 672113 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Dec 2016
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 2
Type: Bug



Sign in to add a comment

Unreachable NotSupportedErrors in the Budget API implementation

Project Member Reported by peter@chromium.org, Dec 7 2016

Issue description

https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/budget/BudgetService.cpp?l=68
https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/budget/BudgetService.cpp?l=132

The IDL defines the `OperationType` enumeration. The generated code automatically verifies that the developer-provided string is included in the enumeration. If it's not, a TypeError will be thrown:

https://cs.chromium.org/chromium/src/out/Debug/gen/blink/bindings/modules/v8/V8BudgetService.cpp?l=78

That means that we'll only end up in the referred to branches when *we* made a programming error by amending the `OperationType` enum, but not the corresponding type in the mojom file. As such, it should be a DCHECK.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Dec 12 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/c774d5e31f3d0333dfdf921c0befcc89d1bd1259

commit c774d5e31f3d0333dfdf921c0befcc89d1bd1259
Author: harkness <harkness@chromium.org>
Date: Mon Dec 12 17:50:52 2016

DCHECK in BudgetService getCost and reserve if an invalid type is supplied.

If an incorrect type is provided to the call, the generated IDL code will
reject with a TypeError. This patch removes code in the service
implementation which was checking whether the type was invalid and returning
a NotSupportedError. The only way this code could be hit would be if there
was a programming error, so it should be a DCHECK.

BUG= 672113 

Review-Url: https://codereview.chromium.org/2570463003
Cr-Commit-Position: refs/heads/master@{#437897}

[modify] https://crrev.com/c774d5e31f3d0333dfdf921c0befcc89d1bd1259/third_party/WebKit/Source/modules/budget/BudgetService.cpp

Status: Fixed (was: Assigned)

Sign in to add a comment