From 1815e242b33894851caa20ca8dd5586f0acd8894 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Mon, 9 Dec 2013 10:34:03 -0500 Subject: [PATCH] Bug 946067 part 1. Add support for WebIDL extended attributes to allow annotating allowed cross-origin access. r=peterv --- dom/bindings/parser/WebIDL.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index dc0e0f00ea36..a1283c7b436f 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -2712,6 +2712,14 @@ class IDLAttribute(IDLInterfaceMember): if self.isStatic(): raise WebIDLError("[LenientThis] is only allowed on non-static " "attributes", [attr.location, self.location]) + if self.getExtendedAttribute("CrossOriginReadable"): + raise WebIDLError("[LenientThis] is not allowed in combination " + "with [CrossOriginReadable]", + [attr.location, self.location]) + if self.getExtendedAttribute("CrossOriginWritable"): + raise WebIDLError("[LenientThis] is not allowed in combination " + "with [CrossOriginWritable]", + [attr.location, self.location]) self.lenientThis = True elif identifier == "Unforgeable": if not self.readonly: @@ -2774,6 +2782,19 @@ class IDLAttribute(IDLInterfaceMember): raise WebIDLError("[Cached] and [StoreInSlot] must not be " "specified on the same attribute", [attr.location, self.location]) + elif (identifier == "CrossOriginReadable" or + identifier == "CrossOriginWritable"): + if not attr.noArguments(): + raise WebIDLError("[%s] must take no arguments" % identifier, + [attr.location]) + if self.isStatic(): + raise WebIDLError("[%s] is only allowed on non-static " + "attributes" % identifier, + [attr.location, self.location]) + if self.getExtendedAttribute("LenientThis"): + raise WebIDLError("[LenientThis] is not allowed in combination " + "with [%s]" % identifier, + [attr.location, self.location]) elif (identifier == "Pref" or identifier == "SetterThrows" or identifier == "Pure" or @@ -3322,6 +3343,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope): identifier == "Pref" or identifier == "Func" or identifier == "Pure" or + identifier == "CrossOriginCallable" or identifier == "WebGLHandlesContextLoss"): # Known attributes that we don't need to do anything with here pass