[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[or-cvs] r12428: Improve the fix for bug 522 with a super bloody hack. Appare (torbutton/trunk/src/chrome/content)



Author: mikeperry
Date: 2007-11-07 22:54:25 -0500 (Wed, 07 Nov 2007)
New Revision: 12428

Modified:
   torbutton/trunk/src/chrome/content/torbutton.js
Log:

Improve the fix for bug 522 with a super bloody hack.
Apparently if you tell AcroRead to FOAD enough different ways,
it will eventually do so.



Modified: torbutton/trunk/src/chrome/content/torbutton.js
===================================================================
--- torbutton/trunk/src/chrome/content/torbutton.js	2007-11-07 23:07:39 UTC (rev 12427)
+++ torbutton/trunk/src/chrome/content/torbutton.js	2007-11-08 03:54:25 UTC (rev 12428)
@@ -1186,8 +1186,10 @@
     // This noise is a workaround for the fact that docShell.allowPlugins
     // is ignored when you directly click on a link
     try {
+        var chanreq = aRequest.QueryInterface(Components.interfaces.nsIChannel);
         // XXX: do we need to QI this bastard?
-        if(aRequest instanceof Components.interfaces.nsIChannel
+        if(chanreq
+                && aRequest instanceof Components.interfaces.nsIChannel
                 && aRequest.isPending() 
                 && m_tb_prefs.getBoolPref("extensions.torbutton.tor_enabled")
                 && m_tb_prefs.getBoolPref("extensions.torbutton.no_tor_plugins")) {
@@ -1197,7 +1199,28 @@
             // NoScript manages to make it work though...
             if (aRequest.contentType in m_tb_plugin_mimetypes) {
                 aRequest.cancel(0x804b0002);
-                window.alert("Torbutton blocked direct Tor load of plugin content.\n\nUse Save-As instead.\n\n");
+                if(aProgress) {
+                    // ZOMG DIE DIE DXIE!!!!!@
+                    try {
+                        aProgress.DOMWindow.stop();
+                        torbutton_eclog(2, 'Stopped document');
+                        aProgress.DOMWindow.document.clear();
+                        torbutton_eclog(2, 'Cleared document');
+                        
+                        if(typeof(aProgress.DOMWindow.__tb_kill_flag) == 'undefined') {
+                            window.alert("Torbutton blocked direct Tor load of plugin content.\n\nUse Save-As instead.\n\n");
+                            aProgress.DOMWindow.__tb_kill_flag = true;
+                        }
+                        aProgress.DOMWindow.document.removeChild(
+                                aProgress.DOMWindow.document.firstChild);
+                    } catch(e) {
+                        torbutton_eclog(3, 'Exception on stop/clear');
+                    }
+                } else {
+                    torbutton_eclog(4, 'No progress for document cancel!');
+                    window.alert("Torbutton blocked direct Tor load of plugin content.\n\nUse Save-As instead.\n\n");
+                }
+                torbutton_eclog(3, 'Killed plugin document');
                 return 0;
             }
         }