New issue
Advanced search Search tips

Issue 796130 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Dec 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug-Regression



Sign in to add a comment

For loop on localStorage returns extra data on Cordova

Reported by netikste...@gmail.com, Dec 19 2017

Issue description

Steps to reproduce the problem:
1. This is a cordova application that uses local storage
2. Using for(var item in localStorage) used to return only items in the localStorage.
3. After upgrading to Chrome "63.0.3239.111" now it is returning 'length' as the last item in the loop.

What is the expected behavior?
length should not be returned in the for(var item in localStorage)

What went wrong?
After upgrading to Chrome "63.0.3239.111" now it is returning 'length' as the last item in the loop.

Did this work before? Yes 62

Does this work in other browsers? Yes

Chrome version: 63.0.3239.111  Channel: stable
OS Version: 7.0
Flash Version:
 

Comment 1 by jsb...@chromium.org, Dec 19 2017

Components: -Blink>Storage Blink>Storage>DOMStorage Blink>Bindings
Status: WontFix (was: Unconfirmed)
Bindings change? Seems like a fix to me.

for (var item in localStorage) console.log(item);

Chrome 62 logs: undefined
Chrome 63 logs: length, key, getItem, setItem, removeItem, clear
Safari 11 logs: length, key, getItem, setItem, removeItem, clear
Firefox 57 logs: key, getItem, setItem, removeItem, clear, length
Edge 16 logs: undefined

Marking as WontFix / working as intended since this seems to have improved interop.


> Bindings change? Seems like a fix to me.

This is likely a consequence of https://chromium-review.googlesource.com/691974, documented in https://www.chromestatus.com/feature/5120599789666304
But this is not backwards compatible since a lot might have a for(var item in localStorage) loop to get all the stored items but this wont work with the new version. Especially if it is a mobile application built with Cordova and users update chrome application. 

Comment 4 by phistuck@gmail.com, Dec 21 2017

#3 - correct, this is not backward compatible, but your Cordova application would have been broken on recent iOS as well (or using a Firefox webview, if such option exists), because the new behavior interoperates with the most of the browsers (Edge behaves like old Chrome).

Sign in to add a comment