Enhance user interface to allow users to modify open search providers.

ASSIGNED
Assigned to

Status

enhancement
ASSIGNED
a year ago
6 days ago

People

(Reporter: unicorn.consulting, Assigned: mkmelin)

Tracking

Thunderbird Tracking Flags

(thunderbird_esr6065+ fixed, thunderbird65 fixed, thunderbird66 affected)

Details

Attachments

(4 attachments, 16 obsolete attachments)

10.95 KB, patch
Details | Diff | Splinter Review
5.14 KB, patch
jorgk
: review+
Details | Diff | Splinter Review
5.49 KB, patch
Details | Diff | Splinter Review
7.89 KB, patch
Paenglab
: review+
Details | Diff | Splinter Review
(Reporter)

Description

a year ago
Changes in TB 59 have removed the ability to add a non listed search provider.
In https://bugzilla.mozilla.org/show_bug.cgi?id=1427167#c5 a manual method to use the API to add the file is discussed.  But the process is hardly suitable for general users wanting to add their favourite search engine.

Firefox has implemented an extensive change to their user interface to accommodate the change, utilizing AMO.  While the AMO route is the simplest from a user perspective, I doubt Thunderbird has the resources at this time to match it.

I suggest we simply add an "add search provider" button to the options dialog beside the existing list of providers to be selected as "default" which opens a file picker so the user can point to the XML file they have downloaded.  While we are there I also think we should expose the open in a browser hidden pref to the user so they can select if the search results are to be opened in a Thunderbird tab, or my preferred option, a browser tab.

Comment 1

a year ago
Yes, this is a good idea. For the record from bug 1427167 comment #5, you simply need to execute, for example:
Services.search.addEngine("file://C:/mozilla-source/mozilla-central/mobile/locales/searchplugins/drae.xml", null, "", {});
but supply a success/failure object in the last argument, like so:
https://dxr.mozilla.org/mozilla-central/rev/c2daa4c032b7f23a708a89237940ac8c49bba6cf/browser/base/content/test/about/head.js#177

Volunteers? Maybe a job for Richard?
Posted patch WIP (obsolete) — Splinter Review
This is a rough patch which has two issues.

1. After adding a search engine, we should update the menulist to see the new engine. I tried with this.updateWebSearch() but this only doubled the entries. The update needs to remove the old entries and reread the list. But this is above my knowledge.

2. I added the link to the search engines on AMO. But here we have two problems. With the actual link under thunderbird there are no search engines found. But with the Firefox link the page says, we are not with a Firefox browser on this page and I can't download an engine (is this not the open web?). This issue may be for Andrej or Philipp.

Comment 3

a year ago
Comment on attachment 8939403 [details] [diff] [review]
WIP

Looks like we need to set some flags here so it won't get ignored.
Attachment #8939403 - Flags: feedback?(jorgk)
Attachment #8939403 - Flags: feedback?(acelists)

Updated

a year ago
Attachment #8939403 - Flags: feedback?(jorgk)

Comment 4

6 months ago
We should move this forward. Please add the this.updateWebSearch() again with a comment. I'll take a look. We get too many users wanting to add their own engines.
Flags: needinfo?(richard.marti)
Okay, Updated to tip and used ATN addresses. ATN has no search engines actually.
Assignee: nobody → richard.marti
Flags: needinfo?(richard.marti)
Is this patch already implemented somewhere for beta testing?

Don't understand the meaning of the last phrase w/r of further action.

Comment 7

5 months ago
Not implemented anywhere yet. So far the patch doesn't work.

Comment 8

5 months ago
This almost works. Yes, it doubles up all the entries, but if you run "add from file" a second time, the one you previously added shows up.

We'd also need a remove button, I guess.
Attachment #8939403 - Attachment is obsolete: true
Attachment #9016772 - Attachment is obsolete: true
Attachment #8939403 - Flags: feedback?(acelists)

Comment 9

5 months ago
OK, this works now. We can add a search engine from a file. It's not automatically made the default.

Now we need a remove button. Richard, can you add that. Looks like the code in this patch isn't from the current version of FF, so perhaps get the remove button from wherever this code came from.

Andrei, what do you think of the "Find more search engines" link. If gives zero results. Should we just remove that for the time being?
Attachment #9026534 - Attachment is obsolete: true
Attachment #9026564 - Flags: feedback?(sancus)

Comment 10

