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

Unified Diff: third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py

Issue 1884423002: IDL bindings: Avoid extended attributes leaking onto merged interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove TestPartialInterface4.idl (which doesn't exist) from list. Created 4 years, 8 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 | « no previous file | third_party/WebKit/Source/bindings/tests/idls/modules/TestInterface2Partial.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py
diff --git a/third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py b/third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py
index 1922008cd192777c9e9aa1156a08873aeb1d3497..fe49fb126bd10f4bae5cd6463fc7b3c268d9cce9 100644
--- a/third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py
+++ b/third_party/WebKit/Source/bindings/scripts/interface_dependency_resolver.py
@@ -253,17 +253,25 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base
interface post-merging).
The data storing consists of:
- * applying certain extended attributes from the dependency interface
- to its members
+ * moving certain extended attributes from the dependency interface
+ to its members (deleting the extended attribute from the interface)
* storing the C++ class of the implementation in an internal
extended attribute of each member, [PartialInterfaceImplementedAs]
No return: modifies dependency_interface in place.
"""
- merged_extended_attributes = dict(
- (key, value)
- for key, value in dependency_interface.extended_attributes.iteritems()
- if key in DEPENDENCY_EXTENDED_ATTRIBUTES)
+ merged_extended_attributes = {}
+ for key in DEPENDENCY_EXTENDED_ATTRIBUTES:
+ value = dependency_interface.extended_attributes.get(key)
+ if not value:
+ continue
+
+ merged_extended_attributes[key] = value
+ # Remove the merged attributes from the original dependency interface.
+ # This ensures that if other dependency interfaces are merged onto this
+ # one, its extended_attributes do not leak through
+ # (https://crbug.com/603782).
+ del dependency_interface.extended_attributes[key]
# A partial interface's members are implemented as static member functions
# in a separate C++ class. This class name is stored in
@@ -291,7 +299,7 @@ def transfer_extended_attributes(dependency_interface, dependency_interface_base
if (dependency_interface.is_partial or
'LegacyTreatAsPartialInterface' in dependency_interface.extended_attributes):
merged_extended_attributes['PartialInterfaceImplementedAs'] = (
- dependency_interface.extended_attributes.get(
+ dependency_interface.extended_attributes.pop(
'ImplementedAs', dependency_interface_basename))
def update_attributes(attributes, extras):
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/tests/idls/modules/TestInterface2Partial.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698