Bug 1363208 part 6. Remove the NonOrdinaryGetPrototypeOf annotation. r=peterv

We can just check for a non-global object (so excluding Window) with cross-origin properties.

Differential Revision: https://phabricator.services.mozilla.com/D15430

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Boris Zbarsky 2019-01-21 03:33:16 +00:00
parent abd3e90089
commit 4dffd37187
4 changed files with 19 additions and 9 deletions

View File

@ -3758,7 +3758,7 @@ def InitMemberSlots(descriptor, failureCode):
def SetImmutablePrototype(descriptor, failureCode):
if not descriptor.hasNonOrdinaryGetPrototypeOf():
if not descriptor.isMaybeCrossOriginObject():
return ""
return fill(
@ -12522,7 +12522,7 @@ class CGDOMJSProxyHandler(CGClass):
def __init__(self, descriptor):
assert (descriptor.supportsIndexedProperties() or
descriptor.supportsNamedProperties() or
descriptor.hasNonOrdinaryGetPrototypeOf())
descriptor.isMaybeCrossOriginObject())
methods = [CGDOMJSProxyHandler_getOwnPropDescriptor(descriptor),
CGDOMJSProxyHandler_defineProperty(descriptor),
ClassUsingDeclaration("mozilla::dom::DOMProxyHandler",
@ -12549,7 +12549,7 @@ class CGDOMJSProxyHandler(CGClass):
(descriptor.operations['NamedSetter'] is not None and
descriptor.interface.getExtendedAttribute('OverrideBuiltins'))):
methods.append(CGDOMJSProxyHandler_setCustom(descriptor))
if descriptor.hasNonOrdinaryGetPrototypeOf():
if descriptor.isMaybeCrossOriginObject():
methods.append(CGDOMJSProxyHandler_getPrototypeIfOrdinary())
if descriptor.operations['LegacyCaller']:
methods.append(CGDOMJSProxyHandler_call())

View File

@ -442,6 +442,7 @@ class Descriptor(DescriptorProvider):
if self.concrete:
self.proxy = False
self.hasCrossOriginMembers = False
iface = self.interface
for m in iface.members:
# Don't worry about inheriting legacycallers either: in
@ -456,9 +457,17 @@ class Descriptor(DescriptorProvider):
addOperation('LegacyCaller', m)
while iface:
for m in iface.members:
if (m.isAttr() and
(m.getExtendedAttribute("CrossOriginReadable") or
m.getExtendedAttribute("CrossOriginWritable"))):
self.hasCrossOriginMembers = True
if not m.isMethod():
continue
if m.getExtendedAttribute("CrossOriginCallable"):
self.hasCrossOriginMembers = True
def addIndexedOrNamedOperation(operation, m):
if m.isIndexed():
operation = 'Indexed' + operation
@ -484,7 +493,7 @@ class Descriptor(DescriptorProvider):
self.proxy = (self.supportsIndexedProperties() or
(self.supportsNamedProperties() and
not self.hasNamedPropertiesObject) or
self.hasNonOrdinaryGetPrototypeOf())
self.isMaybeCrossOriginObject())
if self.proxy:
if (not self.operations['IndexedGetter'] and
@ -708,8 +717,10 @@ class Descriptor(DescriptorProvider):
namedGetter = self.operations['NamedGetter']
return namedGetter.getExtendedAttribute("NeedsCallerType")
def hasNonOrdinaryGetPrototypeOf(self):
return self.interface.getExtendedAttribute("NonOrdinaryGetPrototypeOf")
def isMaybeCrossOriginObject(self):
# If we're isGlobal and have cross-origin members, we're a Window, and
# that's not a cross-origin object. The WindowProxy is.
return self.hasCrossOriginMembers and not self.isGlobal()
def needsHeaderInclude(self):
"""

View File

@ -1786,8 +1786,7 @@ class IDLInterface(IDLInterfaceOrNamespace):
identifier == "ProbablyShortLivingWrapper" or
identifier == "LegacyUnenumerableNamedProperties" or
identifier == "RunConstructorInCallerCompartment" or
identifier == "WantsEventListenerHooks" or
identifier == "NonOrdinaryGetPrototypeOf"):
identifier == "WantsEventListenerHooks"):
# Known extended attributes that do not take values
if not attr.noArguments():
raise WebIDLError("[%s] must take no arguments" % identifier,

View File

@ -11,7 +11,7 @@
* and create derivative works of this document.
*/
[Unforgeable, NonOrdinaryGetPrototypeOf]
[Unforgeable]
interface Location {
// Bug 824857: no support for stringifier attributes yet.
// stringifier attribute USVString href;