New issue
Advanced search Search tips

Issue 611848 link

Starred by 3 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Apr 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Chrome
Pri: 3
Type: Bug



Sign in to add a comment

Chrome OS Beta 51 fails authorization with console error Cannot assign to read only property 'indexedDB' of object '#<Window>'

Reported by swebste...@gmail.com, May 13 2016

Issue description

Chrome Version       : Version 51.0.2704.42 beta (64-bit)
Platform 8172.28.0 (Official Build) beta-channel link

URLs (if applicable) : protected

Other browsers tested: Chrome OS version 50
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari: not tested
    Firefox: not tested
         IE: not tested

What steps will reproduce the problem?
(1) Use Chrome OS version 51 (beta) in a Chromebook.
(2) A customer's web app has an Google authorization step so create any index.html code that checks the signed in Google account and has any scopes to grant.
(3) Once approved, the following console error occurs: 
"TypeError: Cannot assign to read only property 'indexedDB' of object '#<Window>'"


What is the expected result?
passes authorization.

What happens instead?
console error: 
"TypeError: Cannot assign to read only property 'indexedDB' of object '#<Window>'"



Please provide any additional information below. Attach a screenshot if
possible.

Some example code to duplicate error with Chrome OS version 51:

var scopes = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile https://www.googleapis.com/auth/drive';

...
function handleClientLoad() {
    loadText = document.getElementById('loading').childNodes[1].childNodes[1];
    loadText.nodeValue = 'Checking Google authorization...';
    gapi.client.setApiKey(apiKey);
    window.setTimeout(checkAuth, 1);
}

function checkAuth() {
    gapi.auth.authorize({
        client_id: clientId,
        scope: scopes,
        immediate: true
    }, handleAuthResult);
}

function handleAuthResult(authResult) {
    $(function() {
        $loading = $('#loading');
        if (authResult && !authResult.error) {
            if ($auth) {
                $auth.hide();
                $loading.show();
            }
            
            $.ajax('https://www.googleapis.com/oauth2/v3/userinfo?access_token='+authResult.access_token).done(function(res) {
                user_id = res.email.replace(".","_");

            })

            
            startApp();
            window.setInterval(updateToken, 600000); //every 10 minutes (the token expires in 1 hour)

        } else {
            $loading.hide();
            $auth = $('#auth').show();
            $auth.find('#authorize-button').click(handleAuthClick);
        }
    });
}

function handleAuthClick(event) {
    gapi.auth.authorize({
        client_id: clientId,
        scope: scopes,
        immediate: false
    }, handleAuthResult);
    return false;
}

function updateToken() {
    //console.log('updateToken');
    gapi.auth.authorize({
        client_id: clientId,
        scope: scopes,
        immediate: true
    }, handleTokenUpdate);
}

function handleTokenUpdate(authResult) {
    if (authResult && !authResult.error) return;
    $loading.hide();
    $app.hide(); //remember to hide other top-level divs you might have
    alert("There's an error with your authentication.\nPlease refresh your browser.");
}

function getToken(secondTime) {
    var token = gapi.auth.getToken().access_token;
    if (!token && !secondTime) {
        updateToken();
        return getToken(1);
    }
    return token;
}


 
NOTE: the same code and process works in Chrome OS 50, but not 51.

Comment 2 by ajha@chromium.org, May 17 2016

Labels: OS-Chrome

Comment 3 by dchan@google.com, Jun 3 2016

Components: Blink>JavaScript>API
UPDATE: For our specific customer we were able to do the following:
The code wanted to add the indexedDB function to a global variable, but newer versions of chrome don't want you to because it is blocked: indexedDB is already available globally after v51. 
So we added a small check to skip adding the indexedDB to global if this is the case.
Components: -Blink>JavaScript>API Blink>JavaScript
not a V8 bug.
Components: -Blink>JavaScript Blink
Components: -Blink Blink>Bindings

Comment 8 by bashi@chromium.org, Aug 1 2016

#4

How did you add the check? Sounds like it's not a bug in Chrome but in the code you are using.
Status: WontFix (was: Unconfirmed)
Cannot reproduce.

Sign in to add a comment