bookmarks.onImportBegan never fired?

(Github) #1

In my Addon, i try to remove the listener for browser.bookmarks.onCreated. After reading i used the following in my background.js script:


function handleImportBegan() {
  console.log("Importing bookmarks, created Listener removed");

function handleImportEnded() {
  console.log("Bookmark import finished starting Listener again");

... rest of my code...

But when i now go in to the library, click on “restore” and start to import a earlier exported json file, a) there is no console output on the debugger window and onCreatedCheck is fired for every imported bookmark. Do i something wrong?

(jscher2000) #2

Two things:

(1) According to the compatibility table, onImportBegan is not implemented in Firefox (yet?):


(2) Firefox uses JSON-format files for its Backup and Restore features. The Import and Export features use HTML-format files. I don’t know whether there is a plan to listen for Restore if the onImportBegan event becomes supported.

(Github) #3

Currently i use it only in Firefox, since it isnt planned to release a Chrome version. I kow its possible, but thats a later target.

If im in the library and i export all my bookmarks, i get a JSON file. When i now do the opposite and click on import, i select the exported JSON file and after i accept it, i see my old bookmarks disappear and the new one from the JSON file are available in the library. So i think the import process works, but the event isnt fired.

the code is part of a bigger bookmark addon, where for example, i send bookmarks to a php script via XHR request in the function onCreatedCheck. Do not send all bookmarks during omport, i want to remove the listener during import with the above code.

(Github) #4

Ah, now i understand. It’s NOT available for Firefox. It’s really late now and I should go to bed…

Are there any other way, to monitor the import process?

(jscher2000) #5

I’m not aware of any other events related to bookmarks than the ones documented.

You probably could determine from the rate of events being generated that bulk adding is occurring and use that information to avoid taking the action you were normally going to take.