dap commit: define the EventTarget as an untested interface

changeset:   396:1375b4c4b759
tag:         tip
user:        Anssi Kostiainen <anssi.kostiainen@nokia.com>
date:        Mon Feb 25 13:06:28 2013 +0200
files:       battery/tests/submissions/anssik/battery-interface-idlharness.html
description:
define the EventTarget as an untested interface


diff -r eb6f23519b41 -r 1375b4c4b759 battery/tests/submissions/anssik/battery-interface-idlharness.html
--- a/battery/tests/submissions/anssik/battery-interface-idlharness.html	Fri Feb 22 16:31:00 2013 +0200
+++ b/battery/tests/submissions/anssik/battery-interface-idlharness.html	Mon Feb 25 13:06:28 2013 +0200
@@ -6,6 +6,20 @@
     <script src="/resources/testharnessreport.js"></script>
     <script src="/resources/WebIDLParser.js"></script>
     <script src="/resources/idlharness.js"></script>
+    <script type="text/plain" class="untested">
+    interface Navigator { };
+    
+    interface EventTarget {
+      void addEventListener(DOMString type, EventListener? callback, optional boolean capture);
+      void removeEventListener(DOMString type, EventListener? callback, optional boolean capture);
+      boolean dispatchEvent(Event event);
+    };
+    
+    [Callback]
+    interface EventListener {
+      void handleEvent(Event event);
+    };
+    </script>
     <script type="text/plain">
     partial interface Navigator {
         readonly attribute BatteryManager battery;
@@ -23,13 +37,15 @@
     };
     </script>
     <script>
+    "use strict";
     var idl_array = new IdlArray();
-    idl_array.add_untested_idls('interface Navigator { };');
-    var idls = document.querySelector('script[type=text\\/plain]').textContent;
-    // replace 'EventHandler' and 'unrestricted double' unrecognized by idlharness.js
-    idls = idls.replace('EventHandler', 'Function?', 'g').replace('unrestricted double', 'double', 'g');
-    idl_array.add_idls(idls);
-    idl_array.add_objects({Navigator: ["navigator"], BatteryManager: ["navigator.battery"]});
+    var idls;
+    [].forEach.call(document.querySelectorAll('script[type=text\\/plain]'), function(node) {
+      // replace 'EventHandler' and 'unrestricted double' unrecognized by idlharness.js
+      idls = node.textContent.replace('EventHandler', 'Function?', 'g').replace('unrestricted double', 'double', 'g');
+      idl_array[(node.className === 'untested') ? 'add_untested_idls' : 'add_idls'](idls);
+    });
+    idl_array.add_objects({Navigator: ['navigator'], BatteryManager: ['navigator.battery']});
     idl_array.test();
     </script>
   </head>

Received on Monday, 25 February 2013 11:06:36 UTC