Closed Bug 1295301 Opened 8 years ago Closed 8 years ago

history.onVisitRemoved argument is wrong after a call to history.deleteAll

Categories

(WebExtensions :: Untriaged, defect, P1)

defect

Tracking

(firefox50 fixed, firefox51 verified)

VERIFIED FIXED
mozilla51
Iteration:
51.2 - Aug 29
Tracking Status
firefox50 --- fixed
firefox51 --- verified

People

(Reporter: wbamberg, Assigned: bsilverberg)

Details

(Whiteboard: [history]triaged)

Attachments

(1 file)

If you add a listener to chrome.history.onVisitRemoved, it's passed a callback object containing a boolean `allHistory` and an array `urls`.

If the event fired because the history was all cleared, `allHistory` is true and `urls` should be an empty array (according to the Chrome docs[1] and Chrome behavior).

In Firefox, though, `urls` is undefined in this situation.

[1] https://developer.chrome.com/extensions/history#event-onVisitRemoved (although now I see that `urls` is also marked as optional, which makes no sense to me).
I think I implemented it this way precisely because `urls` is defined as optional. However, the comment in the Chrome docs about `allHistory`: "True if all history was removed. If true, then urls will be empty.", plus the fact that Chrome does in fact return an empty array, suggests that this is a bug that should be fixed. I will change the `urls` property to not be optional and will return an empty array, as per Chrome.
Assignee: nobody → bob.silverberg
Status: NEW → ASSIGNED
Iteration: --- → 51.2 - Aug 29
Priority: -- → P1
Whiteboard: [history]triaged
Comment on attachment 8781549 [details]
Bug 1295301 - history.onVisitRemoved argument is wrong after a call to history.deleteAll,

https://reviewboard.mozilla.org/r/71966/#review69606
Attachment #8781549 - Flags: review?(aswan) → review+
Thanks Andrew. Try run is looking good as well.
Keywords: checkin-needed
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/366b3ac46777
history.onVisitRemoved argument is wrong after a call to history.deleteAll, r=aswan
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/366b3ac46777
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla51
Comment on attachment 8781549 [details]
Bug 1295301 - history.onVisitRemoved argument is wrong after a call to history.deleteAll,

Approval Request Comment
[Feature/regressing bug #]: 1295301
[User impact if declined]: There is an incompatibility between the initial implementation of this method and how it is implemented in Chrome. This fixes that incompatibility.
[Describe test coverage new/current, TreeHerder]: This patch includes a test for this feature. A try run against Aurora has been submitted at https://treeherder.mozilla.org/#/jobs?repo=try&revision=8c212f31a55c
[Risks and why]: This only affects the history API and is a very small change, therefore the risk is low.
[String/UUID change made/needed]: None.
Attachment #8781549 - Flags: approval-mozilla-aurora?
Hello Will, could you please verify this issue is fixed as expected on a latest Nightly build? Thanks!
Flags: needinfo?(wbamberg)
Comment on attachment 8781549 [details]
Bug 1295301 - history.onVisitRemoved argument is wrong after a call to history.deleteAll,

Patch improves browser parity, includes a new test (yay!), Aurora50+
Attachment #8781549 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
(In reply to Ritu Kothari (:ritu) from comment #9)
> Hello Will, could you please verify this issue is fixed as expected on a
> latest Nightly build? Thanks!

Yes! Verified as fixed on 51.0a1 (2016-08-22).
Flags: needinfo?(wbamberg)
Status: RESOLVED → VERIFIED
> Yes! Verified as fixed on 51.0a1 (2016-08-22).

Great Thanks!
Thanks Ryan.
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: