vaeth/bookmarkdupes

Add expert mode 2

Closed this issue · 3 comments

rain1 commented

Hi!

Would it be possible to add a new expert mode? Current one has kinda high learning curve with all it's text fields. As someone who knows JS I would like to have expert mode where that instead of 66 edit boxes would have just one. And in that one I wish to paste my own JS function that takes 2 bookmarks as arguments and returns true if they are dupes. This way I can write my custom logic with no complexity limit and then just throw it in existing addon without having to write one myself.

For example for filtering by url only I would paste in this edit box something like:

function(bookmarkA, bookmarkB){
  return bookmarkA.url == bookmarkB.url;
}

And that example code could be below box to help people get started quickly. Optionally you could add checkbox to save all or nothing - that if at any point function throws then changes will not be saved. Or maybe even display preview of changes where user has to click save button in order to write changes.

Syntax highlighting is not importent for js. I can write my function in some IDE and when it is done paste it text box.

vaeth commented

Won't fix: Implementing this requires to execute unknown user-provided code. This opens the gate to all sort of social engineering attacks. Also, it would prevent the extension from being approved for usage in firefox or chrome for this reason. It requires cumbersome manual inspection to approve that the executed is really only executed for this reason. Not feasible.

rain1 commented

Ok didnt know that. I wonder how Greasemonkey manages to be approved extension?

vaeth commented

According to German wikipedia, greasemonkey is not approved for chrome, at least not in the variant that arbitrary code is directly executed in ECMA script, but instead in some special variant that each script produces a separate extension.