New issue
Advanced search Search tips

Issue 590908 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Mar 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

ServiceWorker wrong Cache's methods arguments length

Reported by nekr.fab...@gmail.com, Feb 29 2016

Issue description

UserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36

Example URL:

Steps to reproduce the problem:
Run this in SW console:

caches.open('test').then(function(cache) {
  var test = {
    'match.length': cache.match.length,
    'matchAll.length': cache.matchAll.length,
    'keys.length': cache.keys.length,
    'delete.length': cache.delete.length,
  };

  console.dir(test);
});

What is the expected behavior?
It should be something like this:

delete.length: 1
keys.length: 0
match.length: 1
matchAll.length: 0

This is that Firefox has and that other APIs have.

What went wrong?
It is:

delete.length: 2
keys.length: 2
match.length: 2
matchAll.length: 2

Did this work before? No 

Chrome version: 48.0.2564.116  Channel: n/a
OS Version: OS X 10.11.3
Flash Version: Shockwave Flash 20.0 r0

Canary same as Stable
 

Comment 1 by mattm@chromium.org, Mar 1 2016

Components: -Internals>Network Blink>ServiceWorker>Cache
https://developer.mozilla.org/en-US/docs/Web/API/Cache shows all those methods as taking 2 arguments. I'm not familiar enough to know what javascript function.length is supposed to return when some arguments are optional, but I'm not sure this is actually a bug.

Function's length should reflect only mandatory params, this is how built-in JS functions works (explicitly defined in spec).

But if you are saying that all API in Chrome works in a way as in SW -- length reflects all arguments, not only mandatory. Then it's indeed not a bug.
Labels: Needs-Feedback
Unable to reproduce the issue on Windows 7, Mac 10.10.5, Ubuntu 14.04 using 48.0.2564.116, latest canary 51.0.2663.0 with below steps:

1.Run the given code in dev tools->console.
2.Observed that the output displayed as below:
delete.length: 1
keys.length: 0
match.length: 1
matchAll.length: 0

Please find attached screenshot.

nekr.fabula@Could you please check the issue on clean profile and update the thread if issue still persists.
590908.png
536 KB View Download
@ssamanoori, yes, sorry, it's my bad, I was modifying some function for polyfill and forgot to turn it off before testing.
Could be closed.

Comment 5 by mattm@chromium.org, Mar 1 2016

Status: WontFix (was: Unconfirmed)
Thanks for following up. Closing.
Components: Blink>Storage>CacheStorage
Components: -Blink>ServiceWorker>Cache

Sign in to add a comment