5 months ago
Looking at the history of this bug, we really messed it up. This should have been landed in January 2018 in be included in TB 60 ESR. Now all we could do is use the 'browse.label' string in general.dtd for the "add from file". No idea where we would get a string for deletion from :-(
Yes, I think removing the link makes sense.

As far as I know, AMO never supported search tools for Thunderbird. I could be wrong about that. Certainly, it does not seem possible to upload a search tool that is compatible with Thunderbird, they in general don't have any compatibility data associated with them, and they don't show up in the Thunderbird part of the site at all, even though they are in the database. I mistakenly thought they were deleted as thunderbird only addons, but they haven't been. They're just not visible because they only show for Firefox.

People could download the XML files from addons.mozilla.org and install them that way, I guess. I don't have time to fix this on ATN this week and honestly I doubt that I can get to it before sometime in December at the earliest. I'm not even sure how much time it would take to fix.

Comment 12

5 months ago
This should do it. I removed the link and added a remove button which is disabled if there is only one search engine left.

Please check the access keys.
Attachment #9026564 - Attachment is obsolete: true
Attachment #9026564 - Flags: feedback?(sancus)
Attachment #9026583 - Flags: ui-review?(richard.marti)
Attachment #9026583 - Flags: review?(acelists)

Comment 13

5 months ago
Sorry, all the code related to the link can go now.
Attachment #9026583 - Attachment is obsolete: true
Attachment #9026583 - Flags: ui-review?(richard.marti)
Attachment #9026583 - Flags: review?(acelists)
Attachment #9026584 - Flags: ui-review?(richard.marti)
Attachment #9026584 - Flags: review?(acelists)

Comment 14

5 months ago
Hmm, not quite ready yet. Looks like you can't add the default engines once you've deleted them; try adding bing.xml after deleting it.

So perhaps we need to disallow deletion of the default set. We can use Services.search.getDefaultEngines(). Of course we need to drive the remove button differently then. Or we just unhide the default engine when it's added again. Maybe users want to delete a default engine because they hate it.
Attachment #9026584 - Attachment is obsolete: true
Attachment #9026584 - Flags: ui-review?(richard.marti)
Attachment #9026584 - Flags: review?(acelists)
Attachment #9026589 - Flags: feedback?(richard.marti)

Comment 15

5 months ago
I'm hijacking this, my patch is ready. We've discussed this in the TB Council yesterday and need to move this forward.
Assignee: richard.marti → jorgk
Status: NEW → ASSIGNED
Summary: Create our own, or Clone Firefox's , user interface to allow users to modify open search providers. → Enhance user interface to allow users to modify open search providers.

Comment 16

5 months ago
OK, I'm adding an add and a remove button. The remove button is disabled for default engines. That saves us having a restore button and more complicated logic to restore a removed default engine (since that's not really removed but only hidden).

Seems to work. We missed the boat for TB 60 which is really annoying. Richard, could you please prepare an ESR 60 patch without the string changes. Instead of "add" and "remove" we could use iconic buttons "+" and "-", or some other icons which in indicate that. Alternatively, for "add" we could use the browse string.
Attachment #9026589 - Attachment is obsolete: true
Attachment #9026589 - Flags: feedback?(richard.marti)
Attachment #9026638 - Flags: ui-review?(richard.marti)
Attachment #9026638 - Flags: review?(mkmelin+mozilla)

Comment 17

5 months ago
Hmm, looks like 'self' is not the right thing to use, although I've seen it used in similar occasions:
230:7  error  Read-only global 'self' should not be modified.  no-global-assign (eslint)
(Assignee)

Comment 18

5 months ago
Comment on attachment 9026638 [details] [diff] [review]
1427317-searchEngines.patch (v7)

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

Just clicking the "Add Search from file" crashes thunderbird for me

Re "self" - why do we we have a global self? That sounds pretty wrong.
You could probably just do .bind(this) though.
Attachment #9026638 - Flags: review?(mkmelin+mozilla) → review-
(Assignee)

Comment 19

5 months ago
Comment on attachment 9026638 [details] [diff] [review]
1427317-searchEngines.patch (v7)

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

::: mail/locales/en-US/chrome/messenger/preferences/general.dtd
@@ +37,5 @@
>  <!ENTITY browse.label                     "Browse…">
>  <!ENTITY browse.accesskey                 "B">
>  
>  <!ENTITY defaultSearchEngine.label        "Default Search Engine">
> +<!ENTITY addSearchEngine.label            "Add Search from file">

Maybe we should phrase this "Add Open Search Provider", and maybe let the user enter a URL where we'd grab or autodiscover it? Adding from a file will be non-intutitive

Comment 20

5 months ago
It crashes? That's surprising. I can add search engines from a file just fine and the same code appeared to the working for Richard when he started the patch. Can you tell why it's crashing? Hard for me to debug.

I'll find a solution for the 'self' issue.

As for the UI: We could do "Add Search Provider from file". The "from file" option was explicitly requested, see comment #0, last paragraph. Andrei suggests the same in comment #11. The people from bug 1427167 and bug 1427093 also want to add them from file. Don't let perfect be enemy of better ;-)
See Also: → 1427093
(Assignee)

Comment 21

5 months ago
Surprising yes. Anyway, I think it would be much more user friendly to pop up a dialog saying "Please visit the website for your desired search engine", and we'd autodiscover from there. It should be potentially just < 10 lines of code.

Thread 1 "thunderbird" received signal SIGSEGV, Segmentation fault.
nsFilePicker::Open (this=0x7f3d0166acc0, aCallback=<optimized out>)
    at /home/magnus/Code/tb/mozilla/widget/gtk/nsFilePicker.cpp:383
