Make compatible with Greasemonkey #128

Closed
pintassilgo opened this Issue Nov 16, 2013 · 4 comments

Comments

Projects
None yet
2 participants

Greasemonkey is one of the most popular Firefox extensions. It is so successful that was emulated natively in Google Chrome, including GM_xmlhttpRequest.

But GM_xmlhttpRequest is incompatible with Multifox. Requests always use default cookies, even in other identity profile, causing error.

I need GM_xmlhttpRequest, can't use XMLHttpRequest.

It is possible to make Multifox compatible with Greasemonkey/GM_xmlhttpRequest?

Thanks.

Owner

hultmann commented Nov 17, 2013

Probably not, it's a connection originated from Greasemonkey.

https://github.com/greasemonkey/greasemonkey/blob/1.12/modules/xmlhttprequester.js#L42

Maybe I can check the call stack to find out the exact window.

Maybe a multifox_xmlhttpRequest identical to GM_xmlhttpRequest that can be called by UserScripts?

I must detect status 302 in requests. XMLHttpRequest doesn't do this unless you have chrome privileges, but UserScripts haven't.

EDIT: got it! getBrowser().getAttribute("multifox-dom-identity-id")


Please, a little help: what code I must run to detect which identity profile I'm using THIS window?

I'm close to solving my problem.

I can get identity profile cookies and inject in GM_xmlhttpRequest.

Just missing detect which profile I'm using in the window.

For default identity profile:

(...)
var iter = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2).getCookiesFromHost("accounts.google.com");
(...)

For identity profile 2:

(...)
var iter = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2).getCookiesFromHost("accounts.google.com.google-com-2.multifox");
(...)

For identity profile 3:

(...)
var iter = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2).getCookiesFromHost("accounts.google.com.google-com-3.multifox");
(...)

And so on.

What code I must run to detect which profile I'm using THIS window?

Owner

hultmann commented Sep 18, 2014

Please try Multifox 3.0 beta (per-tab profiles): https://addons.mozilla.org/en-US/firefox/addon/multifox/#beta-channel [Development Channel]

Profile for a specific tab:

chromeWin.gBrowser.selectedTab.linkedBrowser.getAttribute("multifox-dom-identity-id-browser")

@hultmann hultmann closed this Sep 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment