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

Side by Side Diff: lib/html/scripts/systemhtml.py

Issue 11175014: Use CheckSecurityForNode to filter out insecure calls (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/html/scripts/htmlrenamer.py ('k') | lib/html/scripts/systemnative.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 432
433 def AddIndexer(self, element_type): 433 def AddIndexer(self, element_type):
434 self._backend.AddIndexer(element_type) 434 self._backend.AddIndexer(element_type)
435 435
436 def AmendIndexer(self, element_type): 436 def AmendIndexer(self, element_type):
437 self._backend.AmendIndexer(element_type) 437 self._backend.AmendIndexer(element_type)
438 438
439 def AddAttribute(self, attribute, is_secondary=False): 439 def AddAttribute(self, attribute, is_secondary=False):
440 dom_name = DartDomNameOfAttribute(attribute) 440 dom_name = DartDomNameOfAttribute(attribute)
441 html_name = self._renamer.RenameMember( 441 html_name = self._renamer.RenameMember(
442 self._interface.id, dom_name, 'get:') 442 self._interface.id, attribute, dom_name, 'get:')
443 if not html_name or self._IsPrivate(html_name): 443 if not html_name or self._IsPrivate(html_name):
444 return 444 return
445 445
446 446
447 html_setter_name = self._renamer.RenameMember( 447 html_setter_name = self._renamer.RenameMember(
448 self._interface.id, dom_name, 'set:') 448 self._interface.id, attribute, dom_name, 'set:')
449 read_only = (attribute.is_read_only or 'Replaceable' in attribute.ext_attrs 449 read_only = (attribute.is_read_only or 'Replaceable' in attribute.ext_attrs
450 or not html_setter_name) 450 or not html_setter_name)
451 451
452 # We don't yet handle inconsistent renames of the getter and setter yet. 452 # We don't yet handle inconsistent renames of the getter and setter yet.
453 assert(not html_setter_name or html_name == html_setter_name) 453 assert(not html_setter_name or html_name == html_setter_name)
454 454
455 if not is_secondary: 455 if not is_secondary:
456 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */', 456 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */',
457 DOMINTERFACE=attribute.doc_js_interface_name, 457 DOMINTERFACE=attribute.doc_js_interface_name,
458 DOMNAME=dom_name) 458 DOMNAME=dom_name)
(...skipping 11 matching lines...) Expand all
470 def AddSecondaryAttribute(self, interface, attribute): 470 def AddSecondaryAttribute(self, interface, attribute):
471 self._backend.SecondaryContext(interface) 471 self._backend.SecondaryContext(interface)
472 self.AddAttribute(attribute, True) 472 self.AddAttribute(attribute, True)
473 473
474 def AddOperation(self, info, skip_declaration=False): 474 def AddOperation(self, info, skip_declaration=False):
475 """ 475 """
476 Arguments: 476 Arguments:
477 operations - contains the overloads, one or more operations with the same 477 operations - contains the overloads, one or more operations with the same
478 name. 478 name.
479 """ 479 """
480 html_name = self._renamer.RenameMember(self._interface.id, info.name) 480 # FIXME: When we pass in operations[0] below, we're assuming all
481 # overloaded operations have the same security attributes. This
482 # is currently true, but we should consider filtering earlier or
483 # merging the relevant data into info itself.
484 html_name = self._renamer.RenameMember(self._interface.id,
485 info.operations[0],
486 info.name)
481 if not html_name: 487 if not html_name:
482 if info.name == 'item': 488 if info.name == 'item':
483 # FIXME: item should be renamed to operator[], not removed. 489 # FIXME: item should be renamed to operator[], not removed.
484 self._backend.AddOperation(info, '_item') 490 self._backend.AddOperation(info, '_item')
485 return 491 return
486 492
487 if not self._IsPrivate(html_name) and not skip_declaration: 493 if not self._IsPrivate(html_name) and not skip_declaration:
488 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */', 494 self._members_emitter.Emit('\n /** @domName $DOMINTERFACE.$DOMNAME */',
489 DOMINTERFACE=info.overloads[0].doc_js_interface_name, 495 DOMINTERFACE=info.overloads[0].doc_js_interface_name,
490 DOMNAME=info.name) 496 DOMNAME=info.name)
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
1116 1122
1117 library_emitter = self._multiemitter.FileEmitter(library_file_path) 1123 library_emitter = self._multiemitter.FileEmitter(library_file_path)
1118 library_file_dir = os.path.dirname(library_file_path) 1124 library_file_dir = os.path.dirname(library_file_path)
1119 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir) 1125 auxiliary_dir = os.path.relpath(auxiliary_dir, library_file_dir)
1120 imports_emitter = library_emitter.Emit( 1126 imports_emitter = library_emitter.Emit(
1121 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir)) 1127 self._template, AUXILIARY_DIR=massage_path(auxiliary_dir))
1122 for path in sorted(self._path_to_emitter.keys()): 1128 for path in sorted(self._path_to_emitter.keys()):
1123 relpath = os.path.relpath(path, library_file_dir) 1129 relpath = os.path.relpath(path, library_file_dir)
1124 imports_emitter.Emit( 1130 imports_emitter.Emit(
1125 "#source('$PATH');\n", PATH=massage_path(relpath)) 1131 "#source('$PATH');\n", PATH=massage_path(relpath))
OLDNEW
« no previous file with comments | « lib/html/scripts/htmlrenamer.py ('k') | lib/html/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698