Closed Bug 1526802 Opened 2 years ago Closed 1 year ago

The API browser.runtime.openOptionsPage does not display the page

Categories

(Thunderbird :: Add-Ons: Extensions API, defect, P2)

defect

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 77.0

People

(Reporter: ysard_git, Assigned: rnons)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0

Steps to reproduce:

I'm on Thunderbird beta 65.0b4.

The API runtime is supposed to be as it is in Firefox according to this page:
https://thunderbird-webextensions.readthedocs.io/en/latest/index.html?highlight=runtime

Let's do a simple background-script.js as shown on the page:
https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/openOptionsPage

function onOpened() {
console.log(Options page opened);
}
function onError(error) {
console.log(Error: ${error});
}
var opening = browser.runtime.openOptionsPage();
opening.then(onOpened, onError);

With the following manifest.json:

{
"description": "Show Options page example",
"manifest_version": 2,
"name": "Show Options page example",
"version": "1.0",
"icons": {
"48": "icons/message.svg"
},
"applications": {
"gecko": {
"id": "options_page@example.org",
"strict_min_version": "50.0"
}
},
"background": {
"scripts": ["background.js"]
},
"options_ui": {
"page": "options.html",
"open_in_tab": true
}
}

Actual results:

The console outputs the following stacktrace:

openOptionsPage is not defined ext-runtime.js:133

openOptionsPage chrome://extensions/content/parent/ext-runtime.js:133 
openOptionsPage self-hosted:972 
result resource://gre/modules/ExtensionParent.jsm:947 
withPendingBrowser resource://gre/modules/ExtensionParent.jsm:601 
InterpretGeneratorResume self-hosted:1255 
next self-hosted:1210 
result resource://gre/modules/ExtensionParent.jsm:946 
withTiming resource://gre/modules/ExtensionParent.jsm:913 
InterpretGeneratorResume self-hosted:1255 
next self-hosted:1210 
call resource://gre/modules/ExtensionParent.jsm:945 
InterpretGeneratorResume self-hosted:1255 
next self-hosted:1210 

Error: Error: An unexpected error occurred background.js:7:5

Expected results:

The options.html page should open in a Thunderbird tab, as is the case under Firefox.

Thank you for reading.

OS: Unspecified → Linux
Hardware: Unspecified → x86_64
Summary: openOptionsPage → The API browser.runtime.openOptionsPage does not display the page

Hi, this issue is still present on 67.0a1 nightly.
This is quite annoying since it prevents access to options from the interface of an addon.
Note: The options page is only accessible from the "Add-ons Manager" tab.

Magnus, bugs like this one are just ignored :-(

Flags: needinfo?(geoff)
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(geoff)
OS: Linux → All
Hardware: x86_64 → All
Version: 65 → unspecified
Priority: -- → P2
Attachment #9138732 - Flags: review?(geoff)
Comment on attachment 9138732 [details] [diff] [review]
1526802-openOptionsPage.patch

Thank you. This works well.
Attachment #9138732 - Flags: review?(geoff) → review+
Assignee: nobody → remotenonsense
Status: NEW → ASSIGNED

Can someone please provide a complete HG header here. We need a something like:
# User Ping Chen <remotenonsense@gmail.com>

You can put
[ui]
username =
into your mercurial.ini file. for future patches.

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/7e335f6ec503
add openOptionsPage function to ext-mail.js. r=darktrojan

Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 77.0

(In reply to Jorg K (CEST = GMT+2) from comment #5)

Can someone please provide a complete HG header here. We need a something like:
# User Ping Chen <remotenonsense@gmail.com>

You can put
[ui]
username =
into your mercurial.ini file. for future patches.

Hi Jorg, thanks. I don't know how it happened, but I already have the username config in ~/.hgrc, and it worked well for my other patches. Will take care next time.

You need to log in before you can comment on or make changes to this bug.