improved nuking of window.open
authorharoon <haroon@users.sourceforge.net>
Wed, 18 Jul 2001 15:02:52 +0000 (15:02 +0000)
committerharoon <haroon@users.sourceforge.net>
Wed, 18 Jul 2001 15:02:52 +0000 (15:02 +0000)
killpopup.c

index 95dfabb..6187b7e 100644 (file)
@@ -90,7 +90,6 @@ const char killpopup_h_rcs[] = KILLPOPUP_H_VERSION;
  * Description :  Filter the block of data that's been read from the server.
  *                Caller is responsible for checking permissons list
  *                to determine if this function should be called.
- *                FIXME: Should use the replacements proposed by Guy
  *
  * Parameters  :
  *          1  :  buff = Buffer to scan and modify.  Null terminated.
@@ -104,7 +103,6 @@ void filter_popups(char *buff, int size)
    char *popup = NULL;
    char *close = NULL;
    char *p     = NULL;
-   char *q     = NULL; /* by BREITENB NEW! */
 
    while ((popup = strstr( buff, "window.open(" )) != NULL)
    {
@@ -117,7 +115,9 @@ void filter_popups(char *buff, int size)
 #ifdef POPUP_VERBOSE
          fprintf(logfp, "Found end of window open" );
 #endif
-         for ( p = popup; p != (close+1); p++ )
+         p = popup;
+         *p++ = '1';
+         for ( ; p != (close+1); p++ )
          {
             *p = ' ';
          }
@@ -130,23 +130,20 @@ void filter_popups(char *buff, int size)
 #ifdef POPUP_VERBOSE
          fprintf(logfp, "Couldn't find end, turned into comment.  Read boundary?\n" );
 #endif
+         *popup++ = '1';
+         *popup++ = ';';
+         *popup++ = '/';
          *popup = '/';
-         popup++;
-         *popup = '/';
-      }
-
-
-      q=popup; /* by BREITENB NEW! */
-      while (q>=buff)
-      {
-         if (*q==' ' || *q=='\t')
-            q--;
-         else break;
-      }
-      if (q>=buff)
-      {
-         if (*q=='=') *++q='1';
-         /* result of popup is assigned to a variable! ensure success. hehehe. */
+         /*
+          * result of popup is assigned to variable and the rest commented out
+          * window.open(blah
+          *            will be translated to
+          * 1;//ow.open(blah
+          *            and
+          * myWindow = window.open(blah
+          *            will be translated to
+          * myWindow = 1;//ow.open(blah
+          */
       }
    }