383	    GTK_WINDOW(mParentWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
(gdb) bt
#0  0x00007f3d27b9162e in nsFilePicker::Open(nsIFilePickerShownCallback*)
    (this=0x7f3d0166acc0, aCallback=<optimized out>)
    at /home/magnus/Code/tb/mozilla/widget/gtk/nsFilePicker.cpp:383
#1  0x00007f3d2568d4f2 in NS_InvokeByIndex ()
    at /home/magnus/Code/tb/mozilla/xpcom/reflect/xptcall/md/unix/xptcinvoke_asm_x86_64_unix.S:106
#2  0x00007f3d25fe3fce in CallMethodHelper::Invoke() (this=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/xpconnect/src/XPCWrappedNative.cpp:1735
#3  0x00007f3d25fe3fce in CallMethodHelper::Call() (this=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/xpconnect/src/XPCWrappedNative.cpp:1268
#4  0x00007f3d25fe3fce in XPCWrappedNative::CallMethod(XPCCallContext&, XPCWrappedNative::CallMode) (ccx=..., mode=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/xpconnect/src/XPCWrappedNative.cpp:1232
#5  0x00007f3d25fe53f0 in XPC_WN_CallMethod(JSContext*, unsigned int, JS::Value*) (cx=<optimized out>, argc=1, vp=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/xpconnect/src/XPCWrappedNativeJSOps.cpp:1020
#6  0x00007f3d29159fec in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), JS::CallArgs const&)
    (cx=<optimized out>, native=<optimized out>, args=...)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:468
#7  0x00007f3d29159fec in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct)
    (cx=0x7f3d1ed23800, args=..., construct=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:560
#8  0x00007f3d29153da4 in js::CallFromStack(JSContext*, JS::CallArgs const&)
    (cx=<optimized out>, args=...)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:620
#9  0x00007f3d29153da4 in Interpret(JSContext*, js::RunState&)
    (cx=<optimized out>, state=...)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:3462
#10 0x00007f3d2914bd3d in js::RunScript(JSContext*, js::RunState&)
    (cx=0x7f3d1ed23800, state=...)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:447
#11 0x00007f3d2915a339 in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct)
    (cx=0x7f3d1ed23800, args=..., construct=<optimized out>)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:587
#12 0x00007f3d2915a819 in js::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, js::AnyInvokeArgs const&, JS::MutableHandle<JS::Value>)
    (cx=0x0, fval=..., thisv=..., args=..., rval=...)
    at /home/magnus/Code/tb/mozilla/js/src/vm/Interpreter.cpp:633
#13 0x00007f3d2946018f in JS::Call(JSContext*, JS::Handle<JS::Value>, JS::Handle<JS::Value>, JS::HandleValueArray const&, JS::MutableHandle<JS::Value>)
    (cx=0x7f3d1ed23800, thisv=..., fval=..., args=..., rval=...)
    at /home/magnus/Code/tb/mozilla/js/src/jsapi.cpp:2988
#14 0x00007f3d26eb34b7 in mozilla::dom::EventHandlerNonNull::Call(JSContext*, JS::Handle<JS::Value>, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&) (this=
    0x7f3d016b8680, cx=0x7f3d1ed23800, aThisVal=..., event=..., aRetVal=..., aRv=...)
--Type <RET> for more, q to quit, c to continue without paging-- 
    at /home/magnus/Code/tb/mozilla/obj-x86_64-pc-linux-gnu/dom/bindings/EventHandlerBinding.cpp:265
#15 0x00007f3d27321b71 in mozilla::dom::EventHandlerNonNull::Call<nsISupports*>(nsISupports* const&, mozilla::dom::Event&, JS::MutableHandle<JS::Value>, mozilla::ErrorResult&, char const*, mozilla::dom::CallbackObject::ExceptionHandling, JS::Realm*) (this=0x7f3d016b8680, thisVal=<optimized out>, event=
    ..., aRetVal=..., aRv=..., aExecutionReason=<optimized out>, aExceptionHandling=mozilla::dom::CallbackObject::eReportExceptions, aRealm=0x0)
    at /home/magnus/Code/tb/mozilla/obj-x86_64-pc-linux-gnu/dist/include/mozilla/dom/EventHandlerBinding.h:363
#16 0x00007f3d2731d51e in mozilla::JSEventHandler::HandleEvent(mozilla::dom::Event*) (this=<optimized out>, aEvent=0x7f3d014eb560)
    at /home/magnus/Code/tb/mozilla/dom/events/JSEventHandler.cpp:214
#17 0x00007f3d2730c3a1 in mozilla::EventListenerManager::HandleEventSubType(mozilla::EventListenerManager::Listener*, mozilla::dom::Event*, mozilla::dom::EventTarget*)
    (this=0x7f3d05195ac0, aListener=0x7f3d051ad808, aDOMEvent=0x7f3d014eb560, aCurrentTarget=0x7f3d0a2bc310)
    at /home/magnus/Code/tb/mozilla/dom/events/EventListenerManager.cpp:1115
