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

Issue 675227 link

Starred by 2 users

Issue metadata

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



Sign in to add a comment

indexedDB put() does not work in the last Canary

Reported by vsemozhe...@gmail.com, Dec 16 2016

Issue description

UserAgent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/57.0.2953.0 Safari/537.36

Steps to reproduce the problem:
Run this code via the Console or a Sources Script Snippet:
/********************************************************/
const openRequest = indexedDB.open('testIDB', 1);

openRequest.onerror = (evt) => {
  console.error(evt.target.error);
};

openRequest.onupgradeneeded = (evt) => {
  evt.target.result.createObjectStore('testSTORE');
};

openRequest.onsuccess = (evt) => {
  const db = evt.target.result;

  db.onerror = (evt) => {
    console.error(evt.target.error);
    db.close();
  };

  db.transaction('testSTORE', 'readwrite').objectStore('testSTORE')
  .put('testVAL', 'testKEY').onsuccess = () => {
    db.transaction('testSTORE', 'readonly').objectStore('testSTORE')
    .get('testKEY').onsuccess = (evt) => {
      console.log(`testKEY: ${evt.target.result}`);
      db.close();
    };
  };
};
/********************************************************/

What is the expected behavior?
Console output: "testKEY: testVAL".

You can see it in the last Firefox (53.0a1 (2016-12-16) (64-bit)) and the last Google Chrome Dev channel build (57.0.2950.4 dev (64-bit)).

You can also look in the Application -> IndexedDB and see the key and the value in the testIDB -> testSTORE.

What went wrong?
In the last Canary build (57.0.2953.0 canary (64-bit)) the output is "testKEY: undefined". You can also look in the Application -> IndexedDB and see that testSTORE in testIDB is created, but empty.

Did this work before? Yes 57.0.2950.4 dev (64-bit)

Does this work in other browsers? Yes

Chrome version: 57.0.2953.0  Channel: canary
OS Version: 6.1 (Windows 7, Windows Server 2008 R2)
Flash Version: 24.0.0.189

I've successfully used a bookmarklet with a code like this in Google Chrome during several years.
 
The bug is reproducible with http://, https:// and file:// pages 
In diff between 57.0.2950.4 and 57.0.2953.0 there are at least 5 indexedDB-related changes:

https://chromium.googlesource.com/chromium/src/+log/57.0.2950.4..57.0.2953.0?pretty=fuller&n=10000

Comment 3 by tkent@chromium.org, Dec 19 2016

Components: Blink>Storage>IndexedDB
Labels: bisc

Comment 4 by tkent@chromium.org, Dec 19 2016

Labels: -bisc Needs-Bisect

Comment 5 by hdodda@chromium.org, Dec 19 2016

Cc: hdodda@chromium.org
Labels: Needs-Feedback
Tested on windows 10 , windows 7 using chrome latest canary M57 #57.0.2955.0 and issue is not reproduced.

The output of the given code in comment#0 in console is "testKEY: testVAL" as expected.

Attached screenshot for reference. 

@vsemozhetbyt -- Could you please check and let us know if this is the intended behavior or correct us if we have missed out anything.

Thanks!
675227.png
517 KB View Download
Here are my screenshots. Could it be any settings that change the indexedDB API?
IDB1.png
121 KB View Download
IDB2.png
106 KB View Download
I've tried to disable brotli-encoding and to enable PreferHtmlOverPlugins to get command line matched with your screenshot, but the bug remains.

Comment 8 by jsb...@chromium.org, Dec 19 2016

Cc: dmu...@chromium.org
Are you sure the first transaction is committing?

Add in listeners for 'complete' and 'abort' events on the transaction.

You might see this behavior if the first transaction (the one with the put()) is aborting so the record does not appear when the second transaction (the one with the get()) runs. I don't know why it would be aborting consistently, though, if the upgrade succeeds. (i.e. we're not dealing with a quota issue)

The only other guess I have at the moment is that a bug was introduced where the readonly transaction is allowed to start before the readwrite transaction commits; we'd have seen test failures in that case, though.



If any transaction is not committing, the `console.log` should not be fired, should it?

`console.log` is contained in the second transaction (`get`) 'onsuccess' event callback, and the second transaction is contained in the first transaction (`put`) 'onsuccess' event callback. If the first one failed, neither `get` nor `console.log` should be fired, right? Maybe I miss something or do not understand API right. Could you suppose another code to check your assumptions?
It seems you are right. I've run this code:
/********************************************************/
const openRequest = indexedDB.open('testIDB', 1);

openRequest.onerror = (evt) => {
  console.error(evt.target.error);
};

openRequest.onupgradeneeded = (evt) => {
  evt.target.result.createObjectStore('testSTORE');
};

openRequest.onsuccess = (evt) => {
  const db = evt.target.result;

  db.onerror = (evt) => {
    console.error(evt.target.error);
    db.close();
  };

  const transaction = db.transaction('testSTORE', 'readwrite');

  transaction.oncomplete = function(event) { console.log(`put complete: `, event); };
  transaction.onabort    = function(event) { console.log(`put aborted: `,  event); };
  transaction.onerror    = function(event) { console.log(`put error: `,    event); };

  transaction.objectStore('testSTORE')
  .put('testVAL', 'testKEY').onsuccess = () => {
    db.transaction('testSTORE', 'readonly').objectStore('testSTORE')
    .get('testKEY').onsuccess = (evt) => {
      console.log(`testKEY: ${evt.target.result}`);
      db.close();
    };
  };
};

/********************************************************/
And here is the output in the screenshot. Should I unfold any event sub-objects for you?


IDB3.png
16.4 KB View Download
Look at transaction.error.name and transaction.error.message in the onabort handler.
transaction.onabort = function(event) { console.log(`put aborted: ${transaction.error.name}, ${transaction.error.message}.`); };

"put aborted: QuotaExceededError, ."
So is this a bug or some local misconfiguration? I have ~ 1.5 GB free space on the disk and there is no problem with 57.0.2950.4 dev.

Comment 14 by ajha@chromium.org, Dec 20 2016

Labels: M-57
In 57.0.2959.0 Canary (64-bit) the bug has disappeared.
@vsemozhetbyt--As per comment #15 , can we close the issue . Could you please confirm us.
For me, the bug has gone, so if nobody else confirms it, maybe it could be closed.

Comment 18 by ajha@chromium.org, Dec 26 2016

Labels: -Needs-Feedback -Needs-Bisect
Status: WontFix (was: Unconfirmed)
Thanks for the update, closing the issue as per C#17.

Sign in to add a comment