Debugging JSON config for an extension?

15 views
Skip to first unread message

Yves Arrouye

unread,
Jun 16, 2017, 2:23:15 PM6/16/17
to Chromium OS dev
I have an extension that declares a custom JSON schema. It also requests 'storage' in the manifest. In my extension, I run this:

 chrome.storage.managed.get((policy) => {
    try {
      proxyHostConfig = policy[DEFAULT_PROXY_HOST_NAME];
      verifiedAccessConfig.host =
          policy[DEFAULT_VERIFIED_ACCESS_NAME][DEFAULT_PROXY_HOST_PROPERTY_NAME];
      verifiedAccessConfig.api_key =
          policy[DEFAULT_VERIFIED_ACCESS_NAME][DEFAULT_API_KEY_PROPERTY_NAME];
    } catch (e) {
      if (e instanceof TypeError) {
        // We are in a non-enterprise setting, just log the error and use
        // defaults.
        console.log('Extension is not configured, using default values.');
        proxyHostConfig = DEFAULT_PROXY_HOST;
        verifiedAccessConfig.host = DEFAULT_VERIFIED_ACCESS_HOST;
      } else {
        throw e;
      }
    }
    displayConfigurationValues();
  });
}
And the different values are undefined. I see that a debugger too.

How can I troubleshoot this? Hoping it's just an easy Yves error :)

Mike Frysinger

unread,
Jun 16, 2017, 2:36:27 PM6/16/17
to Yves Arrouye, Chromium OS dev
i don't think we do that much extension debugging here.  even the chromium guys push people towards posting extension questions to SO.

in your particular case, seems like you're not using get correctly ?  you need to pass in the keys you're interesting in.  here's the signature:
  StorageArea.get(string or array of string or object keys, function callback)
-mike

--
--
Chromium OS Developers mailing list: chromiu...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-os-dev?hl=en


Yves Arrouye

unread,
Jun 16, 2017, 2:46:12 PM6/16/17
to Mike Frysinger, Chromium OS dev

Thanks. I am not sure where I got my example from. If this is it, definitely an easy Yves error!

Yves Arrouye

unread,
Jun 16, 2017, 5:07:54 PM6/16/17
to Mike Frysinger, Chromium OS dev
So calling with null as the first argument, the object I get is empty. :( Nobody here has any idea how to troubleshoot?

Mike Frysinger

unread,
Jun 16, 2017, 5:33:10 PM6/16/17
to Yves Arrouye, Chromium OS dev
are you sure there's storage there ?

at this point, you prob want to try SO.
-mike

Yves Arrouye

unread,
Jun 21, 2017, 2:22:12 PM6/21/17
to Mike Frysinger, Chromium OS dev
Another question. My schema is like this:

{
  "type": "object",
  "properties": {
    "ProxyHost": {
      "title": "Proxy hostname.",
      "description": "Hostname for the proxy server used for user authentication.",
      "type": "string"
    },
    "VerifiedAccess": {
      "type": "object",
      "properties": {
        "host": {
          "title": "Verified Access server hostname.",
          "description": "Hostname for the Verified Access server.",
          "type": "string"
        },
        "api_key": {
          "title": "API Key.",
          "description": "API key to call the Verified Server API.",
          "type": "string"
        }
      }
    }
  }
}
When the config for, say, VerifiedAccess.host changes, what is the key I will get in the change listener?

Mike Frysinger

unread,
Jun 21, 2017, 2:50:57 PM6/21/17
to Yves Arrouye, Chromium OS dev
i can't read the question as it's been garbled
-mike
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages