Closed
Bug 1062257
Opened 11 years ago
Closed 11 years ago
Handle HomeFragment deletions by panel/type instead of universally
Categories
(Firefox for Android Graveyard :: Awesomescreen, defect)
Tracking
(firefox32 wontfix, firefox33+ verified, firefox34+ verified, firefox35 verified, firefox-esr31 unaffected, fennec33+)
VERIFIED
FIXED
Firefox 35
People
(Reporter: JanH, Assigned: liuche)
References
Details
Attachments
(2 files, 2 obsolete files)
|
17.69 KB,
patch
|
liuche
:
review+
lmandel
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
|
17.65 KB,
patch
|
liuche
:
review+
Sylvestre
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
Steps to reproduce:
1. Use a mobile device that is synced to a desktop machine.
2. Create a bookmark on the desktop.
3a. Visit the page on mobile so it appears in the history list.
3b. Alternatively, you might have an already existing entry in your top sites list, which has a corresponding bookmark on your desktop machine. Or you might find some other way to make a desktop bookmark show up on the Top Sites page on your mobile device.
4. On the history respectively Top Sites page, delete that entry via the context menu.
5. Make sure that Sync has handled your actions both on the mobile device and on the desktop machine.
What happens:
Not only has the history/Top Sites entry disappeared (as it should) but the corresponding bookmark is gone, too, both on mobile *and* desktop.
What should happen:
Bookmarks should remain unaffected by deleting history or especially Top Sites entries.
I understand this behaviour changed as part of bug 913457, however I'm still not sure whether I'm really happy about it, for two reasons:
- On Desktop, you can prevent a page from showing up in about:newtab (or delete its history entries for that instance, although I'm mainly concerned about the Top Sites page) without affecting its bookmarks, so my expectation is that you could do the same thing on Mobile's Top Sites page, which seems to be equivalent of about:newtab.
- While Sync is very useful (and one of the reasons I started using Firefox on my phone), it has the side effect that my Top Sites page is partly dominated by my desktop browsing behaviour. Now two things come into play:
1. There are some pages on Desktop which I've removed from the about:newtab page, and I'd like to remove them from the Top Sites page as well.
2. There are some pages I frequently use on Desktop (and therefore they get pushed onto the Top Sites page through Sync), but rarely need on my phone, so I'd like to remove them as well.
This new behaviour means I can't delete those entries without removing their bookmarks as well, and because of Sync, including their bookmarks on my desktop machine.
My device:
FF32 on Samsung Galaxy S3 Mine, Android 4.1.2
Comment 1•11 years ago
|
||
> Bookmarks should remain unaffected by deleting history or especially Top Sites entries.
Agree entirely!
Related issue: Bug 771278.
Updated•11 years ago
|
tracking-fennec: --- → ?
Hardware: ARM → All
Comment 2•11 years ago
|
||
This was done on purpose in bug 913457, but in triage we decided this was a mistake, and we shouldn't be deleting the bookmark.
Yuan, what do you think?
Lucas or Chenxia, can one of you take this?
Blocks: 913457
Status: UNCONFIRMED → NEW
tracking-fennec: ? → 32+
Ever confirmed: true
Flags: needinfo?(ywang)
Flags: needinfo?(lucasr.at.mozilla)
Flags: needinfo?(liuche)
| Assignee | ||
Updated•11 years ago
|
Assignee: nobody → liuche
Flags: needinfo?(liuche)
Comment 3•11 years ago
|
||
I agree that bookmarks shouldn't be affected by deleting browsing history or deleting Top Sites.
Deleting a top site is often driven by making space for another site that's more useful. That doesn't indicate the original site doesn't have value any more.
Deleting history is often for privacy concerns. If the users were concerned about a certain site being remembered by the browser, they wouldn't bookmark it at the first place.
Flags: needinfo?(ywang)
| Assignee | ||
Updated•11 years ago
|
Summary: Deleting an entry from 'Top Sites' or History deletes bookmark entry, including Desktop bookmarks → Handle HomeFragment deletions by panel/type instead of universally
Comment 4•11 years ago
|
||
liuche took it (thanks!), clearing NEEDINFO.
Flags: needinfo?(lucasr.at.mozilla)
| Assignee | ||
Comment 5•11 years ago
|
||
So this turned out to be more complex than I initially thought, partly because we can't just remove bookmark/history/reading list in one code path anymore.
Also, the way the Android FragmentManager handles sending context menu clicks is to iterate through *each* fragment. So we actually need to handle within each fragment whether or not we want to handle the ContextMenu click. This took me a while to figure out because I assumed it was something we were doing...
Anyways, I used flags for RemoveItemByUrl because that way, we can decide to OR them if we want to do multiple removals, and we need some sort of flag to differentiate to RemoveItemByUrl anyways now that the removal behavior is panel-specific.
Attachment #8486877 -
Flags: feedback?(margaret.leibovic)
Comment 6•11 years ago
|
||
Comment on attachment 8486877 [details] [diff] [review]
Patch: remove home panel list items by panel
Review of attachment 8486877 [details] [diff] [review]:
-----------------------------------------------------------------
Sigh, this context menu code is always so hard to understand. I think we should really try to avoid extra layers of complexity if we can. I would really like to see if we can just set a "this is what you should remove" flag directly on the context menu info, rather than setting a panel type that gets passed along to a removeItem method implementation.
It would be extra nice if instead of explictly setting what thing to remove, we could just rely on bookmark/history ids for that, but that might not work for reading list items. I also don't want to scope creep this bug to change the details of how we remove items, unless that might make it easier to actually fix this bug.
It seems to me like we could try going back to something closer to what was there before this patch happened:
https://hg.mozilla.org/mozilla-central/rev/41548309c22f
::: mobile/android/base/home/HistoryPanel.java
@@ +96,5 @@
> final HomeContextMenuInfo info = new HomeContextMenuInfo(view, position, id);
> info.url = cursor.getString(cursor.getColumnIndexOrThrow(Combined.URL));
> info.title = cursor.getString(cursor.getColumnIndexOrThrow(Combined.TITLE));
> info.historyId = cursor.getInt(cursor.getColumnIndexOrThrow(Combined.HISTORY_ID));
> + info.panelType = PanelType.HISTORY;
Instead of keeping track of a panelType in the HomeContextMenuInfo, and then checking it in removeItem, could you instead set a flag on the HomeContextMenuInfo that indicates what thing should be removed?
We used to do this by keeping track of whether or not the info had specific ids, like historyId or bookmarkId. For example, in the bookmarks panel, the items won't have a history id, so we shouldn't be able to remove them from history.
@@ +196,5 @@
> + protected boolean removeItem(Context context, HomeContextMenuInfo info) {
> + if (info.panelType != PanelType.HISTORY) {
> + return false;
> + }
> + (new RemoveItemByUrlTask(context, info.url, FLAG_TYPE_HISTORY)).execute();
Now that we're not removing the world, we should be able to go back to removing the item by id. That should help only remove the thing the user is trying to remove.
::: mobile/android/base/home/HomeFragment.java
@@ +62,5 @@
>
> + // Flags for removal type.
> + protected static final int FLAG_TYPE_HISTORY = 0x001;
> + protected static final int FLAG_TYPE_BOOKMARK = 0x010;
> + protected static final int FLAG_TYPE_READING_LIST = 0x100;
I don't see the need for bit-wise flags here, since it doesn't look like you ever combine any of these.
@@ +332,5 @@
> load();
> mIsLoaded = true;
> }
>
> + protected static class RemoveItemByUrlTask extends UIAsyncTask.WithoutParams<Void> {
As I mentioned in a previous comment, can we get rid of RemoveItemByUrlTask and just go back to directly removing items by id?
Attachment #8486877 -
Flags: feedback?(margaret.leibovic) → feedback-
Updated•11 years ago
|
tracking-fennec: 32+ → ?
| Assignee | ||
Comment 7•11 years ago
|
||
Attachment #8486877 -
Attachment is obsolete: true
Attachment #8488463 -
Flags: review?(margaret.leibovic)
| Assignee | ||
Comment 8•11 years ago
|
||
> As I mentioned in a previous comment, can we get rid of RemoveItemByUrlTask
> and just go back to directly removing items by id?
The old code actually used Remove*Task as well - we just had 3 of them, for bookmarks, reading list items, and history. Since the callback code is the same, we should just have one Remove*Task that handles an item type that's passed in.
Comment 9•11 years ago
|
||
Comment on attachment 8488463 [details] [diff] [review]
Patch: remove home panel list items by type v2
Review of attachment 8488463 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks, I think this is much better. I just have one main review comment about cleaning up the logic in the home_remove handler.
::: mobile/android/base/home/BookmarksPanel.java
@@ +17,5 @@
> import org.mozilla.gecko.home.HomePager.OnUrlOpenListener;
>
> import android.app.Activity;
> import android.content.Context;
> +import android.content.res.Configuration;
Nit: Unused import.
::: mobile/android/base/home/HistoryPanel.java
@@ +18,5 @@
> import org.mozilla.gecko.db.BrowserContract.Combined;
> import org.mozilla.gecko.db.BrowserContract.History;
> import org.mozilla.gecko.db.BrowserDB;
> +import org.mozilla.gecko.home.HomeContextMenuInfo.ItemType;
> +import org.mozilla.gecko.home.HomeFragment.RemoveItemByUrlTask;
Nit: Remove unused import.
::: mobile/android/base/home/HomeContextMenuInfo.java
@@ +26,5 @@
> public int readingListItemId = -1;
> + public ItemType itemType = null;
> +
> + public static enum ItemType {
> + BOOKMARKS, HISTORY, READING_LIST
Nit: Add a comment indicating that this is used to determine what to remove when the "Remove" context menu item is selected. Or maybe we should even rename this RemoveItemType? I just want to make sure it's not confusing that top sites items have a HISTORY item type.
::: mobile/android/base/home/HomeFragment.java
@@ +266,1 @@
> return true;
Now that we're keeping track of the item type, we could check for that instead of checking hasHistoryId/hasBookmarkId/isInReadingList.
Or actually, since all of these calls are just passing itemType along to the remove task to evaluate, we could just get rid of the if statements.
@@ +396,4 @@
>
> + GeckoEvent e = GeckoEvent.createBroadcastEvent("Reader:Remove", json.toString());
> + GeckoAppShell.sendEventToGecko(e);
> + break;
Nice, this is really clear :)
::: mobile/android/base/home/RecentTabsPanel.java
@@ +18,5 @@
> import org.mozilla.gecko.Telemetry;
> import org.mozilla.gecko.TelemetryContract;
> import org.mozilla.gecko.db.BrowserContract.CommonColumns;
> import org.mozilla.gecko.db.BrowserContract.URLColumns;
> +import org.mozilla.gecko.home.HomeContextMenuInfo.ItemType;
Is this import necessary?
Attachment #8488463 -
Flags: review?(margaret.leibovic) → review+
| Assignee | ||
Comment 10•11 years ago
|
||
Carrying over r+, will land when tree opens.
Attachment #8488463 -
Attachment is obsolete: true
Attachment #8488909 -
Flags: review+
| Assignee | ||
Comment 11•11 years ago
|
||
Status: NEW → ASSIGNED
Target Milestone: --- → Firefox 35
| Assignee | ||
Comment 12•11 years ago
|
||
I'll let this bake a bit on Nightly before requesting Aurora and Beta uplift.
Comment 13•11 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Updated•11 years ago
|
tracking-fennec: ? → 33+
| Assignee | ||
Comment 14•11 years ago
|
||
Comment on attachment 8488909 [details] [diff] [review]
Patch: Remove items by type v3
Approval Request Comment
[Feature/regressing bug #]: bug 913457 changed behavior of "remove"
[User impact if declined]: "Remove" will remove history, bookmark, reading list items (which will then be synced)
[Describe test coverage new/current, TBPL]: Nightly, local aurora testing
[Risks and why]: low, some refactoring to be clearer
[String/UUID change made/needed]: none
Attachment #8488909 -
Flags: approval-mozilla-aurora?
Updated•11 years ago
|
status-firefox32:
--- → wontfix
status-firefox33:
--- → affected
status-firefox34:
--- → affected
status-firefox35:
--- → fixed
status-firefox-esr31:
--- → unaffected
tracking-firefox33:
--- → +
tracking-firefox34:
--- → +
Comment 15•11 years ago
|
||
Comment on attachment 8488909 [details] [diff] [review]
Patch: Remove items by type v3
Aurora+
Bug 913457 shipped in 32. Have users been hitting this enough to warrant uplift to beta 33?
Attachment #8488909 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Flags: needinfo?(mark.finkle)
| Assignee | ||
Comment 16•11 years ago
|
||
I think we should uplift as well, actually. Carrying over r+.
Approval Request Comment
[Feature/regressing bug #]: bug 913457 made "remove" behavior universal
[User impact if declined]: removing item from one panel will remove it from all panels (and all synced devices)
[Describe test coverage new/current, TBPL]: local, nightly baking
[Risks and why]: low, refactoring for cleaner code
[String/UUID change made/needed]: none
Aurora try: https://tbpl.mozilla.org/?tree=Try&rev=f92a119c7f26
Beta try: https://tbpl.mozilla.org/?tree=Try&rev=b1e0eda7d62c
Attachment #8492263 -
Flags: review+
Attachment #8492263 -
Flags: approval-mozilla-beta?
Comment 17•11 years ago
|
||
Comment 18•11 years ago
|
||
Comment on attachment 8492263 [details] [diff] [review]
Beta patch: Handle remove behavior per panel
Taking it for beta 6
Attachment #8492263 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
Comment 19•11 years ago
|
||
(In reply to Lawrence Mandel [:lmandel] from comment #15)
> Comment on attachment 8488909 [details] [diff] [review]
> Patch: Remove items by type v3
>
> Aurora+
>
> Bug 913457 shipped in 32. Have users been hitting this enough to warrant
> uplift to beta 33?
Turns out that the context menu is one of our most heavily used actions. Thanks for taking this in Beta 6.
Flags: needinfo?(mark.finkle)
Comment 20•11 years ago
|
||
Comment 22•11 years ago
|
||
Verified as fixed on
Builds:
Firefox for Android 33
Firefox for Android 34 Beta 1
Firefox for Android 35.0a2 (2014-10-15)
Device: Asus Transformer Pad TF300T (Android 4.2.1)
Status: RESOLVED → VERIFIED
Updated•5 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
•