Webextension openOptionsPage

I wrote an HTML file that displays settings and lets the user
change them, I wrote a script, included from the HTML file, that
populates the
settings page from storage and updates stored settings when the user
changes them and I set the path to the HTML file as the options_ui
key in manifest.json.
It works in debug mode, but it doesn’t work when the web extention is public on AMO. There are any issues about this procedure?

Did you include moz-extension://xxx-...-xxx/ in the path to your options page in the manifest.json?
If you did you need to remove that.

I didn’t include moz-extension in manifest.json

//manifest.json
{
“manifest_version”: 2,
“name”: “xxxxxx”,
“version”: “1.0.1”,
“description”: “blablablabla.”,
“icons”: {
“48”: “bla48.png”,
“96”: “bla96.png”
},

“content_scripts”: [
{
“matches”: [ “://.bla.it/", "://.bla.com/” ],
“js”: [“blabla.js”]
}
],
“background”: {
“scripts”: [“background.js”]
},

“applications”: {
“gecko”: {
“id”: "blabla@mozilla.org"
}
},

“options_ui”: {
“page”: “goptions.html”
},

“permissions”: [“storage”]

}

Ok, are you sure that there is a file “goptions.html” in your packed .xpi/.zip and are there any errors in the Browser Console (Ctrl+Shif+J) ?

Damn, forgot to hit “Reply” -.-

You are right! There is an error in the Browser Console, but the url referred is not available.

//Error from browser console
A promise chain failed to handle a rejection. Did you forget to ‘.catch’, or did you forget to ‘return’?
See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise

Date: Fri Nov 04 2016 11:05:14 GMT+0100 (W. Europe Standard Time)
Full Message: [object Event]
Full Stack: JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: PendingErrors.register :: line 195
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.completePromise :: line 718
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: Handler.prototype.process :: line 973
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.walkerLoop :: line 816
JS frame :: resource://gre/modules/Promise.jsm -> resource://gre/modules/Promise-backend.js :: this.PromiseWalker.scheduleWalkerLoop/< :: line 750

Ok, that only tells you that something didn’t work. That error might not even be related to your add-on.
Is the error thrown when you load your add-on / click the options button?
If you click on the error, what does the message say?

The error thrown when I click the options button.
No other details are available if I click on the error.

So, on about:addons you click the “more” link / the “Options” button and see the add-on’s details page, but not your options on the button of the page?

Right.
Attached the screenshoots with the differences (in the first one I loaded my local version, in the second one the version installed from AMO):

In the bottom case, please:

  1. press Ctrl+Shift+C to open the inspector
  2. search for .inline-options-browser
  3. copy the src
  4. open that url in a new tab

the src value is:
moz-extension://4dec559b-7264-4813-987f-fcead2a8595b/goptions.html
trying to open the url:
http://4dec559b-7264-4813-987f-fcead2a8595b/goptions.html

Page not found!

It seems that not.

(I hope you have not actually tried to open
http://4dec559b-7264-4813-987f-fcead2a8595b/goptions.html but
moz-extension://4dec559b-7264-4813-987f-fcead2a8595b/goptions.html)

The file “goptions.html” is in the .zip file.
I’ll submit another time the .zip file to AMO…

No, it is not: https://addons.mozilla.org/en-US/firefox/files/browse/529724/

You have a “Goptions.html” in there, not a “goptions.html”.
These URLs are generally case sensitive.

If it worked before (on Windows I guess, directly from the FS) that’s actually a bug.

1 Like

Thank you Nilkas!
I’ll submit a new version ‘case sensitive’.