#18 0x00007f3d2730cc10 in mozilla::EventListenerManager::HandleEventInternal(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool) (this=<optimized out>, aPresContext=
    0x7f3d0a21d800, aEvent=<optimized out>, aDOMEvent=0x7ffc488ff5e0, aCurrentTarget=0x7f3d0a2bc310, aEventStatus=0x7ffc488ff5e8, aItemInShadowTree=<optimized out>) at /home/magnus/Code/tb/mozilla/dom/events/EventListenerManager.cpp:1317
#19 0x00007f3d27321085 in mozilla::EventListenerManager::HandleEvent(nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event**, mozilla::dom::EventTarget*, nsEventStatus*, bool)
    (this=<optimized out>, aPresContext=0x7f3d014d93c8, aEvent=
    0x7f3d014d93c8, aDOMEvent=0x8, aCurrentTarget=0x7f3d014d93c8, aEventStatus=0x7ffc488ff5e8, aItemInShadowTree=<optimized out>)
    at /home/magnus/Code/tb/mozilla/obj-x86_64-pc-linux-gnu/dist/include/mozilla/EventListenerManager.h:390
#20 0x00007f3d27321085 in mozilla::EventTargetChainItem::HandleEvent(mozilla::EventChainPostVisitor&, mozilla::ELMCreationDetector&)
    (this=<optimized out>, aVisitor=..., aCd=...)
    at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:425
#21 0x00007f3d27305ee5 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&)
    (aChain=..., aVisitor=..., aCallback=0x0, aCd=...)
    at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:642
#22 0x00007f3d27307452 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*)
    (aTarget=<optimized out>, aPresContext=0x7f3d0a21d800, aEvent=0x7f3d014eb6a0, aDOMEvent=0x7f3d014eb560, aEventStatus=0x7ffc488ff7f8, aCallback=0x0, aTargets=0x0) at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:1164
#23 0x00007f3d27308d4b in mozilla::EventDispatcher::DispatchDOMEvent(nsISupports*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsPresContext*, nsEventStatus*)
--Type <RET> for more, q to quit, c to continue without paging--
aPresContext=0x7f3d0a21d800, aEventStatus=0x7ffc488ff7f8) at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:1245
#24 0x00007f3d27cf3162 in mozilla::PresShell::HandleDOMEventWithTarget(nsIContent*, mozilla::dom::Event*, nsEventStatus*) (this=0x7f3d0a2aa000, aTargetContent=
    0x7f3d0a2bc310, aEvent=0x7f3d014eb560, aStatus=0x7ffc488ff7f8) at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:8129
#25 0x00007f3d2662ea61 in nsContentUtils::DispatchXULCommand(nsIContent*, bool, mozilla::dom::Event*, nsIPresShell*, bool, bool, bool, bool, unsigned short)
    (aTarget=0x7f3d0a2bc310, aTrusted=<optimized out>, aSourceEvent=0x0, aShell=0x7f3d0a2aa000, aCtrl=false, aAlt=<optimized out>, aShift=<optimized out>, aMeta=<optimized out>, aInputSource=1)
    at /home/magnus/Code/tb/mozilla/dom/base/nsContentUtils.cpp:6441
#26 0x00007f3d27edfed3 in nsButtonBoxFrame::MouseClicked(mozilla::WidgetGUIEvent*) (this=<optimized out>, aEvent=0x7ffc488ffde0) at /home/magnus/Code/tb/mozilla/layout/xul/nsButtonBoxFrame.cpp:215
#27 0x00007f3d27edfdd1 in nsButtonBoxFrame::HandleEvent(nsPresContext*, mozilla::WidgetGUIEvent*, nsEventStatus*) (this=
    0x7f3d0be74010, aPresContext=0x7f3d0a21d800, aEvent=0x7ffc488ffde0, aEventStatus=0x7ffc488ffae8) at /home/magnus/Code/tb/mozilla/layout/xul/nsButtonBoxFrame.cpp:171
#28 0x00007f3d27306157 in mozilla::EventTargetChainItem::HandleEventTargetChain(nsTArray<mozilla::EventTargetChainItem>&, mozilla::EventChainPostVisitor&, mozilla::EventDispatchingCallback*, mozilla::ELMCreationDetector&) (aChain=..., aVisitor=..., aCallback=0x7ffc488ffcf0, aCd=...) at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:707
#29 0x00007f3d27307452 in mozilla::EventDispatcher::Dispatch(nsISupports*, nsPresContext*, mozilla::WidgetEvent*, mozilla::dom::Event*, nsEventStatus*, mozilla::EventDispatchingCallback*, nsTArray<mozilla::dom::EventTarget*>*) (aTarget=<optimized out>, aPresContext=0x7f3d0a21d800, aEvent=0x7ffc488ffde0, aDOMEvent=0x0, aEventStatus=0x7ffc488ffed4, aCallback=0x7ffc488ffcf0, aTargets=0x0)
    at /home/magnus/Code/tb/mozilla/dom/events/EventDispatcher.cpp:1164
