Web Inspector: Restrict domains at the target level instead of only at the window...
[WebKit-https.git] / Source / JavaScriptCore / inspector / scripts / codegen / models.py
index d09b242..a03fd62 100755 (executable)
@@ -388,20 +388,14 @@ class Protocol:
             events.extend([self.parse_event(event) for event in json['events']])
 
         if 'availability' in json:
-            if not commands and not events:
-                raise ParseException("Malformed domain specification: availability should only be included if there are commands or events.")
             if not isinstance(json['availability'], list):
                 raise ParseException("Malformed domain specification: availability is not an array")
-            allowed_activation_strings = set(['web', 'service-worker'])
+            allowed_activation_strings = set(['javascript', 'web', 'worker', 'service-worker'])
             for availability_type in json['availability']:
                 if availability_type not in allowed_activation_strings:
                     raise ParseException('Malformed domain specification: availability is an unsupported string. Was: "%s", Allowed values: %s' % (json['availability'], ', '.join(allowed_activation_strings)))
 
-        if 'workerSupported' in json:
-            if not isinstance(json['workerSupported'], bool):
-                raise ParseException('Malformed domain specification: workerSupported is not a boolean. Was: "%s"' % json['availability'])
-
-        self.domains.append(Domain(json['domain'], json.get('description', ''), json.get('featureGuard'), json.get('availability'), json.get('workerSupported', False), isSupplemental, types, commands, events))
+        self.domains.append(Domain(json['domain'], json.get('description', ''), json.get('featureGuard'), json.get('availability'), isSupplemental, types, commands, events))
 
     def parse_type_declaration(self, json):
         check_for_required_properties(['id', 'type'], json, "type")
@@ -571,12 +565,11 @@ class Protocol:
 
 
 class Domain:
-    def __init__(self, domain_name, description, feature_guard, availability, workerSupported, isSupplemental, type_declarations, commands, events):
+    def __init__(self, domain_name, description, feature_guard, availability, isSupplemental, type_declarations, commands, events):
         self.domain_name = domain_name
         self.description = description
         self.feature_guard = feature_guard
         self.availability = availability
-        self.workerSupported = workerSupported
         self.is_supplemental = isSupplemental
         self._type_declarations = type_declarations
         self._commands = commands
@@ -606,7 +599,7 @@ class Domain:
 
 
 class Domains:
-    GLOBAL = Domain("", "The global domain, in which primitive types are implicitly declared.", None, None, True, False, [], [], [])
+    GLOBAL = Domain("", "The global domain, in which primitive types are implicitly declared.", None, None, False, [], [], [])
 
 
 class TypeDeclaration: