def _build_global(self, name, entity): "Builds an object based on an entity from the predefined entity list" if "dangerous" in entity: dang = entity["dangerous"] if dang and not isinstance(dang, types.LambdaType): self._debug("DANGEROUS") self.err.warning(("testcases_javascript_traverser", "_build_global", "dangerous_global"), "Illegal or deprecated access to the '%s' global" % name, [dang if isinstance(dang, (types.StringTypes, list, tuple)) else "Access to the '%s' property is deprecated " "for security or other reasons." % name], self.filename, line=self.line, column=self.position, context=self.context) if "name" not in entity: entity["name"] = name # Build out the wrapper object from the global definition. result = JSWrapper(is_global=True, traverser=self, lazy=True) result.value = entity result = actions._expand_globals(self, result) if "context" in entity: result.context = entity["context"] self._debug("BUILT_GLOBAL") return result
def _build_global(self, name, entity): "Builds an object based on an entity from the predefined entity list" if "dangerous" in entity: dang = entity["dangerous"] if dang and not isinstance(dang, types.LambdaType): self._debug("DANGEROUS") self.err.warning(("testcases_javascript_traverser", "_build_global", "dangerous_global"), "Dangerous Global Object", [dang if isinstance(dang, types.StringTypes) else "A dangerous or banned global object was " "accessed by some JavaScript code.", "Accessed object: %s" % name], self.filename, line=self.line, column=self.position, context=self.context) # Build out the wrapper object from the global definition. result = JSWrapper(is_global=True, traverser=self, lazy=True) result.value = entity result = actions._expand_globals(self, result) if "context" in entity: result.context = entity["context"] self._debug("BUILT_GLOBAL") return result