#30 0x00007f3d27cf3053 in mozilla::PresShell::DispatchEventToDOM(mozilla::WidgetEvent*, nsEventStatus*, nsPresShellEventCB*)
    (this=0x7f3d0a2aa000, aEvent=0x7ffc488ffde0, aStatus=0x7ffc488ffed4, aEventCB=<optimized out>) at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:7995
#31 0x00007f3d27cf13bc in mozilla::PresShell::HandleEventInternal(mozilla::WidgetEvent*, nsEventStatus*, bool, nsIContent*)
    (this=0x7f3d0a2aa000, aEvent=0x7ffc488ffde0, aStatus=0x7ffc488ffed4, aIsHandlingNativeEvent=false, aOverrideClickTarget=0x0) at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:7733
#32 0x00007f3d27cf0714 in mozilla::PresShell::HandleEventWithTarget(mozilla::WidgetEvent*, nsIFrame*, nsIContent*, nsEventStatus*, bool, nsIContent**, nsIContent*)
    (this=0x7f3d0a2aa000, aEvent=0x7ffc488ffde0, aFrame=
    0x56445c79857a <mozilla::TimeStamp::Now(bool)+42>, aContent=0x7f3d0a2bc310, aStatus=0x7ffc488ffed4, aIsHandlingNativeEvent=<optimized out>, aTargetContent=0x0, aOverrideClickTarget=0x0)
    at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:7518
#33 0x00007f3d272e7869 in mozilla::EventStateManager::InitAndDispatchClickEvent(mozilla::WidgetMouseEvent*, nsEventStatus*, mozilla::EventMessage, nsIPresShell*, nsIContent*, AutoWeakFrame, bool, nsIContent*)
    (aMouseUpEvent=0x7ffc48900370, aStatus=0x7ffc488ffff4, aMessage=mozilla::EventMessage::eMouseClick, aPresShell=0x7f3d0a2aa000, aMouseUpContent=0x7f3d0a2bc310, aCurrentTarget=..., aNoContentDispatch=<optimized out>, aOverrideClickTarget=0x0) at /home/magnus/Code/tb/mozilla/dom/events/EventStateManager.cpp:5033
#34 0x00007f3d272e79e1 in mozilla::EventStateManager::DispatchClickEvents(nsIPresShell*, mozilla::WidgetMouseEvent*, nsEventStatus*, nsIContent*, nsIContent*)
    (this=<optimized out>, aPresShell=0x7f3d0a2aa000, aMouseUpEvent=0x7ffc48900370, aStatus=0x7ffc488ffff4, aMouseUpContent=0x7f3d0a2bc310, aOverrideClickTarget=0x0)
    at /home/magnus/Code/tb/mozilla/dom/events/EventStateManager.cpp:5150
#35 0x00007f3d272e5ab4 in mozilla::EventStateManager::PostHandleMouseUp(mozilla::WidgetMouseEvent*, nsEventStatus*, nsIContent*) (this=
    0x7f3d1202e700, aMouseUpEvent=<optimized out>, aStatus=0x7ffc489002dc, aOverrideClickTarget=0x0) at /home/magnus/Code/tb/mozilla/dom/events/EventStateManager.cpp:5088
#36 0x00007f3d272e4c34 in mozilla::EventStateManager::PostHandleEvent(nsPresContext*, mozilla::WidgetEvent*, nsIFrame*, nsEventStatus*, nsIContent*)
    (this=<optimized out>, aPresContext=<optimized out>, aEvent=<optimized out>, aTargetFrame=<optimized out>, aStatus=<optimized out>, aOverrideClickTarget=<optimized out>)
    at /home/magnus/Code/tb/mozilla/dom/events/EventStateManager.cpp:3405
#37 0x00007f3d27cf14dc in mozilla::PresShell::HandleEventInternal(mozilla::WidgetEvent*, nsEventStatus*, bool, nsIContent*)
    (this=0x7f3d0a2aa000, aEvent=0x7ffc48900370, aStatus=0x7ffc489002dc, aIsHandlingNativeEvent=true, aOverrideClickTarget=0x0) at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:7753
#38 0x00007f3d27cf02bf in mozilla::PresShell::HandleEvent(nsIFrame*, mozilla::WidgetGUIEvent*, bool, nsEventStatus*)
    (this=<optimized out>, aFrame=0x7f3d13d98020, aEvent=<optimized out>, aDontRetargetEvents=false, aEventStatus=0x7ffc489002dc) at /home/magnus/Code/tb/mozilla/layout/base/PresShell.cpp:7343
#39 0x00007f3d27b1c306 in nsViewManager::DispatchEvent(mozilla::WidgetGUIEvent*, nsView*, nsEventStatus*) (this=<optimized out>, aEvent=0x7ffc48900370, aView=<optimized out>, aStatus=0x7ffc489002dc)
    at /home/magnus/Code/tb/mozilla/view/nsViewManager.cpp:812
#40 0x00007f3d27b1c0e4 in nsView::HandleEvent(mozilla::WidgetGUIEvent*, bool) (this=<optimized out>, aEvent=0x7ffc48900370, aUseAttachedEvents=<optimized out>)
    at /home/magnus/Code/tb/mozilla/view/nsView.cpp:1141
#41 0x00007f3d27b5cfa4 in nsWindow::DispatchEvent(mozilla::WidgetGUIEvent*, nsEventStatus&) (this=<optimized out>, aEvent=0x7f3d014d93c8, aStatus=@0x7ffc48900328: nsEventStatus_eIgnore)
    at /home/magnus/Code/tb/mozilla/widget/gtk/nsWindow.cpp:581
#42 0x00007f3d27b24497 in nsBaseWidget::DispatchInputEvent(mozilla::WidgetInputEvent*) (this=0x7f3d1780b000, aEvent=0x7ffc48900370) at /home/magnus/Code/tb/mozilla/widget/nsBaseWidget.cpp:1241
#43 0x00007f3d27b64c5b in nsWindow::OnButtonReleaseEvent(_GdkEventButton*) (this=0x7f3d1780b000, aEvent=0x7f3d014eb600) at /home/magnus/Code/tb/mozilla/widget/gtk/nsWindow.cpp:2865
#44 0x00007f3d27b6943c in button_release_event_cb(_GtkWidget*, _GdkEventButton*) (widget=<optimized out>, event=0x7f3d014eb600) at /home/magnus/Code/tb/mozilla/widget/gtk/nsWindow.cpp:5866
#45 0x00007f3d2ef802cb in  () at /usr/lib/x86_64-linux-gnu/libgtk-3.so.0
#46 0x00007f3d2df7eb6d in g_closure_invoke () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#47 0x00007f3d2df918f3 in  () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0
#48 0x00007f3d2df99f43 in g_signal_emit_valist () at /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0

Comment 22

5 months ago
Hmm, I tell "New to Bugzilla" people to not SPAM comments with debug, and here we have SPAM from the TB module owner :-(

Seriously, the first few lines to "#1  0x00007f3d2568d4f2 in NS_InvokeByIndex ()" would have sufficed, from that we can see that the file picker crashed somehow.

I think an "add from file" is needed, I have XML files with search engine definitions and it's apparently easy to get them from AMO. As I said, don't let perfect be enemy of better. Once this lands, feel free to add your additional 10 lines, the framework will then be in place.

Comment 23

5 months ago
Crash fixed by added init call. Self problem solved by adding 'let'.

We already have two authors here, so Magnus, if you want to add 10 lines that let people get the search engine from some web site, add it to the patch, submit a part 2 or do it in a new bug.
Attachment #9026638 - Attachment is obsolete: true
Attachment #9026638 - Flags: ui-review?(richard.marti)
Attachment #9026672 - Flags: ui-review?(richard.marti)
Attachment #9026672 - Flags: review?(mkmelin+mozilla)
Comment on attachment 9026672 [details] [diff] [review]
1427317-searchEngines.patch (v8)

Yes, keep it simple and use the "Add Search from file". If we could add a link then oka, but asking for a link is too complicated.

I tested the patch under Linux too and it doesn't crash.
Attachment #9026672 - Flags: ui-review?(richard.marti) → ui-review+
(Reporter)

Comment 25

5 months ago
Is there a build of this that I can try out... having just had the google search disappear I am lost as to how to get it back.

Comment 26

5 months ago
No, there isn't. Sadly this is not waiting for Magnus since he didn't like our solution.
(Assignee)

Comment 27

5 months ago
This is adding the search engine by entering a search engine URL, which is something a normal user could figure out, with some luck. The OpenSearch support seems way worse than I thought though... but you can add bugzilla, wikipedia, and company internal searches - so at least it's flexible. The bugzilla entry could actually be somewhat useful for bugmail processing.
(Assignee)

Comment 28

5 months ago
The patch from comment 27 works, but not if the preferences pane is loaded through about:preferences, since  I'm using a normal fetch() - which is blocked by not having CSP for this (still) XUL page. 

I think bug 965637 will enable having a CSP for it, but nonetheless, I'm somewhat confused about the purpose of the CSP (or rather lack of such) blocking this fetch, given this is all chrome code. Chris, is that on purpose?

Yes, I could use other ways to fetch(), but I'd prefer not to.
Flags: needinfo?(ckerschb)

Comment 29

5 months ago
I think you should not allow removal of the default engines since it might be hard to restore them, see my patch. Add works with a file: URL, so that's OK.
Attachment #9030077 - Attachment is obsolete: true
(Reporter)

Comment 30

5 months ago
While I could see issues that might be created by removing a last search provider,  I think allowing users to remove the ones that they do not want would hurt nothing.  I am unlikely to ever use a search on amazon.com.  I have never made a purchase there and can not see that changing.  Twitter is about as useful as horns on a table so I can see users wanting to clean up that mess.  

Having said that I particularly like Magnus idea of entering a URL.  Getting the XML file is really a messy process, with most providers offering it but not offering it in a way fireox will offer to download it,  leaving you to scrape the display screen with a copy and paste to make you own text file.  This is unnecessarily complex as opensearch offer discover-ability from the base URL.  We should be using that.

Given we default to Bing as a provider and still have not managed to add Google or DuckDuckGo we are really not helping our cause by making the process an more difficult than it has to be.
(In reply to Magnus Melin [:mkmelin] from comment #28)
> The patch from comment 27 works, but not if the preferences pane is loaded
> through about:preferences, since  I'm using a normal fetch() - which is
> blocked by not having CSP for this (still) XUL page. 
> 
> I think bug 965637 will enable having a CSP for it, but nonetheless, I'm
> somewhat confused about the purpose of the CSP (or rather lack of such)
> blocking this fetch, given this is all chrome code. Chris, is that on
> purpose?
> 
> Yes, I could use other ways to fetch(), but I'd prefer not to.

Sorry, I can't completely follow what you mean. If
a) CSP is blocking a load that it shouldn't, then please provide log from the web console (please also check browser console) and if possible the CSP for that page.
b) there is no CSP on something where we should have a CSP, then please let me know where.

