linterna-magica-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linterna-magica-commit] [273] Experimental code for support #108013.


From: Ivaylo Valkov
Subject: [linterna-magica-commit] [273] Experimental code for support #108013.
Date: Mon, 07 May 2012 11:18:16 +0000

Revision: 273
          
http://svn.sv.gnu.org/viewvc/?view=rev&root=linterna-magica&revision=273
Author:   valkov
Date:     2012-05-07 11:18:15 +0000 (Mon, 07 May 2012)
Log Message:
-----------
Experimental code for support #108013. Should address the freeze and bloating 
of Firefox

Ticket Links:
------------
    http://savannah.gnu.org/support/?108013

Modified Paths:
--------------
    trunk/src/lm_remove_plugin_install_warning.js
    trunk/src/lm_site_facebook.js
    trunk/src/lm_site_youtube.js
    trunk/src/lm_sites.js

Modified: trunk/src/lm_remove_plugin_install_warning.js
===================================================================
--- trunk/src/lm_remove_plugin_install_warning.js       2012-04-29 08:28:06 UTC 
(rev 272)
+++ trunk/src/lm_remove_plugin_install_warning.js       2012-05-07 11:18:15 UTC 
(rev 273)
@@ -65,7 +65,26 @@
     while (node)
     {
        remove = false;
+       
+       // Skip nodes with large sizes. Optimizes YouTube in Abrowser
+       // 12.0 See bug #108013:
+       // https://savannah.nongnu.org/support/index.php?108013
+       var size = null;
+       try {
+           size = (new XMLSerializer().serializeToString(node)).length;
+       }
+       catch(e)
+       {
+           continue;
+       }
 
+       // Skip nodes larger than 5 KB
+       if (size > 5120)
+       {
+           node = node.nextSibling || null;
+           continue;
+       }
+       
        this.log("LinternaMagica.remove_plugin_install_warning:\n"+
                 "elements "+element.childNodes.length+
                 " node "+node,5);

Modified: trunk/src/lm_site_facebook.js
===================================================================
--- trunk/src/lm_site_facebook.js       2012-04-29 08:28:06 UTC (rev 272)
+++ trunk/src/lm_site_facebook.js       2012-05-07 11:18:15 UTC (rev 273)
@@ -128,3 +128,24 @@
 // Reference. Just returns false
 LinternaMagica.prototype.sites["facebook.com"].
     do_not_clean_amps_in_extracted_link = "video.google.com";
+
+// See bug #108013:
+// https://savannah.nongnu.org/support/index.php?108013
+LinternaMagica.prototype.sites["facebook.com"].
+skip_script_processing = function()
+{
+    if (/video\.php/i.test(window.location.href) &&
+       this.script_data.length >= 15360 )
+    {
+       // Skip scripts larger than 15 KB on video pages.
+       return false;
+    }
+    else if (!/video\.php/i.test(window.location.href) &&
+            this.script_data.length >= 5120)
+    {
+       // Skip scripts larger than 5 KB on non-video pages.
+       return false;
+    }
+
+    return true;
+}

Modified: trunk/src/lm_site_youtube.js
===================================================================
--- trunk/src/lm_site_youtube.js        2012-04-29 08:28:06 UTC (rev 272)
+++ trunk/src/lm_site_youtube.js        2012-05-07 11:18:15 UTC (rev 273)
@@ -303,6 +303,16 @@
     return this.sites.__no_flash_plugin_installed.apply(this, [arguments]);
 }
 
+LinternaMagica.prototype.sites["youtube.com"].skip_script_processing =
+function()
+{
+    // See bug #108013:
+    // https://savannah.nongnu.org/support/index.php?108013
+    // Do not skip script processing in youtube. The default function
+    // might skip scripts in some browsers.
+    return true;
+}
+
 LinternaMagica.prototype.sites["youtube.com"].skip_link_extraction = function()
 {
     // Link extraction bloats FF in youtube:

Modified: trunk/src/lm_sites.js
===================================================================
--- trunk/src/lm_sites.js       2012-04-29 08:28:06 UTC (rev 272)
+++ trunk/src/lm_sites.js       2012-05-07 11:18:15 UTC (rev 273)
@@ -142,6 +142,21 @@
 // return value is false (or null or undefined).
 LinternaMagica.prototype.sites.__skip_script_processing = function()
 {
+
+    // Skip scripts larger than 17KB by default
+    if (this.script_data.length >= 17408)
+    {
+       this.log("LinternaMagica.sites.__skip_script_processng:\n"+
+                "Skipping script with size "+this.script_data.length,5);
+       return false;
+    }
+    else
+    {
+       this.log("LinternaMagica.sites.__skip_script_processng:\n"+
+                "Processing script with size "+this.script_data.length,5);
+    }
+
+
     return true;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]