Closed
Bug 790898
Opened 12 years ago
Closed 11 years ago
Match desktop in restrictions for "Add Search Engine" option
Categories
(Firefox for Android Graveyard :: General, defect)
Tracking
(firefox16 affected, firefox17 affected, firefox18 affected)
RESOLVED
FIXED
Firefox 28
People
(Reporter: xti, Assigned: retornam)
References
Details
(Whiteboard: [mentor=liuche])
Attachments
(2 files, 3 obsolete files)
120.55 KB,
image/png
|
Details | |
2.16 KB,
patch
|
Details | Diff | Splinter Review |
Firefox 18.0a1 (2012-09-12)
Device: Galaxy Note
OS: Android 4.0.4
Steps to reproduce:
1. Open Firefox for Android
2. Go to about:feedback and tap on I have an idea
3. Long tap on the text field
Expected result:
Add Search Engine is not displayed in the context options.
Actual result:
After step 3, when context menu is triggered, Add Search Engine option is listed as you can see in the attached screenshot. Nothing happens if it is tapped.
Reporter | ||
Comment 1•12 years ago
|
||
Comment 3•11 years ago
|
||
Desktop also supports adding search engines for most form fields, but has more restrictions than Android.
We should at least match Desktop in the checks we do.
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/nsContextMenu.js#1486
Whiteboard: [mentor=liuche]
Updated•11 years ago
|
Summary: Add restrictions for "Add Search Engine" option → Match desktop in restrictions for "Add Search Engine" option
Comment 4•11 years ago
|
||
The desktop link is bitrotted, but the checks are in "isTargetAKeywordField", and the relevant Android code is in mobile/android/chrome/content/browser.js, at the "filter" function in SearchEngines.init() [1].
[1] http://mxr.mozilla.org/mozilla-central/source/mobile/android/chrome/content/browser.js#6642
Comment 5•11 years ago
|
||
Wes or Brian, or whomever - I think I might have a mentee who's interested in working on this bug, but since I'll be on away for 2 weeks, can you keep an eye on this and help them out if they need it? Thanks!
Flags: needinfo?(wjohnston)
Assignee | ||
Comment 6•11 years ago
|
||
Assignee | ||
Updated•11 years ago
|
Attachment #8341199 -
Flags: review?(wjohnston)
Assignee | ||
Updated•11 years ago
|
Assignee: nobody → mozbugs.retornam
Assignee | ||
Updated•11 years ago
|
Attachment #8341199 -
Flags: review?(wjohnston) → review?(margaret.leibovic)
Comment 7•11 years ago
|
||
Comment on attachment 8341199 [details] [diff] [review]
bug-790898.patch
Review of attachment 8341199 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for taking this on! This is a good start, but it looks like we're still missing some checks that desktop does. Here's a better link to that code:
http://hg.mozilla.org/mozilla-central/file/4bf430d990e5/browser/base/content/nsContextMenu.js#l1503
::: mobile/android/chrome/content/browser.js
@@ +6642,5 @@
> let filter = {
> matches: function (aElement) {
> + if (!(aElement instanceof HTMLInputElement))
> + return false;
> + else {
You don't need an else statement after a return.
@@ +6643,5 @@
> matches: function (aElement) {
> + if (!(aElement instanceof HTMLInputElement))
> + return false;
> + else {
> + return (aElement.form && NativeWindow.contextmenus.textContext.matches(aElement));
This NativeWindow.contextmenus check is somewhat redundant with the `instanceof HTMLInputElement` check above. I think we should just go ahead and replace the body of this `matches` function with the body of desktop's `isTargetAKeywordField` function (and add a comment saying that's where we got that logic from).
Attachment #8341199 -
Flags: review?(margaret.leibovic) → review-
Updated•11 years ago
|
Flags: needinfo?(wjohnston)
Assignee | ||
Comment 8•11 years ago
|
||
Attachment #8341199 -
Attachment is obsolete: true
Attachment #8342512 -
Flags: review?(margaret.leibovic)
Assignee | ||
Comment 9•11 years ago
|
||
Attachment #8342512 -
Attachment is obsolete: true
Attachment #8342512 -
Flags: review?(margaret.leibovic)
Assignee | ||
Updated•11 years ago
|
Attachment #8342541 -
Flags: review?(margaret.leibovic)
Comment 10•11 years ago
|
||
Comment on attachment 8342541 [details] [diff] [review]
bug-790898.patch
Review of attachment 8342541 [details] [diff] [review]:
-----------------------------------------------------------------
Nice, this looks good. I just have a few small issues to address before we land this.
::: mobile/android/chrome/content/browser.js
@@ +6629,5 @@
>
> let filter = {
> matches: function (aElement) {
> + //Copied over from body of isTargetAKeywordField
> + //function in nsContextMenu.js
Nit: This could all be one line, and you should add a space after the // before the text (e.g. // Copied...)
@@ +6632,5 @@
> + //Copied over from body of isTargetAKeywordField
> + //function in nsContextMenu.js
> + if(!(aElement instanceof HTMLInputElement))
> + return false;
> + var form = aElement.form;
Nit: Looks like you accidentally put 2 spaces after var. And please include an empty line above this line.
We can also update this code to use `let` instead of `var` (the code in nsContextMenu.js was written before `let` existed).
Attachment #8342541 -
Flags: review?(margaret.leibovic) → review+
Assignee | ||
Comment 11•11 years ago
|
||
Attachment #8342541 -
Attachment is obsolete: true
Comment 12•11 years ago
|
||
Thanks for the patch!
https://hg.mozilla.org/integration/fx-team/rev/a7f8d2324426
Keywords: checkin-needed
Updated•11 years ago
|
Keywords: checkin-needed
Comment 13•11 years ago
|
||
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 28
Updated•4 years ago
|
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•