Within bug 965637 we are moving the CSP from the Principal into the client, but that should not affect anything that's currently in the tree. So if it's blocked currently, it will be blocked in the future and vice versa.
Flags: needinfo?(ckerschb)

Comment 32

4 months ago
Richard, this is not progressing well. Once big point of critique is that TB doesn't allow adding search providers. I'd like to ship something like "1427317-searchEngines.patch (v8)" minus the string changes in TB 60.5 at the end of January 2019.

I suggest to rebase the patch for c-esr60 and replace the "Add" and "Remove" buttons with "+" and "-".
getElementById("bundlePreferences").getString("searchEngine ...") would just be replaced by "". Not ideal, but working.

Could you look into this or should I do the rebasing first?
Flags: needinfo?(richard.marti)
(Assignee)

Comment 33

4 months ago
Why the rush? It never had the ability in the 10 yrs it featured search engines. They are just as possible to add now as they always were.

Comment 34

4 months ago
I wish you were right, but you are wrong. Please read comment #0 to know why we are here. The hacky manual method doesn't work anymore, see bug 1427167 comment #0.

I came to this bug today since it was reiterated on the Council mailing list that the lack of DuckDuckGo and Google is still very much criticised (bug 1427133), hence what you call "rush".

There's also the concept of retrofitting much needed functionality into the current ESR release, which fortunately we're doing now, for example with WeTransfer and OWL. I know people who are still on TB 52 since their add-ons doen't work on TB 60. So how many people to you think will stick to TB 60 once TB 68 comes around?

May I suggest that you implement the "bells and whistles" solution on trunk and ESR 68 and let me manage ESR 60 in the meantime.

Comment 37

4 months ago
Comment on attachment 9033719 [details] [diff] [review]
1427317-searchEngines.patch - ESR 60 version without string changes (v2)

This works now. The UI isn't brilliant, but better than nothing.
Attachment #9033719 - Flags: review?(richard.marti)
Comment on attachment 9033719 [details] [diff] [review]
1427317-searchEngines.patch - ESR 60 version without string changes (v2)

This looks good as far as the UI is limited with the string freeze. It's not a completely new UI as we use the '+' and '-' buttons already in Message Filters.

Shouldn't we get this bug landed also in Daily and beta? But the patch for this needs a rebasing.
Attachment #9033719 - Flags: review?(richard.marti) → review+

Comment 39

