Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Unified Diff: Source/bindings/scripts/v8_utilities.py

Issue 1333853002: bindings: Moves event handlers and methods of Window to the instance object. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Synced. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/v8_utilities.py
diff --git a/Source/bindings/scripts/v8_utilities.py b/Source/bindings/scripts/v8_utilities.py
index a16af83fb5ad43296d59096660d78062b0e7f5b0..bce4ef5c686d26889bc57c9b6ef7e6ecabce1e15 100644
--- a/Source/bindings/scripts/v8_utilities.py
+++ b/Source/bindings/scripts/v8_utilities.py
@@ -35,7 +35,7 @@ import re
from idl_types import IdlTypeBase
import idl_types
-from idl_definitions import Exposure, IdlInterface, IdlAttribute, IdlOperation
+from idl_definitions import Exposure, IdlInterface, IdlAttribute
from v8_globals import includes
ACRONYMS = [
@@ -421,10 +421,25 @@ def on_instance(interface, member):
- [Unforgeable] members
- regular members of [Global] or [PrimaryGlobal] interfaces
"""
- # TODO(yukishiino): Implement this function following the spec.
if member.is_static:
return False
- return not on_prototype(interface, member)
+
+ # TODO(yukishiino): Remove a hack for toString once we support
+ # Symbol.toStringTag.
+ if (interface.name == 'Window' and member.name == 'toString'):
+ return False
+
+ # TODO(yukishiino): Implement "interface object" and its [[Call]] method
+ # in a better way. Then we can get rid of this hack.
+ if is_constructor_attribute(member):
+ return True
+
+ if ('PrimaryGlobal' in interface.extended_attributes or
+ 'Global' in interface.extended_attributes or
+ 'Unforgeable' in member.extended_attributes or
+ 'Unforgeable' in interface.extended_attributes):
+ return True
+ return False
def on_prototype(interface, member):
@@ -433,26 +448,29 @@ def on_prototype(interface, member):
Most members are defined on the prototype object. Exceptions are as
follows.
- - constant members
- static members (optional)
- [Unforgeable] members
- members of [Global] or [PrimaryGlobal] interfaces
- named properties of [Global] or [PrimaryGlobal] interfaces
"""
- # TODO(yukishiino): Implement this function following the spec.
-
- # These members must not be placed on prototype chains.
- if (is_constructor_attribute(member) or
- member.is_static or
- is_unforgeable(interface, member)):
+ if member.is_static:
return False
- # TODO(yukishiino): We should handle [Global] and [PrimaryGlobal] instead of
- # Window.
- if (interface.name == 'Window'):
- return (member.idl_type.name == 'EventHandler' or
- type(member) == IdlOperation)
+ # TODO(yukishiino): Remove a hack for toString once we support
+ # Symbol.toStringTag.
+ if (interface.name == 'Window' and member.name == 'toString'):
+ return True
+
+ # TODO(yukishiino): Implement "interface object" and its [[Call]] method
+ # in a better way. Then we can get rid of this hack.
+ if is_constructor_attribute(member):
+ return False
+ if ('PrimaryGlobal' in interface.extended_attributes or
+ 'Global' in interface.extended_attributes or
+ 'Unforgeable' in member.extended_attributes or
+ 'Unforgeable' in interface.extended_attributes):
+ return False
return True
@@ -462,10 +480,8 @@ def on_interface(interface, member):
interface object.
The following members must be defiend on an interface object.
- - constant members
- static members
"""
- # TODO(yukishiino): Implement this function following the spec.
if member.is_static:
return True
return False
« no previous file with comments | « Source/bindings/scripts/v8_methods.py ('k') | Source/bindings/templates/interface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698