Firefox 17 ç°å¢ã§ã®LDRize復活ã¸ã®æå¼ãï¼unsafeWindowä¸ä½¿ç¨ãã¼ã¸ã§ã³ï¼
Firefox 17ã«ãªã£ã¦æä¾è¡äºã®ãã¨ãLDRizeãåããªããªã£ã¦ããã°ããã©ããããããªãæãã§ããããFirefox 16ã®ã¨ãã«ã¡ãã£ã¨ç®ã«ããã¨ã©ã¼ãé ¼ãã«ä¿®æ£ãããããã£ããåãããã«ãªã£ãã®ã§ãåå¿é²çã«è¨äºã«ãã¦ã¿ã¾ãã
åæã®ã²ã¨ã¤ã¨ãã¦ãFirefox17ããE4Xã¯ããã©ã«ãã§ãªãã«ãªãï¼javascript.options.xml.content ã§ãªã³ã«ã¯åºæ¥ãï¼ãå°æ¥çã«ã¯åé¤ããã¾ãããã®ãããE4Xã§æ¸ããã¦ãããã¢ããã¥ã¡ã³ãé¨åã¯ãã¹ã¦æååã«ç½®ãæããå¿ è¦ãããã¾ãã
ã§ãæ®ãåé¡ã¯ã°ãªã¢ã³éã®ãªãã¸ã§ã¯ãã®å
±æãMinibufferãªãã¸ã§ã¯ããå
±æããã¦ãããªãã¨ã©ãã«ããªããªãã
unsafeWindowã使ã£ã¦ãè¯ããªããid:serian:20121122:p1ï¼[Firefox] firefox17とminibufferとldrizeとUserScriptLoaderとtombloo - うぇぶとらばぁすï¼ã§æ¸ããã¦ãããããªæ¹å¤ã§ã¾ã£ããåé¡ãªãã®ã§ãããunsafeWindowã¨ãããã¨ã¯ãµã¤ãã®å´ãããMinibuffferãããããç¶æ
ã¨ãããã¨ãããã¦greasemonkeyå
ãããã«å½±é¿ç¯å²ããããã¦èªè¡å¯è½ã«ãã¦ããããã§ãã
ã¨ãããã¨ã§ãåºæ¬çãªæ¹éã¯ä¾ã«ãã£ã¦ä¾ã®ãã¨ããGreasemonkey0.9.12以降でMinibufferとLDRizeが動かない理由とか - tyoro.exeã¨åããsharedObjectãå¦æ¹ãããã¨ã
Firefox17ãgreasemonkey1.5ãåæã¨ãã¦ã¾ãã
ã¡ãªã¿ã«ãLDRizeãAutoPagerizeã¾ã§sharedObjectã«ã¶ã£ããã§ããã®ã¯ããã£ã¡ã®æå ã§ã¯LDRizeãAutoPagerizeãå©ç¨ããã¹ã¯ãªãããå°å ¥ãã¦ãããããå¿ è¦ãªããã°ãæä½éMinibufferã®ã¨ããã ãããã°LDRizeã¯å¾©æ´»ã§ãã¾ãã
greasemonkeyãç´æ¥ãããå ´å
diffè²¼ã
diff --git a/components/greasemonkey.js b/components/greasemonkey.js index 89d1575..6491421 100644 --- a/components/greasemonkey.js +++ b/components/greasemonkey.js @@ -490,11 +490,22 @@ service.prototype.injectScripts = function( scripts, url, wrappedContentWin ) { var chromeWin = getChromeWinForContentWin(wrappedContentWin); + var sharedObject = { + Minibuffer : null, + LDRize : null, + AutoPagerize : null, + __exposedProps__ : { + Minibuffer : "rw", + LDRize : "rw", + AutoPagerize : "rw" + } + }; var firebugConsole = getFirebugConsole(wrappedContentWin, chromeWin); for (var i = 0, script = null; script = scripts[i]; i++) { var sandbox = createSandbox( script, wrappedContentWin, chromeWin, firebugConsole, url); + sandbox.sharedObject = sharedObject; runScriptInSandbox(script, sandbox); } };
diffãèªããªã人ã®ããã®å®æå½¢ã¯ãããªæã
injectScriptsã®ã¨ã
ããã
service.prototype.injectScripts = function( scripts, url, wrappedContentWin ) { var chromeWin = getChromeWinForContentWin(wrappedContentWin); var firebugConsole = getFirebugConsole(wrappedContentWin, chromeWin); for (var i = 0, script = null; script = scripts[i]; i++) { var sandbox = createSandbox( script, wrappedContentWin, chromeWin, firebugConsole, url); runScriptInSandbox(script, sandbox); } };
ãããªãã
service.prototype.injectScripts = function( scripts, url, wrappedContentWin ) { var chromeWin = getChromeWinForContentWin(wrappedContentWin); var sharedObject = { Minibuffer : null, LDRize : null, AutoPagerize : null, __exposedProps__ : { Minibuffer : "rw", LDRize : "rw", AutoPagerize : "rw" } }; var firebugConsole = getFirebugConsole(wrappedContentWin, chromeWin); for (var i = 0, script = null; script = scripts[i]; i++) { var sandbox = createSandbox( script, wrappedContentWin, chromeWin, firebugConsole, url); sandbox.sharedObject = sharedObject; runScriptInSandbox(script, sandbox); } };
ããã§tombloo
addAround使ãã°ãããã ãããã©èå¿ã®addAroundãã©ã使ãã°ããã®ãããããããªãã£ãã®ã§ãã¹ã
vimperator
js <<EOM autocommands.add( 'VimperatorEnter', '.*', function () { let Cc = Components.classes['@greasemonkey.mozdev.org/greasemonkey-service;1']; if (Cc) { Cc = Cc.getService().wrappedJSObject; if (Cc.injectScripts.toSource().search('sharedObject') == -1) { Cc.injectScripts = liberator.eval( Cc.injectScripts.toSource() .replace(/(?=(?:var|let) (?:firebugConsole))/, 'var sharedObject = {\n Minibuffer:null,\n LDRize:null,\n AutoPagerize:null,\n __exposedProps__:{\n Minibuffer:"rw",\n LDRize:"rw",\n AutoPagerize:"rw"}};\n ') .replace(/(?=runScriptInSandbox\()/, 'sandbox.sharedObject = sharedObject;\n ') .replace(/(?:}\)$)/, ' return sharedObject;\n})'), Cc.injectScripts); }; }; }); EOM