Firefox 4.0b10ã§Greasemonkey 0.9.1ã®ã¦ã¼ã¶ã¹ã¯ãªããã®windowãå ±éã«ããæ¹é ï¼éçºè orVimperåãï¼
2010/02/09追è¨: Firefox 4.0b11ã§ããï½
2010/03/01追è¨: Firefox 4.0b12ã§ããï½ãã®ããã ãã©ãæã
ãã¾ãåããªãäºã
2010/03/14追è¨: Firefox 4.0 RC1ã§ããï½
2012/01/04追è¨: Greasemonkey 0.9.13ã§åããªããªã£ã¦ã¾ããã¦ããã°ã£ã¦ã°ãªã¢ã³åããªããªãã®ã§ãããé©ç¨ããªãã§ãã ãã
LDRizeã使ããªãã®ã¯èããããªãã®ã§ãFirefox 4.0b10ã§Greasemonkey 0.9.1ã®ã¦ã¼ã¶ã¹ã¯ãªããã®windowãå
±éã«ããæ¹é ãã°ãªã¢ã³ã«æ½ããã
LDRizeã使ããªããã¨ã«ã¤ãã¦ã¯ãã®è¾ºåç
§ã
- ããããããã (greasemonkey 0.9 é¡æ«è¨) - twwp http://d.hatena.ne.jp/taizooo/20110128/1296172869
- Greasemonkeyã0.9ã«ãªã£ã¦LDRizeãAutoPagerizeãåããªããªã£ã http://anond.hatelabo.jp/20110128093703
- Minibufferã¨LDRize ã Greasemonkey 0.9.1 ã§åãã - hogehoge @teramako http://d.hatena.ne.jp/teramako/20110202/p1
ãã¨Tombloo使ã£ã¦ãå ´åã¯ãã¡ãã®æ¹æ³ããããã
Twitter / @utatane: GMã®Windowãsharedã«ããTombloo ... http://twitter.com/#!/Constellation/statuses/31786122715594752
æ¹é æ¹æ³
ã°ãªã¢ã³ã®ã½ã¼ã¹ã¯ãã https://github.com/greasemonkey/greasemonkey
æ¹é ãããã¯ãããªæã
--- a/components/greasemonkey.js +++ b/components/greasemonkey.js @@ -255,6 +255,9 @@ GM_GreasemonkeyService.prototype = { var xmlhttpRequester; var resources; var unsafeContentWin = wrappedContentWin.wrappedJSObject; + var sharedWindow = {}; + sharedWindow.window = sharedWindow; + sharedWindow.__proto__ = new XPCNativeWrapper(unsafeContentWin); // detect and grab reference to firebug console and context, if it exists var firebugConsole = this.getFirebugConsole(unsafeContentWin, chromeWin); @@ -297,6 +300,7 @@ GM_GreasemonkeyService.prototype = { "registerMenuCommand", unsafeContentWin); + sandbox.window = sharedWindow; // Re-wrap the window before assigning it to the sandbox.__proto__ // This is a workaround for a bug in which the Security Manager // vetoes the use of eval.
ãµã³ãããã¯ã¹ããè¦ããwindowããcontent Windowããããã¿ã¤ãã«ããæ®éã®ãªãã¸ã§ã¯ãã«ããã¦ããããã¦ã¼ã¶ã¹ã¯ãªããéã§ä½¿ãåãããã§ãã
Firefox 4.0b10ã§ã¯ããã§åãã¦ããããã©ãä½æ
ãFirefox 3.6.13ã§ã¯åããªã
ä½æ
ãsharedWindow.window.documentãundefinedãå¤å3.6.13ã®XPCNativeWrapperãããã®ãã°ã ã¨æãã3.6.13ã§ã¯GM 0.9.0使ãã°ãããã
ã¾ããã¨ããããããããªæ¹æ³ã§ã©ãã§ãããï¼
2010/02/01 追è¨
Vimperatorã¦ã¼ã¶ãªãç°¡åã«LDRizeã§ããããã«ãªãã
ããããã°GMã¯XPCOMã§ä¸è¨ã®é¨ååãåºãã¦ãããããããã°ãªã¢ã³ã®ã½ã¼ã¹ã³ã¼ãããã£ã¦xpiãã«ãããå¿
è¦ãªãã£ãã
Vimperãªãvimperatorrcã«ä»¥ä¸ã追å ããã ãã§ä¸è¨ããããã¦ããã
" Greasemonkey 0.9.1ã§windowãå ±éã«ãããï¼å¿ è¦æ§ã¯ä¸æçï¼" js <<EOM autocommands.add('VimperatorEnter', '.*', function() { let gm = Components.classes['@greasemonkey.mozdev.org/greasemonkey-service;1']; if (gm) { gm = gm.getService().wrappedJSObject; if (gm.injectScripts.toSource().search('sharedWindow') == -1) { gm.injectScripts = liberator.eval( gm.injectScripts.toSource() .replace(/(?=var firebugConsole)/, 'var sharedWindow = {};' + 'sharedWindow.window = sharedWindow;' + 'sharedWindow.__proto__ = new XPCNativeWrapper(unsafeContentWin);') .replace(/(?=sandbox\.__proto__)/, ' sandbox.window = sharedWindow;'), gm.injectScripts); } } }); EOM
ãã¨LDRize使ãVimperãªãldrize_cooperation.js使ã£ã¦ãã¨æãã®ã§ãä¸è¨GMã®æ¹é ã«ãããã¦æ¬¡ã®ããããå¿
è¦ã§ã
ãã§ã«ä»¥ä¸ã®ãããã¯ææ°çã«åãè¾¼ã¾ãã¾ãããææ°ã®ldrize_cooperation.jsã使ãã°ãï½ã§ããswirhenãããããã¨ããããã¾ã
--- a/ldrize_cooperation.js +++ b/ldrize_cooperation.js @@ -184,18 +184,18 @@ } else { var [code,codebase,sandbox] = arguments; } - if(sandbox.LDRize != undefined && sandbox.Minibuffer != undefined){ + if(sandbox.window.LDRize != undefined && sandbox.window.Minibuffer != undefined){ sandbox.window.addEventListener("focus",function(){ - self.LDRize = liberator.eval("self",sandbox.LDRize.getSiteinfo); - self.Minibuffer = liberator.eval("command",sandbox.Minibuffer.addCommand); - if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.LDRize; - if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.Minibuffer.command; + self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); + self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); + if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; + if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; },false); - if(window.content.wrappedJSObject == sandbox.unsafeWindow){ - self.LDRize = liberator.eval("self",sandbox.LDRize.getSiteinfo); - self.Minibuffer = liberator.eval("command",sandbox.Minibuffer.addCommand); - if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.LDRize; - if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.Minibuffer.command; + if(window.content.wrappedJSObject == sandbox.window.unsafeWindow){ + self.LDRize = liberator.eval("self",sandbox.window.LDRize.getSiteinfo); + self.Minibuffer = liberator.eval("command",sandbox.window.Minibuffer.addCommand); + if (typeof self.LDRize.getSiteinfo != 'function') self.LDRize = sandbox.window.LDRize; + if (typeof self.Minibuffer.addCommand != 'function') self.Minibuffer = sandbox.window.Minibuffer.command; } } });
GMã®æ¹é ã«ãããã¦ãsandboxã®ã¨ãããsandbox.windowã«ããã