GM_eval vs. eval(s, unsafeWindow) vs. LocationHack
GM_eval() will not be implemented.
- The second argument of eval was removed.
eval()in chrome scope is a very dangerous thing to do.
- I'm not confident that it actually worked to solve the problems that the location hack does. (I'm confident that it does not, on FF 3.0.13 on Linux. Perhaps it did in older versions, before it was removed.)
Location Hack Broken
Fromp: You are confused about what the location hack is supposed to accomplish. It's for letting a user script call into a function (for example) defined in the page. Your example which I just removed was doing the opposite. As written that example should never have worked. Arantius 12:41, 16 September 2009 (EDT)
Arantius has removed the following passage that I had added:
- Whoops, true that I missed adding a comment there. But it was because I created Reading Content Globals to contain this topic (and added it to the "see also" section). It works consistently, and well, and does not involve polling. Arantius 13:17, 27 September 2010 (UTC)
- It is possible that the location.href code is excuted (much) later than the readout code in the following lines. This breaks the location hack. (Observed in Firefox 3.6.8)
This happened with Firefox 3.6.8 and broke the Wikipedia editor wikEd. The only work around was to poll the location hack element after having set location.href. Independent of the poll delay time the results arrives usually with the 1st or 2nd poll. I have to apply the location hack during the page loading period before the load event fires. Event triggering instead of polling was not possible because during the page loading none of the tested events fired (e.g. click) (Arantius also reverted that remark ). Please see the current working code and testcase below. Cacycle 00:53, 5 September 2010 (UTC)
Alternate solution sketch for reading page scope variables
While I don't know why Arantius removed the location hack helper (even the tersest change message would be useful), I can guess that it wasn't a dependable solution.
--Ecmanaut 23:58, 26 September 2010 (UTC)