Closed Bug 1427188 Opened 6 years ago Closed 6 years ago

Search box in add-on manager not working in nightly

Categories

(Thunderbird :: Add-Ons: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Thunderbird 59.0

People

(Reporter: jik, Assigned: Paenglab)

Details

Attachments

(2 files, 2 obsolete files)

With 2017-12-27 nightly, I get this error in the error console when I try to search on the add-ons page:

TypeError: chromewin.openLinkIn is not a function[Learn More]  extensions.js:2016:7
	initialize/< chrome://mozapps/content/extensions/extensions.js:2016:7
	_fireCommand chrome://global/content/bindings/textbox.xml:386:11
	_enterSearch chrome://global/content/bindings/textbox.xml:403:11
	onxblkeypress chrome://global/content/bindings/textbox.xml:441:11
Same here using Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0a1 BuildID: 20171227030203
Attached patch Bug1427188.patch (obsolete) — Splinter Review
Aceman, what do you think about this? I copied this from your code of bug 1419145. It didn't reuse the tab with the same search term. So I removed the whole check and leaved the tab opening. This is a very simple patch but it works.

Feel free to take the bug and improve the patch. My knowledge is too limited for more.
Attachment #8938965 - Flags: review?(acelists)
Comment on attachment 8938965 [details] [diff] [review]
Bug1427188.patch

If you wanted to reuse a tab with existing search/URL you could call switchToTabHavingURI() from your new function. But I'm not sure that is needed.
I also wonder why you put it in mail/base/content/utilityOverlay.js and my function is in mail/base/content/mailWindowOverlay.js (also called from addon manager). I don't know which one is better placement and if there is any schema in it.
I placed it there because FX has it there too https://dxr.mozilla.org/comm-central/source/mozilla/browser/base/content/utilityOverlay.js#207 and I thought it needs to be there to be found when chromewin.openLinkIn is called.
Attached patch Bug1427188.patch (obsolete) — Splinter Review
(In reply to :aceman [mostly away 23-29 Dec] from comment #3)
> Comment on attachment 8938965 [details] [diff] [review]
> Bug1427188.patch
> 
> If you wanted to reuse a tab with existing search/URL you could call
> switchToTabHavingURI() from your new function. But I'm not sure that is
> needed.

Tried it and it still opens a new tab with the same search term.

> I also wonder why you put it in mail/base/content/utilityOverlay.js and my
> function is in mail/base/content/mailWindowOverlay.js (also called from
> addon manager). I don't know which one is better placement and if there is
> any schema in it.

It works with mailWindowOverlay.js too -> moved it.
Assignee: nobody → richard.marti
Attachment #8938965 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8938965 - Flags: review?(acelists)
Attachment #8938990 - Flags: review?(acelists)
Comment on attachment 8938965 [details] [diff] [review]
Bug1427188.patch

Review of attachment 8938965 [details] [diff] [review]:
-----------------------------------------------------------------

You are right, placing it in utilityOverlay.js seems better. We could also move switchToTabHavingURI() there, there are more of these tab opening functions. Jorg, would you agree with that and should we do it in this patch/bug (I've tested that the Preferenecs buttons in addon manager still works after the movement).

::: mail/base/content/utilityOverlay.js
@@ +324,5 @@
>    openContentTab(url, where, "^http://www.mozilla.org/");
>  }
> +
> +/* Used by the Add-on manager's search box */
> +function openLinkIn(aURI, aOpenNew, aOpenParams) {

Looking at the m-c definition of the function "openLinkIn(url, where, params", the second argument is 'where', containing values like "tab" or "window", so please rename the argument and pass it on to openContentTab.
Attachment #8938965 - Flags: feedback?(jorgk)
Attachment #8938965 - Attachment is obsolete: false
Comment on attachment 8938965 [details] [diff] [review]
Bug1427188.patch

Why f? and not NI?

M-C have switchToTabHavingURI() in browser/base/content/browser.js.

Frankly, I don't have an opinion, you'd have to ask Magnus about the meaning of all these files. If you want to move it in this patch, you have my blessing. But since M-C have the two functions in different files, we might as well not move it.
Attachment #8938965 - Flags: feedback?(jorgk)
(In reply to Richard Marti (:Paenglab) from comment #5)
> > If you wanted to reuse a tab with existing search/URL you could call
> > switchToTabHavingURI() from your new function. But I'm not sure that is
> > needed.
> 
> Tried it and it still opens a new tab with the same search term.

I debugged this and it happens because the search box calls an URL of
https://addons.mozilla.org/en-US/thunderbird/search?q=column
but after the tab loads the URL is https://addons.mozilla.org/en-US/thunderbird/search/?q=column (notice the / after 'search'). So the urls are not equal and we open a new tab. The / may be added by some server redirect.

So I'll upload a new patch using switchToTabHavingURI() but it always opens a new tab for now. Notice the same also happens in Firefox nightly.

This can be solved by adding the / into extensions.getAddons.search.browseURL . But Firefox also hasn't done that yet.
Attached patch 1427188.patch v2Splinter Review
This implements it all, but we need decision from Magnus if we can change the search URL.
Attachment #8938965 - Attachment is obsolete: true
Attachment #8938990 - Attachment is obsolete: true
Attachment #8938990 - Flags: review?(acelists)
Attachment #8939164 - Flags: ui-review?(richard.marti)
Attachment #8939164 - Flags: review?(mkmelin+mozilla)
Comment on attachment 8939164 [details] [diff] [review]
1427188.patch v2

Yes, it switches now to the already open tab when the same search is done and in the search tab nothing has changed.
Attachment #8939164 - Flags: ui-review?(richard.marti) → ui-review+
Maybe involve Andrei on the slash business. Andrei, please see comment #8 and the patch.
Flags: needinfo?(sancus)
Comment on attachment 8939164 [details] [diff] [review]
1427188.patch v2

Let's do a PLR for Magnus. This is busted, so we might as well fix it.
Attachment #8939164 - Flags: review+
Or you could land the patch without that pref change hunk as it is not critical to the fix, to be on the safer side. As said, we would behave better than Firefox does (it opens new tabs for each search), so there is no rush to land that part.
Comment on attachment 8939164 [details] [diff] [review]
1427188.patch v2

Review of attachment 8939164 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good, thx! r=mkmelin
(with this change we're just using what the server wants us to use)
Attachment #8939164 - Flags: review?(mkmelin+mozilla) → review+
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/dd64bc33f829
Add the openLinkIn() to utilityOverlay.js for add-on search to work. r=aceman,mkmelin
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → Thunderbird 59.0
This breaks "Tools > Add-on Options" when the add-on has tab options (3).
Backing out rev dd64bc33f829 makes tab options work again.

Please fix.
Status: RESOLVED → REOPENED
Flags: needinfo?(sancus)
Flags: needinfo?(richard.marti)
Flags: needinfo?(acelists)
Resolution: FIXED → ---
Attached patch 1427188-2.patchSplinter Review
Fix
Flags: needinfo?(acelists)
Attachment #8939327 - Flags: review?(jorgk)
Comment on attachment 8939327 [details] [diff] [review]
1427188-2.patch

Fix :-)
Attachment #8939327 - Flags: review?(jorgk) → review+
Thanks aceman.
Flags: needinfo?(richard.marti)
Pushed by mozilla@jorgk.com:
https://hg.mozilla.org/comm-central/rev/bb53b1cf7bc0
Follow-up: open a new tab for add-on options if not already open. r=jorgk
Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Component: General → Add-Ons: General
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: