II have noticed in jesus2099/konami-command#372 that Firefox v57 + Greasemonkey v4 would only work with full URL https?://host.tld/pathname
and no longer works with just /pathname
.
Firefox v57 + another GM engine is not affected by this regression, this is why I open a ticket here.
In my work‐around, I had to append self.location.protocol + "//" + self.location.host +
in front of my URL.
Running requests from a content script context (which userscripts are run in) must use full urls.
If you don't want to use full urls then you can use the methods on window.wrappedJSObject
and export any functions that are needed to run (onreadystatechange, etc) using exportFunction()
. My suggestion is just to use full urls.
Thanks very much for your help.
OK so you mean it’s per specifications of the WebExtensions system, right?
I don’t know this WebExtensions stuff, but it seems to be a standard…?
I don’t remember reading anything about this particular regression in the GM v4 for authors blog posts.
It’s sure this regression is permanent?
It’s sure this regression is permanent?
Maybe. I don't really know. Perhaps down the line @grant none
will not have these issues, if a proper sandbox can be created. But if some privileged APIs are required then these steps may be necessary. The ball's really in Mozilla's court.
FTR my script is a @grant none
script.
I let the project leaders close or not close this ticket.
I’ll adapt.
This is not intended, so it shouldn't be expected to be permanent. We could totally resolve non-absolute paths based on the document as a root.
Please note that the correct base url is: document.baseURI
(related to <base href="...">
)
I can confirm, jQuery AJAX doesn't work with only path URL.
Firefox 57, latest Greasemonkey.
$.ajax({
url: '/some/path',
success: () => {}
});
My AJAX works with old Firefox (pre-WebExtensions)
The above fix has been packaged in a new beta version:
https://addons.mozilla.org/firefox/downloads/file/830369/greasemonkey-4.2beta1-an+fx.xpi?src=devhub
Testing and confirmation would be appreciated!