Closed Bug 1301098 Opened 8 years ago Closed 8 years ago

chrome.storage not available in options page

Categories

(Firefox :: Untriaged, defect)

48 Branch
defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: martin.riethmayer, Unassigned)

Details

Attachments

(1 file)

Attached file settings_example.zip
User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.82 Safari/537.36 OPR/39.0.2256.48

Steps to reproduce:

I'm creating a webextension, this is in my manifest.json:

++++++++++++++++++
"options_ui": {"page": "options.html"},
  
"permissions": ["contextMenus", "storage", "tabs"],
++++++++++++++++++

The options.html file has as a last line before the closing body-Tag:

<script type="text/javascript" src="options.js"></script>

The options.js file has (e.g.)
chrome.storage.local.get({
		language: 'de'}, ......);

I'm loading the extension from a local file (via about:debugging),


Actual results:

When I open the options page, firebug tells me "ReferenceError: chrome is not defined"

This might be related to https://bugzilla.mozilla.org/show_bug.cgi?id=1197346 (see comment 13/14, I couldn't find any bug opened for this issue)


Expected results:

chrome.storage.local.get should work 

Even the documentation at

https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Implement_a_settings_page

says, that it should work! You can copy the complete example from that page and you'll get the ReferenceError.

Either the documentation is wrong or the implementation is missing.

This is happening on Firefox 48.0 on Kubuntu. I'm attaching the source of the example (copy and paste from the documentation above) for convenience.
Sorry, I forgot to mention that this is working as expected in Chromium
On OS X the add-on at https://github.com/mdn/webextensions-examples/tree/master/favourite-colour works for me. I tried your add-on and that worked as well and couldn't reproduce any problems.
I have no explanation, but: - it works today for me as well - both the attached extension from the MDN site, as well as my own extension (and favourite colour, too).

I've restarted Firefox in the meantime, but did not do anything else (not clearing cache, no update). Very strange. This was reproducible everytime when I reported it, but now it's working as expected.

I'm sorry for the report and adding to your workload. I propose closing this as "WorksForMe".
No need to apologise, thanks for the report. If it happens again, let's see if we can get more information and re-open the bug.
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: