Closed Bug 938401 Opened 7 years ago Closed 7 years ago

getShortcutOrURI Seems To Have Been Removed


(Toolkit :: Places, defect)

25 Branch
Windows 7
Not set





(Reporter: aauren, Unassigned)


User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0 (Beta/Release)
Build ID: 20131025151332

Steps to reproduce:

1. Open the console within Firefox on any page (I even tried this in Safe mode to make sure that it wasn't a bad add-on or plugin)
2. Attempt to reference a Bookmark with the command getShortcutOrURI e.g. getShortcutOrURI('diigo_bookmark',{}), you can also attempt to use it in the URL line of the browser prefacing it with "javascript:"

Actual results:

You get an error that says "ReferenceError: getShortcutOrURI is not defined"

Expected results:

It should have returned an object that contained the URI of the requested bookmark. The above syntax has been working for me for at least the last 2 years, and it suddenly broke through a recent upgrade, not exactly sure which one, but it was working for me about a week ago.

I use this so that I can assign keyboard shortcuts to bookmarklets in conjunction with keyconfig, the full syntax that I usually use is something like: javascript:loadURI(getShortcutOrURI('diigo_bookmark',{}));

For more information on this function see:
It was renamed as part of some breaking changes to it in bug 846635. Take a look at the patch for some examples of how to use the new version (e.g. the onDrop function).
This sounds to me like a WONTFIX and maybe something that should be corrected in documentation in MDN. CC-ing in the developers from bug 846635.
Component: Untriaged → Places
Product: Firefox → Toolkit
If this is for an add-on, we announced it in the Add-on Blog ( and also included it in the tests we did for all AMO add-ons with compatibility up to 24.
I can see what you're saying about it being replaced by getShortcutOrURIAndPostData. I had actually run across that bug thread, but I guess I didn't take enough time to read through it carefully enough to truly understand the ramification of that bug. It probably would have been a lot more obvious if I had found in my Google search quest for this issue. For some reason I never stumbled across it.

This is not for an add-on, this is for a piece of JavaScript that I run in the browser that essentially loads a bookmarklet via a keyboard shortcut. If it helps at all, the full expression that I used to use was: "loadURI(getShortcutOrURI('diigo_bookmark',{}));" where loadURI

I am, however, still having problems using the new getShortcutOrURIAndPostData function. It used to be with the previous incarnation (getShortcutOrURI('',{})) that I could call it from the console, or from the URL line prefixing it with "javascript:". However, I cannot seem to get the new function to work in a similar manner. Every time I execute it, I just get the following error: "ReferenceError: getShortcutOrURIAndPostData is not defined".

Please forgive me if I'm missing something super obvious here. I am a programmer by trade, but I don't usually interact with the browser at this level. What I had before was super useful and I'm just trying to get back to that point using the new API.
getShortcutOrURIAndPostData('diigo_bookmark').then(function(result) {

works ok from a Chrome scratchpad (or from keyconfig) for me. I can't see how either function could ever work from the urlbar.
Alright, something seems really off to me. I ran the exact same thing that you mentioned by opening up scratchpad (Shift+F4), then pasting in your exact command, and what I get is the following:
getShortcutOrURIAndPostData('diigo_bookmark').then(function(result) {
Exception: getShortcutOrURIAndPostData is not defined

I double-checked my Firefox version, and found that there was an upgrade from 25.0 to 25.0.1. After the upgrade it still says that it's not defined. So then I rebooted Firefox into Safe Mode and tried that again, to see if I could get some purchase. However, I still get the same result saying that it's not defined.

Any guesses about what could be so different about my environment from yours?
Also, as another step of troubleshooting, I even booted up a VM and started Firefox from a blank state. Upgraded to version 25.0.1 and tried to run the above JavaScript and I still got the same error.
I used a chrome scratchpad. (Set = true, open a new Scratchpad and then pick Environment -> Browser.)
Sure enough. Those configuration options for scratchpad were definitely what I was missing. Thanks so much for you patience dagger. I know that it's not your job to teach people how to use the API in Firefox, so I appreciate you bearing with me. And now I have a lot of other tools that I can use to debug stuff for myself down the road. Up until this point I was completely unaware of the scratchpad.
Closed: 7 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.