Created attachment 396139 [details] [diff] [review]
This is the equivalent of Firefox bug 465082 (and bug 460086). The idea is to have "Delete History for (host|domain)" available in the context menu so that these commands can be used from the sidebar (the patch also adds it to the context menu available in the History window but there the commands are already available through the Edit menu).
Some background: the placesCmd_delete:* commands in controller.js check gLastHostname and gLastDomain which are only set by historyOnSelect() in history.js. To make it work in the Sidebar I had to call that function and make sure it doesn't access gHistoryStatus which is not available in the Sidebar case.
Comment on attachment 396139 [details] [diff] [review]
>+ <command id="placesCmd_delete:hostname"
>+ <command id="placesCmd_delete:domain"
Nit: these can now be removed from history.xul
> <menuitem id="placesContext_delete"
>+ <menuitem id="menu_deleteByHostname"
>+ <menuitem id="menu_deleteByDomain"
This breaks the Edit menu, since you have duplicate IDs. One workaround is to set the label and accesskey on the command element instead.
Created attachment 396818 [details] [diff] [review]
Now with different IDs. Had to switch over to using setAttribute() for both .label and .accessKey now that the target is a command element.