MozillaZine


Bookmarklet requires permission for EVERY site it is run on

Discussion of features in Mozilla Firefox
therube

User avatar
 
Posts: 21276
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted July 28th, 2022, 9:38 am

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: 5341
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 28th, 2022, 6:43 pm

Why not ask the addon developer?

Everything Search WE
http://addons.mozilla.org/firefox/addon/888982

therube

User avatar
 
Posts: 21276
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted July 29th, 2022, 8:47 am

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

therube

User avatar
 
Posts: 21276
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted July 29th, 2022, 10:04 am

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

therube

User avatar
 
Posts: 21276
Joined: March 10th, 2004, 9:59 pm
Location: Maryland USA

Post Posted July 29th, 2022, 10:10 am

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: 5341
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 29th, 2022, 7:02 pm

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

Tampermonkey Docs - GM_registerMenuCommand
http://www.tampermonkey.net/documentation.php#GM_registerMenuCommand

morat
 
Posts: 5341
Joined: February 3rd, 2009, 6:29 pm

Post Posted July 30th, 2022, 7:34 am

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/foxygestures/wiki/User-Scripts
http://github.com/marklieberman/foxygestures/wiki/User-Scripts#examples
http://github.com/marklieberman/foxygestures/wiki/List-of-Common-User-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/Mozilla/Add-ons/WebExtensions/API/tabs/update

Return to Firefox Features


Who is online

Users browsing this forum: No registered users and 1 guest