diff src/scriptcheck.sml @ 645:1b571a05874c

React demo
author Adam Chlipala <adamc@hcoop.net>
date Tue, 10 Mar 2009 11:18:01 -0400
parents aa2290c32ce2
children b0c1a46b1f15
line wrap: on
line diff
--- a/src/scriptcheck.sml	Tue Mar 10 10:49:18 2009 -0400
+++ b/src/scriptcheck.sml	Tue Mar 10 11:18:01 2009 -0400
@@ -38,8 +38,10 @@
 val csBasis = SS.addList (SS.empty,
                           ["new_client_source",
                            "get_client_source",
-                           "set_client_source",
-                           "alert"])
+                           "set_client_source"])
+
+val scriptWords = ["<script",
+                   " onclick="]
 
 fun classify (ds, ps) =
     let
@@ -54,7 +56,7 @@
             let
                 fun hasClient e =
                     case #1 e of
-                        EPrim (Prim.String s) => inString {needle = "<script", haystack = s}
+                        EPrim (Prim.String s) => List.exists (fn n => inString {needle = n, haystack = s}) scriptWords
                       | EPrim _ => false
                       | ERel _ => false
                       | ENamed n => IS.member (csids, n)