gbishop / outfox

Automatically exported from code.google.com/p/outfox
Other
1 stars 0 forks source link

Outfox is not Greasemonkey friendly #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm including Outfox in a Greasemonkey script with this metadata.

// ==UserScript==
// @require http://www.json.org/json2.js
// @require http://outfox.googlecode.com/svn/trunk/js/outfox.js
// ==/UserScript==

and initializing Outfox with the following code:

var def = outfox.init(div, JSON.stringify, JSON.parse);

When init() runs, I get the following error in the JS console:

Error: outfox.Deferred is not a constructor
Source File: 
file:///Users/parente/Library/Application%20Support/Firefox/Profiles/7217kf1f.fi
rebug/gm_scri
pts/citation_announcer/outfox.js
Line: 32

Looking at the JS, it looks like outfox.utils.declare method is trying to 
search the window object 
for an existing namespace and attach items to it. The problem, I believe, is 
that the global JS 
namespace in a GM script is "this" not "window". The window object is just a 
wrapper for the 
native window.

Original issue reported on code.google.com by pare...@gmail.com on 22 Jun 2009 at 9:26

GoogleCodeExporter commented 9 years ago
Removed use of outfox.utils.declare to create outfox.Deferred class. Switched 
from
inserting script tag in head to eval'ing extension code. Now all outfox objects
should be in the same context as where the top-level outfox object is defined.

Rev 165.

Original comment by c...@unc.edu on 24 Jun 2009 at 11:12