guid in FormHistory notification "formhistory-remove" is always null

RESOLVED DUPLICATE of bug 1395427

Status

()

Toolkit
Form Manager
P3
normal
RESOLVED DUPLICATE of bug 1395427
10 months ago
2 months ago

People

(Reporter: frg, Unassigned)

Tracking

Trunk
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [fxsync][forms])

Attachments

(2 attachments)

(Reporter)

Description

10 months ago
+++ This bug was initially created as a clone of Bug #876002 +++

In Bug 878677 the notification "formhistory-remove" was changed to have a guid as a parameter:

https://hg.mozilla.org/mozilla-central/annotate/9126675b827a/toolkit/components/satchel/FormHistory.jsm#l646

Unfortunately the guid is always null in Desktop Firefox as far as I can see. So after removal of the sync formhistory api its inpossible for add-ons or other code to know what specific form entry was removed.

In FormHistory.jsm the actual remove function makeRemoveStatement will fall back to use fieldname and value if the provided guid is null/undefined so no error is reported. Tests seem not to use or cover the returned guid either. 

If this is confirmed and can't be fixed easily maybe fieldname, value and guid should be returned by the notification. The sync api nsIFormHistory2 did rjust do this in a "removeEntry" Notification.
(Reporter)

Comment 1

10 months ago
Created attachment 8846705 [details] [diff] [review]
formhistoryguildtest.patch

Patch to print the guild before and after removal.

In the Browser console I just get:

> FormHistory: updateFormHistoryWrite  1
> FormHistory: Remove from form history  [object Object]
> FormHistory: Remove from form history before guid is null!
> FormHistory: removeEntries
> FormHistory: Creating new statement for query: DELETE FROM moz_formhistory WHERE 
>              fieldname = :fieldname AND value = :value
> FormHistory: Remove from form history after guid is null!
(Reporter)

Updated

10 months ago
Blocks: 912031

Comment 2

10 months ago
It's relatively easy to get the GUID for items deleted from an auto-complete list - however, in the more general case, there's alot of code that explicitly calls FormHistory.update() with a change that looks like, say, {op: "remove", name: "field name", value: "field value"}, which ends up being turned into a SQL statement like |DELETE FROM moz_formhistory WHERE name = "field name" AND value = "field value"| - or sometimes just specifying a date field for when clearing recent history. In these cases the GUID isn't known, so to get this right we'd probably need to turn that into a query for GUIDs, then issue the delete against the resulting set - but this is likely to be fairly inefficient in many cases.

The end result of all this is that Sync can't sanely sync such removals from other devices.
Blocks: 735532, 1134967
Status: UNCONFIRMED → NEW
Ever confirmed: true
Whiteboard: [fxsync][forms]

Comment 3

10 months ago
Created attachment 8854749 [details] [diff] [review]
Patch that sends a GUID on deletion from the popup

FWIW, this patch works only when pressing the "del" key in a popup, but not in other common cases. The test change fails for this reason.

Updated

10 months ago
See Also: → bug 1354016

Updated

6 months ago
Blocks: 1381372

Updated

6 months ago
No longer blocks: 1381372
Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1395427
You need to log in before you can comment on or make changes to this bug.