4 months ago
(In reply to Richard Marti (:Paenglab) from comment #38)
> Shouldn't we get this bug landed also in Daily and beta? But the patch for
> this needs a rebasing.
I don't know. The patch for trunk is awaiting review for more than a month now since Magnus had a better/different idea which is stalled. I'll rebase it now, then Magnus can decide. As you know, he sees no need to rush this when there is :-(

Comment 40

4 months ago
Magnus, can you please let us know how to proceed here?
Attachment #9026672 - Attachment is obsolete: true
Attachment #9026672 - Flags: review?(mkmelin+mozilla)
Attachment #9033743 - Flags: ui-review+
Attachment #9033743 - Flags: review?(mkmelin+mozilla)

Comment 41

4 months ago
I didn't like the big buttons, so Richard suggested to use
  style="min-width: 3em;"

I've tried it in the inspector and 2.5em seems best.
Attachment #9033719 - Attachment is obsolete: true
Attachment #9033747 - Flags: review+

Comment 44

4 months ago
Grrrr, currentEngine was renamed to defaultEngine in bug 1510936 :-(
Attachment #9033743 - Attachment is obsolete: true
Attachment #9033743 - Flags: review?(mkmelin+mozilla)
Attachment #9033804 - Flags: ui-review+
Attachment #9033804 - Flags: review?(mkmelin+mozilla)

Comment 45

4 months ago
TB 65 beta 2, follow-up, rename currentEngine to defaultEngine:
https://hg.mozilla.org/releases/comm-beta/rev/636f744e5be4cc85e4c8438b8b87dbe5c3e8beee
(Assignee)

Comment 46

4 months ago
Comment on attachment 9033804 [details] [diff] [review]
1427317-searchEngines.patch (v9)

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

Since there's nothing more permanent than a temporary fix, I'd rather not take this on trunk. 
It doesn't even give any clue about what the xml file might be so an end user could not figure this out without reading the source code. Really bad UI in other words.
Then on the other hand, even if this feature is as requested as you say, I dare say it'd be just better to add the few missing engines instead. That's what the users really are after.

Anyway, the patch adding by URL does work (after all) and has little disadvantages. I'll finish it soon.

::: mail/locales/en-US/chrome/messenger/preferences/preferences.properties
@@ +57,5 @@
>  soundFilesDescription=Sound Files
>  
> +#### Search Engine Picker
> +searchEnginePickerTitle=Choose Seach Engine
> +searchEngineType=Seach Engine

missing some r's
Attachment #9033804 - Flags: review?(mkmelin+mozilla) → review-

Comment 47

4 months ago
(In reply to Magnus Melin [:mkmelin] from comment #46)
> Then on the other hand, even if this feature is as requested as you say, I
> dare say it'd be just better to add the few missing engines instead. That's
> what the users really are after.
That would be useful, too: Bug 1427133. However, there are soooo many search engines around that adding those two won't make everyone happy.

Comment 48

4 months ago
Doing bug 1427133 now. Happy? If users already find the search engines they want, they won't have to use the "really bad UI".

Updated

4 months ago
Assignee: jorgk → mkmelin+mozilla

Comment 49

3 months ago

TB 66 beta:
https://treeherder.mozilla.org/#/jobs?repo=comm-beta&revision=b5802d8134e455897eac08e7750f2139ef3335aa
Merged patch of what went into TB 65 beta.

Magnus, when can we expect this to be landed. Too late now for TB 66 beta, so I need to uplift the solution you don't like again :-(

Flags: needinfo?(mkmelin+mozilla)

Comment 50

a month ago

(Posted the wrong link)
TB 66 beta:
https://hg.mozilla.org/releases/comm-beta/rev/b5802d8134e455897eac08e7750f2139ef3335aa

Magnus, when can we expect this to be landed. Too late now for TB 67 beta, so I need to uplift the solution you don't like again :-( - And it needs heavy rebasing due to bug 1492475 / bug 1524593.

Comment 51

a month ago

This applies to trunk at version 68 on 2019-03-23 and beta 67.

Magnus, you will have to rebase your patch accordingly. Note that engines are now compared by name, like here:
https://searchfox.org/mozilla-central/diff/481ae95c00e75189f71159fc61c9a1af771d112e/browser/components/extensions/parent/ext-search.js#57

Comment 52

a month ago

Played around with this some more, this works, too.
I'm not sure what the difference is between the attribute and the async getter/setter:
https://searchfox.org/mozilla-central/rev/4eaf7c637a303e0f7adcf1ae45064b2d4bef9eb0/toolkit/components/search/nsISearchService.idl#450

Attachment #9053065 - Attachment is obsolete: true

Comment 54

6 days ago

This is like the TB 67 version but with the strings. I also found a bug in TB 60 and TB 67 for which I'll push a fix in order not to forget.

Attachment #9033804 - Attachment is obsolete: true
Flags: needinfo?(mkmelin+mozilla)
Attachment #9059090 - Flags: review?(richard.marti)
Comment on attachment 9059090 [details] [diff] [review]
1427317-searchEngines-68.patch (v10)

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

::: mail/locales/en-US/chrome/messenger/preferences/preferences.properties
@@ +56,5 @@
>  soundFilePickerTitle=Choose Sound
>  
> +#### Search Engine Picker
> +searchEnginePickerTitle=Choose Search Engine
> +searchEngineType=Search Engine

Where are this strings used? I don't find them in the code and also see them not in the file picker.

Comment 57

6 days ago

Sigh, those strings got lost due to the various versions of the patch. Here they are again.

Edit: See interdiff: https://bugzilla.mozilla.org/attachment.cgi?oldid=9059090&action=interdiff&newid=9059203&headers=1

Attachment #9059090 - Attachment is obsolete: true
Attachment #9059090 - Flags: review?(richard.marti)
Attachment #9059203 - Flags: review?(richard.marti)
Comment on attachment 9059203 [details] [diff] [review]
1427317-searchEngines-68.patch (v10b)

Thanks.
Attachment #9059203 - Flags: review?(richard.marti) → review+
You need to log in before you can comment on or make changes to this bug.