Bookmarklet requires permission for EVERY site it is run on

Discussion of features in Mozilla Firefox
Post Reply
User avatar
therube
Posts: 21703
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Bookmarklet requires permission for EVERY site it is run on

Post by therube »

Bugzilla, Bug 1781824 Bookmarklet requires permission for EVERY site it is run on

Any workaround (webextension is not an option) ?

every time you allow opening the link, you allow the site itself to load URLs for that protocol
Don't really understand what he's saying here?

So anytime I click my bookmarklet... what?
The site I am on when I've clicked it... what?

Can load URLs for that protocol... - which means just what?


That "protocol" (es:) only exists within the realm of Everything.
And there is no "URL loading".
There is only the passage of a string of text from one application (a web browser in this case) to the Everything (search engine).

(And all that does is to search your computer for a file name, partial or otherwise, of the passed text string.)


(A simple, though hardly efficient alternative [to automating this via a bookmarklet], is to manually copy a string of text, say from a web browser, & paste that string into Everything.)
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: Bookmarklet requires permission for EVERY site it is run

Post by morat »

Why not ask the addon developer?

Everything Search WE
http://addons.mozilla.org/firefox/addon/888982
User avatar
therube
Posts: 21703
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: Bookmarklet requires permission for EVERY site it is run

Post by therube »

Didn't know such an extension existed.

(And it does not work. And the authors site looks to be dead.
And the extension was last updated in 2017.
And given the minimal changes in FF between then & now, is it even conceivable that there would be some continuity ;-).)


My bookmarklet, I've used since 2013.


Heh. And it seems I've known the answer all along:
about:config >> security.external_protocol_requires_permission >>false

Now, that is probably not a safe thing to do.
(Not because of Everything, but because of everything else.)


Heh, I never knew:

Image
(Though I am not deserving of thanks, Void, is.)
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
User avatar
therube
Posts: 21703
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: Bookmarklet requires permission for EVERY site it is run

Post by therube »

And it does not work.
So I'm looking at the source (& not that I know what it means) & it says:

> top.location.href='es:'+txt2;

& I say to myself, "no reason that should not be working".


And then I realized... it was not working because I was on a "secure" web page - you know, one of those bastardizations where webextensions are not allowed to run - i.e., "mozilla.org" - because mozilla is "privileged"!


(You know, a person, a normal person, installs an extension from AMO, & they want to see what it does, & they're sitting there, on a website, & so they "check it out". And it doesn't work - because it is "mozilla". So immediate thought is "doesn't work". And it is true - doesn't work. Morons!)


The extension does work :-).
(That said, it is not a substitute for my bookmarklet.)
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
User avatar
therube
Posts: 21703
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Re: Bookmarklet requires permission for EVERY site it is run

Post by therube »

And immediately, IMMEDIATELY after I write that, I go to Customize & drag the extensions icon from the URLbar to the Bookmarks Toolbar.

And I highlight something on the page - that happened to be open & I click the Everything icon - & it doesn't work!
(Because I happened to [still ?] be on a mozilla.org webpage. Like I need to be cognizant of where I am. I can't just be, I have to be - somewhere other then "mozilla".)
Fire 750, bring back 250.
Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.19) Gecko/20110420 SeaMonkey/2.0.14 Pinball CopyURL+ FetchTextURL FlashGot NoScript
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: Bookmarklet requires permission for EVERY site it is run

Post by morat »

Maybe you can use a user script to override the restriction.

Tampermonkey Docs - GM_registerMenuCommand
http://www.tampermonkey.net/documentati ... enuCommand
morat
Posts: 6404
Joined: February 3rd, 2009, 6:29 pm

Re: Bookmarklet requires permission for EVERY site it is run

Post by morat »

You can use a Foxy Gestures user script to override the restriction. That addon uses privileged APIs.

Foxy Gestures
http://addons.mozilla.org/firefox/addon/foxy-gestures
http://github.com/marklieberman/foxygestures

User Scripts
http://github.com/marklieberman/foxyges ... er-Scripts
http://github.com/marklieberman/foxyges ... s#examples
http://github.com/marklieberman/foxyges ... er-Scripts
marklieberman wrote:User scripts are subject to all of the usual limitations of web extensions. Specifically, the user script is evaluated in the content script environment. Within the content script you will have limited access to web extension APIs.

To access privileged APIs, the user script must execute in the background script environment. Foxy Gestures provides a executeInBackground() function to allow user scripts to execute code in the background.
e.g.

Code: Select all

/* Foxy Gestures UserScript */

(function () {

  var selection = document.getSelection();
  if (!selection.isCollapsed) {
    var text = selection.toString();
    text = encodeURIComponent(text);
    executeInBackground(aText => {
      browser.tabs.update({
        url: "https://www.google.com/search?q=" + aText,
      });
    }, [text]);
  }

}());
browser.tabs.update() similar to location.href
http://developer.mozilla.org/docs/Mozil ... abs/update
Post Reply