mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
parent
366ea4fe79
commit
ab618dd9c7
3 changed files with 43 additions and 30 deletions
|
@ -2089,13 +2089,18 @@ class CGDefineProxyHandler(CGAbstractMethod):
|
||||||
customDefineProperty = 'defineProperty_'
|
customDefineProperty = 'defineProperty_'
|
||||||
if self.descriptor.operations['IndexedSetter'] or self.descriptor.operations['NamedSetter']:
|
if self.descriptor.operations['IndexedSetter'] or self.descriptor.operations['NamedSetter']:
|
||||||
customDefineProperty = 'defineProperty'
|
customDefineProperty = 'defineProperty'
|
||||||
|
|
||||||
|
customDelete = 'delete_'
|
||||||
|
if self.descriptor.operations['NamedDeleter']:
|
||||||
|
customDelete = 'delete'
|
||||||
|
|
||||||
body = """\
|
body = """\
|
||||||
let traps = ProxyTraps {
|
let traps = ProxyTraps {
|
||||||
getPropertyDescriptor: Some(getPropertyDescriptor),
|
getPropertyDescriptor: Some(getPropertyDescriptor),
|
||||||
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
getOwnPropertyDescriptor: Some(getOwnPropertyDescriptor),
|
||||||
defineProperty: Some(%s),
|
defineProperty: Some(%s),
|
||||||
getOwnPropertyNames: Some(getOwnPropertyNames_),
|
getOwnPropertyNames: Some(getOwnPropertyNames_),
|
||||||
delete_: Some(delete_),
|
delete_: Some(%s),
|
||||||
enumerate: Some(enumerate_),
|
enumerate: Some(enumerate_),
|
||||||
|
|
||||||
has: None,
|
has: None,
|
||||||
|
@ -2123,7 +2128,7 @@ let traps = ProxyTraps {
|
||||||
};
|
};
|
||||||
|
|
||||||
CreateProxyHandler(&traps, &Class as *const _ as *const _)
|
CreateProxyHandler(&traps, &Class as *const _ as *const _)
|
||||||
""" % (customDefineProperty, FINALIZE_HOOK_NAME,
|
""" % (customDefineProperty, customDelete, FINALIZE_HOOK_NAME,
|
||||||
TRACE_HOOK_NAME)
|
TRACE_HOOK_NAME)
|
||||||
return CGGeneric(body)
|
return CGGeneric(body)
|
||||||
|
|
||||||
|
@ -3580,6 +3585,14 @@ class CGProxyNamedSetter(CGProxySpecialOperation):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
CGProxySpecialOperation.__init__(self, descriptor, 'NamedSetter')
|
CGProxySpecialOperation.__init__(self, descriptor, 'NamedSetter')
|
||||||
|
|
||||||
|
class CGProxyNamedDeleter(CGProxySpecialOperation):
|
||||||
|
"""
|
||||||
|
Class to generate a call to a named deleter.
|
||||||
|
"""
|
||||||
|
def __init__(self, descriptor):
|
||||||
|
CGProxySpecialOperation.__init__(self, descriptor, 'NamedDeleter')
|
||||||
|
|
||||||
|
|
||||||
class CGProxyUnwrap(CGAbstractMethod):
|
class CGProxyUnwrap(CGAbstractMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('*mut JSObject', 'obj')]
|
args = [Argument('*mut JSObject', 'obj')]
|
||||||
|
@ -3748,6 +3761,28 @@ class CGDOMJSProxyHandler_defineProperty(CGAbstractExternMethod):
|
||||||
def definition_body(self):
|
def definition_body(self):
|
||||||
return CGGeneric(self.getBody())
|
return CGGeneric(self.getBody())
|
||||||
|
|
||||||
|
class CGDOMJSProxyHandler_delete(CGAbstractExternMethod):
|
||||||
|
def __init__(self, descriptor):
|
||||||
|
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
|
||||||
|
Argument('jsid', 'id'),
|
||||||
|
Argument('*mut bool', 'bp')]
|
||||||
|
CGAbstractExternMethod.__init__(self, descriptor, "delete", "bool", args)
|
||||||
|
self.descriptor = descriptor
|
||||||
|
|
||||||
|
def getBody(self):
|
||||||
|
set = ""
|
||||||
|
if self.descriptor.operations['NamedDeleter']:
|
||||||
|
set += ("let name = jsid_to_str(cx, id);\n" +
|
||||||
|
"let this = UnwrapProxy(proxy);\n" +
|
||||||
|
"let this = JS::from_raw(this);\n" +
|
||||||
|
"let this = this.root();\n" +
|
||||||
|
"%s") % (CGProxyNamedDeleter(self.descriptor).define())
|
||||||
|
set += "return proxyhandler::delete_(%s);" % ", ".join(a.name for a in self.args)
|
||||||
|
return set
|
||||||
|
|
||||||
|
def definition_body(self):
|
||||||
|
return CGGeneric(self.getBody())
|
||||||
|
|
||||||
class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
|
class CGDOMJSProxyHandler_hasOwn(CGAbstractExternMethod):
|
||||||
def __init__(self, descriptor):
|
def __init__(self, descriptor):
|
||||||
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
|
args = [Argument('*mut JSContext', 'cx'), Argument('*mut JSObject', 'proxy'),
|
||||||
|
@ -4164,6 +4199,12 @@ class CGDescriptor(CGThing):
|
||||||
if descriptor.operations['IndexedSetter'] or descriptor.operations['NamedSetter']:
|
if descriptor.operations['IndexedSetter'] or descriptor.operations['NamedSetter']:
|
||||||
cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor))
|
cgThings.append(CGDOMJSProxyHandler_defineProperty(descriptor))
|
||||||
|
|
||||||
|
# We want to prevent indexed deleters from compiling at all.
|
||||||
|
assert not descriptor.operations['IndexedDeleter']
|
||||||
|
|
||||||
|
if descriptor.operations['NamedDeleter']:
|
||||||
|
cgThings.append(CGDOMJSProxyHandler_delete(descriptor))
|
||||||
|
|
||||||
#cgThings.append(CGDOMJSProxyHandler(descriptor))
|
#cgThings.append(CGDOMJSProxyHandler(descriptor))
|
||||||
#cgThings.append(CGIsMethod(descriptor))
|
#cgThings.append(CGIsMethod(descriptor))
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
[dataset-delete.html]
|
|
||||||
type: testharness
|
|
||||||
[Deleting element.dataset[\'foo\'\] should also remove an attribute with name \'data-foo\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'fooBar\'\] should also remove an attribute with name \'data-foo-bar\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'-\'\] should also remove an attribute with name \'data--\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'Foo\'\] should also remove an attribute with name \'data--foo\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'-Foo\'\] should also remove an attribute with name \'data---foo\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'\'\] should also remove an attribute with name \'data-\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[Deleting element.dataset[\'\xc3\xa0\'\] should also remove an attribute with name \'data-\xc3\xa0\' should it exist.]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[storage_session_removeitem_js.html]
|
|
||||||
type: testharness
|
|
||||||
[Web Storage 1]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue