Comment 14 for bug 394912

Revision history for this message
C de-Avillez (hggdh2) wrote :

I had a chat with wgrant:

<hggdh> wgrant, can you expand, please?
<hggdh> what I see is an error (encrypted), and a status==0. If I understand what is wrong, I may be able to correct it
<wgrant> hggdh: Person links recently had the "bugs." dropped from them. This is quite intentional. Your problem might be that the browser security is kicking in and refusing to let you make a cross-domain request.
<hggdh> wgrant, I am rather new to this(in fact, my very first JS script ever). How could I bypass the browser security?
<wgrant> hggdh: You can't. You have to make requests to the same domain.
<hggdh> so we are pretty much dead with the GM scripts against bugs.edge?
<wgrant> hggdh: What you could do is construct a relative URL. This probably means taking everything after the '~' from the person URL, and prepending '/~'.
<wgrant> hggdh: No, you just have to make the requests against bugs.edge.
<wgrant> hggdh: Link me to the script, and I will fix.
<wgrant> (some of LP's JS broke the same way, so I know how to fix)
<hggdh> cool!
<hggdh> https://code.edge.launchpad.net/~hggdh2/launchpad-gm-scripts/hggdh2
<hggdh> it's the lp_karma_suffix.user one
<hggdh> and, to boot, I will learn more!
<hggdh> I understood I could not change the host in a XMLHttpRequest...
<wgrant> hggdh: You just have to change the URL that you give it.
<wgrant> hggdh: Is that the canonical copy of that script?
<hggdh> wgrant, this is the change I proposed to add in the ability to follow a commeter's bug work (for bugs-control)
<hggdh> I do remember I *did* change the URL, and still got hit by the status=0 -- so I guess I did it wrong, out of the depths of my ignorance
<hggdh> wgrant, ping
<hggdh> wgrant, I think I got it. I changed the links as here: http://paste.ubuntu.com/262862/, and it is working now. I *guess* this is what you menat

For the record, this is how it got to work on lp_karma-suffix:

    if (!people_cache[person]) {
        people_cache[person] = new Array();
        // drop '//bugs.' from the link URL
// people_cache[person]['person_link'] = link.replace(/\/\/bugs\./, "//");
// GM_log ("add_people: person_link=" + people_cache [person]['person_link']);
        people_cache[person]['team_link'] = "~/" + link;
        people_cache[person]['person_name'] = node.text;
        people_cache[person]['karma_link'] = "~/" + link + "/@@+portlet-details";

In this example, link had, as value, "https://bugs.edge.launchpad.net/ubuntu/+source/firefox-3.0/+bug/394912/". After the assigment, karma_link got to be "https://bugs.edge.launchpad.net/ubuntu/+source/firefox-3.0/+bug/394912/~/https://edge.launchpad.net/~hggdh2/@@+portlet-details", which works perfectly.

So I expect the firefox tasks, both local and upstream, can be closed invalid, and we are only left with the launchpad GreaseMonkey Scripts to worry about.

Still to be tested: how will it behave on stable LP, as opposed to Edge.